From 0c8e0a033dfc04f59bbbabd3596fe69d611cc30d Mon Sep 17 00:00:00 2001
From: Michael <heluecht@pirati.ca>
Date: Tue, 27 Dec 2022 17:01:40 +0000
Subject: [PATCH] Improved handling of forum mentions

---
 src/Protocol/ActivityPub/Transmitter.php | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/src/Protocol/ActivityPub/Transmitter.php b/src/Protocol/ActivityPub/Transmitter.php
index 6b0064c3e9..66ee9e4b5c 100644
--- a/src/Protocol/ActivityPub/Transmitter.php
+++ b/src/Protocol/ActivityPub/Transmitter.php
@@ -674,6 +674,7 @@ class Transmitter
 		}
 
 		$exclusive = false;
+		$mention   = false;
 
 		if ($is_forum_thread) {
 			foreach (Tag::getByURIId($item['parent-uri-id'], [Tag::MENTION, Tag::EXCLUSIVE_MENTION]) as $term) {
@@ -682,7 +683,7 @@ class Transmitter
 					if ($term['type'] == Tag::EXCLUSIVE_MENTION) {
 						$exclusive = true;
 					} elseif ($term['type'] == Tag::MENTION) {
-						$exclusive = false;
+						$mention = true;
 					}
 				}
 			}
@@ -718,7 +719,7 @@ class Transmitter
 							$data['cc'][] = $profile['followers'];
 						}
 					} elseif (($term['type'] == Tag::MENTION) && ($profile['type'] == 'Group')) {
-						$exclusive = false;
+						$mention = true;
 					}
 					$data['to'][] = $profile['url'];
 				}
@@ -742,13 +743,17 @@ class Transmitter
 								$data['cc'][] = $profile['followers'];
 							}
 						} elseif (($term['type'] == Tag::MENTION) && ($profile['type'] == 'Group')) {
-							$exclusive = false;
+							$mention = true;
 						}
 						$data['to'][] = $profile['url'];
 					}
 				}
 			}
 
+			if ($mention) {
+				$exclusive = false;
+			}
+
 			if ($is_forum && !$exclusive && !empty($follower)) {
 				$data['cc'][] = $follower;
 			} elseif (!$exclusive) {
-- 
2.39.5