]> git.mxchange.org Git - friendica.git/blobdiff - src/Worker/Notifier.php
Merge remote-tracking branch 'upstream/develop' into dbstructure
[friendica.git] / src / Worker / Notifier.php
index a9fadf2519d5550d32d6ed0ee1848b81bd5d2fac..07bb99df206847457546ac7d22f4bf9de554e81b 100644 (file)
@@ -34,6 +34,7 @@ use Friendica\Model\Group;
 use Friendica\Model\Item;
 use Friendica\Model\Post;
 use Friendica\Model\PushSubscriber;
+use Friendica\Model\Tag;
 use Friendica\Model\User;
 use Friendica\Network\Probe;
 use Friendica\Protocol\ActivityPub;
@@ -367,16 +368,11 @@ class Notifier
                                }
 
                                // Send a salmon notification to every person we mentioned in the post
-                               $arr = explode(',',$target_item['tag']);
-                               foreach ($arr as $x) {
-                                       //Logger::log('Checking tag '.$x, Logger::DEBUG);
-                                       $matches = null;
-                                       if (preg_match('/@\[url=([^\]]*)\]/',$x,$matches)) {
-                                                       $probed_contact = Probe::uri($matches[1]);
-                                               if ($probed_contact["notify"] != "") {
-                                                       Logger::log('Notify mentioned user '.$probed_contact["url"].': '.$probed_contact["notify"]);
-                                                       $url_recipients[$probed_contact["notify"]] = $probed_contact["notify"];
-                                               }
+                               foreach (Tag::getByURIId($target_item['uri-id'], [Tag::MENTION, Tag::EXCLUSIVE_MENTION, Tag::IMPLICIT_MENTION]) as $tag) {
+                                       $probed_contact = Probe::uri($tag['url']);
+                                       if ($probed_contact["notify"] != "") {
+                                               Logger::log('Notify mentioned user '.$probed_contact["url"].': '.$probed_contact["notify"]);
+                                               $url_recipients[$probed_contact["notify"]] = $probed_contact["notify"];
                                        }
                                }
 
@@ -441,7 +437,7 @@ class Notifier
 
                                // Fetch the participation list
                                // The function will ensure that there are no duplicates
-                               $relay_list = Diaspora::participantsForThread($target_id, $relay_list);
+                               $relay_list = Diaspora::participantsForThread($target_item, $relay_list);
 
                                // Add the relay to the list, avoid duplicates.
                                // Don't send community posts to the relay. Forum posts via the Diaspora protocol are looking ugly.