]> git.mxchange.org Git - friendica.git/commitdiff
The "share a post" notification is now sent based upon mentions as well.
authorMichael Vogel <icarus@dabo.de>
Wed, 11 Feb 2015 06:19:48 +0000 (07:19 +0100)
committerMichael Vogel <icarus@dabo.de>
Wed, 11 Feb 2015 06:19:48 +0000 (07:19 +0100)
include/items.php

index 93bc4cc97995c84840d3a2f53f89f0160c6384ea..fb357d4db7b41c12e3d9d4c57888db28b780ea21 100644 (file)
@@ -1503,8 +1503,23 @@ function item_store($arr,$force_parent = false, $notify = false, $dontcache = fa
                        intval($arr['contact-id']),
                        intval($arr['uid'])
                );
+               $send_notification = count($r);
+
+               if (!$send_notification) {
+                       $tags = q("SELECT `url` FROM `term` WHERE `otype` = %d AND `oid` = %d AND `type` = %d AND `uid` = %d",
+                               intval(TERM_OBJ_POST), intval($current_post), intval(TERM_MENTION), intval($arr['uid']));
+
+                       if (count($tags)) {
+                               foreach ($tags AS $tag) {
+                                       $r = q("SELECT `id` FROM `contact` WHERE `nurl` = '%s' AND `uid` = %d AND `notify_new_posts`",
+                                               normalise_link($tag["url"]), intval($arr['uid']));
+                                       if (count($r))
+                                               $send_notification = true;
+                               }
+                       }
+               }
 
-               if(count($r)) {
+               if ($send_notification) {
                        logger('item_store: Send notification for contact '.$arr['contact-id'].' and post '.$current_post, LOGGER_DEBUG);
                        $u = q("SELECT * FROM user WHERE uid = %d LIMIT 1",
                                intval($arr['uid']));