]> git.mxchange.org Git - friendica.git/commitdiff
Public forums are now posting unlisted
authorMichael <heluecht@pirati.ca>
Sat, 5 Jun 2021 18:38:21 +0000 (18:38 +0000)
committerMichael <heluecht@pirati.ca>
Sat, 5 Jun 2021 18:38:21 +0000 (18:38 +0000)
mod/item.php
src/Model/Item.php
src/Protocol/ActivityPub/Transmitter.php
src/Worker/Notifier.php

index a8870d6865ed54cfacc7b33fc2a8a5d3eaf3495c..7d565bc35bd515da94f694af391332ba2b0c52a9 100644 (file)
@@ -436,8 +436,8 @@ function item_post(App $a) {
        $original_contact_id = $contact_id;
 
        if (!$toplevel_item_id && !empty($forum_contact) && ($private_forum || $only_to_forum)) {
-               // we tagged a forum in a top level post. Now we change the post
-               $private = $private_forum;
+               // we tagged a forum in a top level post. Now we change the post                
+               $private = $private_forum ? Item::PRIVATE : Item::UNLISTED;
 
                if ($only_to_forum) {
                        $postopts = '';
index f6bec1561cb0f0ed0e6e010a74bb1e75f133d73c..f85bce5e8fcda0926657cf8864293777f76e8925 100644 (file)
@@ -1919,7 +1919,7 @@ class Item
 
                // also reset all the privacy bits to the forum default permissions
 
-               $private = ($user['allow_cid'] || $user['allow_gid'] || $user['deny_cid'] || $user['deny_gid']) ? self::PRIVATE : self::PUBLIC;
+               $private = ($user['allow_cid'] || $user['allow_gid'] || $user['deny_cid'] || $user['deny_gid']) ? self::PRIVATE : self::UNLISTED;
 
                $psid = PermissionSet::getIdFromACL(
                        $user['uid'],
index bfb1287c8295ceed0a8d75ab247cb057d72f7530..76bc295d1c4f814d34f1f64a8effdad56c7eb3b1 100644 (file)
@@ -533,6 +533,8 @@ class Transmitter
                        $actor_profile = APContact::getByURL($item['author-link']);
                }
 
+               $exclusive = false;
+
                $terms = Tag::getByURIId($item['uri-id'], [Tag::MENTION, Tag::IMPLICIT_MENTION, Tag::EXCLUSIVE_MENTION]);
 
                if ($item['private'] != Item::PRIVATE) {
@@ -557,6 +559,9 @@ class Transmitter
                        foreach ($terms as $term) {
                                $profile = APContact::getByURL($term['url'], false);
                                if (!empty($profile)) {
+                                       if ($term['type'] == Tag::EXCLUSIVE_MENTION) {
+                                               $exclusive = true;
+                                       }
                                        $data['to'][] = $profile['url'];
                                }
                        }
@@ -612,7 +617,7 @@ class Transmitter
                                                                        $data['cc'][] = $actor_profile['followers'];
                                                                }
                                                        }
-                                               } else {
+                                               } elseif (!$exclusive) {
                                                        // Public thread parent post always are directed to the followers
                                                        if (($item['private'] != Item::PRIVATE) && !$forum_mode) {
                                                                $data['cc'][] = $actor_profile['followers'];
index de2774594d7972ee9f5b8c124d9667ea795d525e..4af1bc91484777ecb628ca0253414242e318a3f0 100644 (file)
@@ -283,6 +283,16 @@ class Notifier
                                }
 
                                Logger::log('Notify ' . $target_item["guid"] .' via PuSH: ' . ($push_notify ? "Yes":"No"), Logger::DEBUG);
+                       } elseif ($targets = Tag::getByURIId($target_item['uri-id'], [Tag::EXCLUSIVE_MENTION])) {
+                               $followup = true;
+
+                               foreach ($targets as $target) {
+                                       $cid = Contact::getIdForURL($target['url'], $uid, false);
+                                       if ($cid) {
+                                               $recipients_followup[] = $cid;
+                                               Logger::info('Exclusively delivering', ['guid' => $target_item['guid'], 'uri-id' => $target_item['uri-id'], 'url' => $target['url']]);
+                                       }
+                               }
                        } else {
                                $followup = false;