All needed fields are now filled

This commit is contained in:
Michael 2021-07-30 13:22:06 +00:00
parent 93263a820d
commit 929de9081e
5 changed files with 41 additions and 7 deletions

View file

@ -841,13 +841,28 @@ class Photo
* @throws \Exception
*/
public static function isLocal($name)
{
return (bool)self::getIdForName($name);
}
/**
* Return the id of a local photo
*
* @param string $name Picture link
* @return int
*/
public static function getIdForName($name)
{
$data = self::getResourceData($name);
if (empty($data)) {
return false;
return 0;
}
return DBA::exists('photo', ['resource-id' => $data['guid'], 'scale' => $data['scale']]);
$photo = DBA::selectFirst('photo', ['id'], ['resource-id' => $data['guid'], 'scale' => $data['scale']]);
if (!empty($photo['id'])) {
return $photo['id'];
}
return 0;
}
/**

View file

@ -134,6 +134,12 @@ class Delayed
return [];
}
// Make sure to only publish the attachments in the dedicated array field
if (empty($parameters[3]) && !empty($parameters[0]['attachments'])) {
$parameters[3] = $parameters[0]['attachments'];
unset($parameters[0]['attachments']);
}
return [
'parameters' => $delayed,
'item' => $parameters[0],