Change visibility data on Mastodon posts to be array of IDs

This commit is contained in:
Hank Grabowski 2023-03-21 13:15:42 -04:00
parent 97585083d9
commit 60f2c67b66
2 changed files with 8 additions and 6 deletions

View file

@ -28,6 +28,7 @@ use Friendica\Content\Text\BBCode;
use Friendica\Core\Logger;
use Friendica\Database\Database;
use Friendica\Database\DBA;
use Friendica\DI;
use Friendica\Model\Item;
use Friendica\Model\Post;
use Friendica\Model\Tag as TagModel;
@ -291,8 +292,9 @@ class Status extends BaseFactory
$in_reply = [];
}
$aclFormatter = DI::aclFormatter();
$delivery_data = $uid != $item['uid'] ? null : new FriendicaDeliveryData($item['delivery_queue_count'], $item['delivery_queue_done'], $item['delivery_queue_failed']);
$visibility_data = $uid != $item['uid'] ? null : new FriendicaVisibility($item['allow_cid'], $item['deny_cid'], $item['allow_gid'], $item['deny_gid']);
$visibility_data = $uid != $item['uid'] ? null : new FriendicaVisibility($aclFormatter->expand($item['allow_cid']), $aclFormatter->expand($item['deny_cid']), $aclFormatter->expand($item['allow_gid']), $aclFormatter->expand($item['deny_gid']));
$friendica = new FriendicaExtension($item['title'], $item['changed'], $item['commented'], $item['received'], $counts->dislikes, $delivery_data, $visibility_data);
return new \Friendica\Object\Api\Mastodon\Status($item, $account, $counts, $userAttributes, $sensitive, $application, $mentions, $tags, $card, $attachments, $in_reply, $reshare, $friendica, $quote, $poll);

View file

@ -32,16 +32,16 @@ use Friendica\BaseDataTransferObject;
*/
class FriendicaVisibility extends BaseDataTransferObject
{
/** @var string|null */
/** @var array */
protected $allow_cid;
/** @var string|null */
/** @var array */
protected $deny_cid;
/** @var string|null */
/** @var array */
protected $allow_gid;
/** @var string|null */
/** @var array */
protected $deny_gid;
public function __construct(?string $allow_cid, ?string $deny_cid, ?string $allow_gid, ?string $deny_gid)
public function __construct(array $allow_cid, array $deny_cid, array $allow_gid, array $deny_gid)
{
$this->allow_cid = $allow_cid;
$this->deny_cid = $deny_cid;