]> git.mxchange.org Git - friendica.git/commitdiff
Storing the parent with every notification
authorMichael Vogel <icarus@dabo.de>
Tue, 14 Apr 2015 04:54:41 +0000 (06:54 +0200)
committerMichael Vogel <icarus@dabo.de>
Tue, 14 Apr 2015 04:54:41 +0000 (06:54 +0200)
include/enotify.php
include/items.php
mod/ping.php

index 4327e75b837d5c25fb36fbad03c7f123e861b5eb..4316188506f1cebb18c1fefa435c96c04aa90db9 100644 (file)
@@ -63,6 +63,11 @@ function notification($params) {
        // e.g. "your post", "David's photo", etc.
        $possess_desc = t('%s <!item_type!>');
 
+       if (isset($params['parent']))
+               $parent_id = $params['parent'];
+       else
+               $parent_id = 0;
+
        if($params['type'] == NOTIFY_MAIL) {
 
                $subject =      sprintf( t('[Friendica:Notify] New mail received at %s'),$sitename);
@@ -78,7 +83,7 @@ function notification($params) {
        if($params['type'] == NOTIFY_COMMENT) {
 //             logger("notification: params = " . print_r($params, true), LOGGER_DEBUG);
 
-               $parent_id = $params['parent'];
+               //$parent_id = $params['parent'];
 
                $p = q("SELECT `ignored` FROM `thread` WHERE `iid` = %d AND `uid` = %d LIMIT 1",
                        intval($parent_id),
index 8a0deb437b041582bc2846592089e24dbfd40c06..1fecc442158ec13736e8861a84b6d6c609ad50fd 100644 (file)
@@ -1567,7 +1567,8 @@ function item_store($arr,$force_parent = false, $notify = false, $dontcache = fa
                                'source_link'  => $item[0]['author-link'],
                                'source_photo' => $item[0]['author-avatar'],
                                'verb'         => ACTIVITY_TAG,
-                               'otype'        => 'item'
+                               'otype'        => 'item',
+                               'parent'       => $arr['parent']
                        ));
                        logger('item_store: Notification sent for contact '.$arr['contact-id'].' and post '.$current_post, LOGGER_DEBUG);
                }
@@ -4021,7 +4022,7 @@ function local_delivery($importer,$data) {
                                                        'verb'         => $datarray['verb'],
                                                        'otype'        => 'person',
                                                        'activity'     => $verb,
-
+                                                       'parent'       => $datarray['parent']
                                                ));
                                        }
                                }
index 405edd3c49dedba39dee250112459c8db8c9326b..620766339189b1a80df3c2e335d45932a7963522 100644 (file)
@@ -22,23 +22,23 @@ function ping_init(&$a) {
 
                $firehose = intval(get_pconfig(local_user(),'system','notify_full'));
 
-               $t = q("select count(*) as total from notify where uid = %d and seen = 0",
+               $t = q("select count(*) as `total` from `notify` where `uid` = %d and `seen` = 0 AND `msg` != ''",
                        intval(local_user())
                );
                if($t && intval($t[0]['total']) > 49) {
-                       $z = q("select * from notify where uid = %d
+                       $z = q("select * from notify where uid = %d AND `msg` != ''
                                and seen = 0 order by date desc limit 0, 50",
                                intval(local_user())
                        );
                        $sysnotify = $t[0]['total'];
                }
                else {
-                       $z1 = q("select * from notify where uid = %d
+                       $z1 = q("select * from notify where uid = %d AND `msg` != ''
                                and seen = 0 order by date desc limit 0, 50",
                                intval(local_user())
                        );
 
-                       $z2 = q("select * from notify where uid = %d
+                       $z2 = q("select * from notify where uid = %d AND `msg` != ''
                                and seen = 1 order by date desc limit 0, %d",
                                intval(local_user()),
                                intval(50 - intval($t[0]['total']))