]> git.mxchange.org Git - friendica.git/blobdiff - include/notifier.php
dont use the entire url as option
[friendica.git] / include / notifier.php
index e5ead46e36296e0c74a6cb9c55348c0cb324b8d7..e66fa9b0b0b2cf337b1b8e94bdb2de9028868c41 100644 (file)
@@ -215,6 +215,9 @@ function notifier_run(&$argv, &$argc){
        // Do a PuSH
        $push_notify = false;
 
+       // Deliver directly to a forum, don't PuSH
+       $direct_forum_delivery = false;
+
        // fill this in with a single salmon slap if applicable
        $slap = '';
 
@@ -285,6 +288,26 @@ function notifier_run(&$argv, &$argc){
                if ($parent['origin']) {
                        $relay_to_owner = false;
                }
+
+               // Special treatment for forum posts
+               if (($target_item['author-link'] != $target_item['owner-link']) &&
+                       ($owner['id'] != $target_item['contact-id']) &&
+                       ($target_item['uri'] === $target_item['parent-uri'])) {
+
+                       $fields = array('forum', 'prv');
+                       $condition = array('id' => $target_item['contact-id']);
+                       $contact = dba::select('contact', $fields, $condition, array('limit' => 1));
+                       if (!dbm::is_result($contact)) {
+                               // Should never happen
+                               return false;
+                       }
+
+                       // Is the post from a forum?
+                       if ($contact['forum'] || $contact['prv']) {
+                               $relay_to_owner = true;
+                               $direct_forum_delivery = true;
+                       }
+               }
                if ($relay_to_owner) {
                        logger('notifier: followup '.$target_item["guid"], LOGGER_DEBUG);
                        // local followup to remote post
@@ -318,6 +341,11 @@ function notifier_run(&$argv, &$argc){
                                        }
                                }
                        }
+
+                       if ($direct_forum_delivery) {
+                               $push_notify = false;
+                       }
+
                        logger("Notify ".$target_item["guid"]." via PuSH: ".($push_notify?"Yes":"No"), LOGGER_DEBUG);
                } else {
                        $followup = false;