From 6e523beec317e1732c4dc399b9561ec1f3ebe2e5 Mon Sep 17 00:00:00 2001 From: Michael Date: Sun, 3 Dec 2023 10:26:58 +0000 Subject: [PATCH 1/3] The option "community_no_sharer" is now always enabled --- src/Module/Conversation/Channel.php | 2 +- src/Module/Conversation/Community.php | 2 +- static/defaults.config.php | 4 ---- 3 files changed, 2 insertions(+), 6 deletions(-) diff --git a/src/Module/Conversation/Channel.php b/src/Module/Conversation/Channel.php index e841eaa277..d2453b410a 100644 --- a/src/Module/Conversation/Channel.php +++ b/src/Module/Conversation/Channel.php @@ -115,7 +115,7 @@ class Channel extends Timeline $this->page['aside'] .= Widget::accountTypes('channel/' . $this->selectedTab, $this->accountTypeString); - if (!in_array($this->selectedTab, [ChannelEntity::FOLLOWERS, ChannelEntity::FORYOU]) && $this->config->get('system', 'community_no_sharer')) { + if (!in_array($this->selectedTab, [ChannelEntity::FOLLOWERS, ChannelEntity::FORYOU])) { $this->page['aside'] .= $this->getNoSharerWidget('channel'); } diff --git a/src/Module/Conversation/Community.php b/src/Module/Conversation/Community.php index 117a18da37..6fec4cc94d 100644 --- a/src/Module/Conversation/Community.php +++ b/src/Module/Conversation/Community.php @@ -106,7 +106,7 @@ class Community extends Timeline $this->page['aside'] .= Widget::accountTypes('community/' . $this->selectedTab, $this->accountTypeString); - if ($this->session->getLocalUserId() && $this->config->get('system', 'community_no_sharer')) { + if ($this->session->getLocalUserId()) { $this->page['aside'] .= $this->getNoSharerWidget('community'); } diff --git a/static/defaults.config.php b/static/defaults.config.php index e7bc123501..841a9c2c30 100644 --- a/static/defaults.config.php +++ b/static/defaults.config.php @@ -148,10 +148,6 @@ return [ // Comma separated list of hashtags that shouldn't be displayed in the trending tags 'blocked_tags' => '', - // community_no_sharer (Boolean) - // Don't display sharing accounts on the global community - 'community_no_sharer' => false, - // contact_update_limit (Integer) // How many contacts should be checked at a time? 'contact_update_limit' => 100, From 6c7dee4bcdf9c877c90a7d82ab38b251fb40b9bd Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Sat, 2 Dec 2023 16:51:35 -0500 Subject: [PATCH 2/3] Check media_attributes keys before using them in Mastodon\Statuses - Address https://github.com/friendica/friendica/issues/13157#issuecomment-1832575517 --- src/Module/Api/Mastodon/Statuses.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Module/Api/Mastodon/Statuses.php b/src/Module/Api/Mastodon/Statuses.php index 84eaadfe5e..0ebd616089 100644 --- a/src/Module/Api/Mastodon/Statuses.php +++ b/src/Module/Api/Mastodon/Statuses.php @@ -122,8 +122,8 @@ class Statuses extends BaseApi $existing_media = array_column(Post\Media::getByURIId($post['uri-id'], [Post\Media::AUDIO, Post\Media::VIDEO, Post\Media::IMAGE]), 'id'); foreach ($request['media_attributes'] as $attributes) { - if (in_array($attributes['id'], $existing_media)) { - Post\Media::updateById(['description' => $attributes['description']], $attributes['id']); + if (!empty($attributes['id']) && in_array($attributes['id'], $existing_media)) { + Post\Media::updateById(['description' => $attributes['description'] ?? null], $attributes['id']); } } @@ -227,7 +227,7 @@ class Statuses extends BaseApi break; } } - + if (!empty($owner['allow_cid'] . $owner['allow_gid'] . $owner['deny_cid'] . $owner['deny_gid'])) { $item['allow_cid'] = $owner['allow_cid']; $item['allow_gid'] = $owner['allow_gid']; @@ -306,7 +306,7 @@ class Statuses extends BaseApi } $item = DI::contentItem()->expandTags($item, $request['visibility'] == 'direct'); - + if (!empty($request['media_ids'])) { $item = $this->storeMediaIds($request['media_ids'], $item); } From 5971334ec701736f06c6e4a057d43c30292811a4 Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Sat, 2 Dec 2023 16:57:40 -0500 Subject: [PATCH 3/3] Check for $profile emptiness before calling getReceiverForActor() in ActivityPub->getReceivers - Address https://github.com/friendica/friendica/issues/13157#issuecomment-1837127082 --- src/Protocol/ActivityPub/Receiver.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Protocol/ActivityPub/Receiver.php b/src/Protocol/ActivityPub/Receiver.php index 933b9be438..ff78f0db82 100644 --- a/src/Protocol/ActivityPub/Receiver.php +++ b/src/Protocol/ActivityPub/Receiver.php @@ -1213,7 +1213,7 @@ class Receiver } // Fetch the receivers for the public and the followers collection - if ((($receiver == $followers) || (($receiver == self::PUBLIC_COLLECTION) && !$isGroup) || ($isGroup && ($element == 'as:audience'))) && !empty($actor)) { + if ((($receiver == $followers) || (($receiver == self::PUBLIC_COLLECTION) && !$isGroup) || ($isGroup && ($element == 'as:audience'))) && !empty($profile)) { $receivers = self::getReceiverForActor($tags, $receivers, $follower_target, $profile); continue; }