Support the "media_attachments" field
This commit is contained in:
parent
9b609ba19d
commit
13529fa97d
|
@ -23,6 +23,7 @@ namespace Friendica\Factory\Api\Mastodon;
|
||||||
|
|
||||||
use Friendica\BaseFactory;
|
use Friendica\BaseFactory;
|
||||||
use Friendica\Database\Database;
|
use Friendica\Database\Database;
|
||||||
|
use Friendica\DI;
|
||||||
use Friendica\Model\ItemURI;
|
use Friendica\Model\ItemURI;
|
||||||
use Friendica\Model\Photo;
|
use Friendica\Model\Photo;
|
||||||
use Friendica\Model\Post;
|
use Friendica\Model\Post;
|
||||||
|
@ -60,8 +61,11 @@ class ScheduledStatus extends BaseFactory
|
||||||
}
|
}
|
||||||
|
|
||||||
$media_ids = [];
|
$media_ids = [];
|
||||||
|
$media_attachments = [];
|
||||||
foreach ($parameters['attachments'] as $attachment) {
|
foreach ($parameters['attachments'] as $attachment) {
|
||||||
$media_ids[] = Photo::getIdForName($attachment['url']);
|
$id = Photo::getIdForName($attachment['url']);
|
||||||
|
$media_ids[] = (string)$id;
|
||||||
|
$media_attachments[] = DI::mstdnAttachment()->createFromPhoto($id);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($parameters['item']['thr-parent']) && ($parameters['item']['gravity'] ?? GRAVITY_PARENT != GRAVITY_PARENT)) {
|
if (isset($parameters['item']['thr-parent']) && ($parameters['item']['gravity'] ?? GRAVITY_PARENT != GRAVITY_PARENT)) {
|
||||||
|
@ -70,6 +74,6 @@ class ScheduledStatus extends BaseFactory
|
||||||
$in_reply_to_id = null;
|
$in_reply_to_id = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
return new \Friendica\Object\Api\Mastodon\ScheduledStatus($delayed_post, $parameters, $media_ids, $in_reply_to_id);
|
return new \Friendica\Object\Api\Mastodon\ScheduledStatus($delayed_post, $parameters, $media_ids, $media_attachments, $in_reply_to_id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -59,7 +59,7 @@ class ScheduledStatus extends BaseDataTransferObject
|
||||||
* @param array $parameters Parameters for the workerqueue entry for the delayed post
|
* @param array $parameters Parameters for the workerqueue entry for the delayed post
|
||||||
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
|
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
|
||||||
*/
|
*/
|
||||||
public function __construct(array $delayed_post, array $parameters, array $media_ids = null, int $in_reply_to_id = null)
|
public function __construct(array $delayed_post, array $parameters, array $media_ids = null, array $media_attachments = [], int $in_reply_to_id = null)
|
||||||
{
|
{
|
||||||
$visibility = ['public', 'private', 'unlisted'];
|
$visibility = ['public', 'private', 'unlisted'];
|
||||||
|
|
||||||
|
@ -79,6 +79,6 @@ class ScheduledStatus extends BaseDataTransferObject
|
||||||
'application_id' => ''
|
'application_id' => ''
|
||||||
];
|
];
|
||||||
|
|
||||||
$this->media_attachments = [];
|
$this->media_attachments = $media_attachments;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user