Storing the parent with every notification

This commit is contained in:
Michael Vogel 2015-04-14 06:54:41 +02:00
parent 178b7eba1b
commit 2285b3b7a7
3 changed files with 13 additions and 7 deletions

View file

@ -63,6 +63,11 @@ function notification($params) {
// e.g. "your post", "David's photo", etc. // e.g. "your post", "David's photo", etc.
$possess_desc = t('%s <!item_type!>'); $possess_desc = t('%s <!item_type!>');
if (isset($params['parent']))
$parent_id = $params['parent'];
else
$parent_id = 0;
if($params['type'] == NOTIFY_MAIL) { if($params['type'] == NOTIFY_MAIL) {
$subject = sprintf( t('[Friendica:Notify] New mail received at %s'),$sitename); $subject = sprintf( t('[Friendica:Notify] New mail received at %s'),$sitename);
@ -78,7 +83,7 @@ function notification($params) {
if($params['type'] == NOTIFY_COMMENT) { if($params['type'] == NOTIFY_COMMENT) {
// logger("notification: params = " . print_r($params, true), LOGGER_DEBUG); // 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", $p = q("SELECT `ignored` FROM `thread` WHERE `iid` = %d AND `uid` = %d LIMIT 1",
intval($parent_id), intval($parent_id),

View file

@ -1567,7 +1567,8 @@ function item_store($arr,$force_parent = false, $notify = false, $dontcache = fa
'source_link' => $item[0]['author-link'], 'source_link' => $item[0]['author-link'],
'source_photo' => $item[0]['author-avatar'], 'source_photo' => $item[0]['author-avatar'],
'verb' => ACTIVITY_TAG, '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); 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'], 'verb' => $datarray['verb'],
'otype' => 'person', 'otype' => 'person',
'activity' => $verb, 'activity' => $verb,
'parent' => $datarray['parent']
)); ));
} }
} }

View file

@ -22,23 +22,23 @@ function ping_init(&$a) {
$firehose = intval(get_pconfig(local_user(),'system','notify_full')); $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()) intval(local_user())
); );
if($t && intval($t[0]['total']) > 49) { 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", and seen = 0 order by date desc limit 0, 50",
intval(local_user()) intval(local_user())
); );
$sysnotify = $t[0]['total']; $sysnotify = $t[0]['total'];
} }
else { 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", and seen = 0 order by date desc limit 0, 50",
intval(local_user()) 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", and seen = 1 order by date desc limit 0, %d",
intval(local_user()), intval(local_user()),
intval(50 - intval($t[0]['total'])) intval(50 - intval($t[0]['total']))