From 3065650683c221c0a23c1dbcab2e1ec2d73997d4 Mon Sep 17 00:00:00 2001 From: friendica Date: Sun, 28 Dec 2014 23:21:49 -0800 Subject: filter posts you author from unseen notifications - note there are other ways to do this, but involve some code complexity. This is easier to implement but may have a slight impact on the ping query performance. It's not horrid, just mentioning for the record. --- mod/ping.php | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'mod/ping.php') diff --git a/mod/ping.php b/mod/ping.php index ef8afd91c..cdb6aa0b2 100644 --- a/mod/ping.php +++ b/mod/ping.php @@ -46,6 +46,7 @@ function ping_init(&$a) { if(local_user()) { $vnotify = get_pconfig(local_user(),'system','vnotify'); $evdays = intval(get_pconfig(local_user(),'system','evdays')); + $ob_hash = get_observer_hash(); } // if unset show all visual notification types @@ -275,10 +276,12 @@ function ping_init(&$a) { $result = array(); $r = q("SELECT * FROM item - WHERE item_restrict = %d and ( item_flags & %d ) > 0 and uid = %d", + WHERE item_restrict = %d and ( item_flags & %d ) > 0 and uid = %d + and author_xchan != '%s' ", intval(ITEM_VISIBLE), intval(ITEM_UNSEEN), - intval(local_user()) + intval(local_user()), + dbesc($ob_hash) ); if($r) { @@ -381,10 +384,12 @@ function ping_init(&$a) { if($vnotify & (VNOTIFY_NETWORK|VNOTIFY_CHANNEL)) { $r = q("SELECT id, item_restrict, item_flags FROM item - WHERE (item_restrict = %d) and ( item_flags & %d ) > 0 and uid = %d", + WHERE (item_restrict = %d) and ( item_flags & %d ) > 0 and uid = %d + and author_xchan != '%s'", intval(ITEM_VISIBLE), intval(ITEM_UNSEEN), - intval(local_user()) + intval(local_user()), + dbesc($ob_hash) ); if($r) { -- cgit v1.2.3 From 2710510392f64cfbc0be929d4ff9d607025d80bf Mon Sep 17 00:00:00 2001 From: Stefan Parviainen Date: Tue, 30 Dec 2014 15:21:29 +0100 Subject: Sort notifications --- mod/ping.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'mod/ping.php') diff --git a/mod/ping.php b/mod/ping.php index cdb6aa0b2..593ae21f8 100644 --- a/mod/ping.php +++ b/mod/ping.php @@ -277,7 +277,7 @@ function ping_init(&$a) { $r = q("SELECT * FROM item WHERE item_restrict = %d and ( item_flags & %d ) > 0 and uid = %d - and author_xchan != '%s' ", + and author_xchan != '%s' ORDER BY created DESC", intval(ITEM_VISIBLE), intval(ITEM_UNSEEN), intval(local_user()), @@ -300,7 +300,7 @@ function ping_init(&$a) { if(argc() > 1 && (argv(1) === 'intros')) { $result = array(); - $r = q("SELECT * FROM abook left join xchan on abook.abook_xchan = xchan.xchan_hash where abook_channel = %d and (abook_flags & %d) > 0 and not ((abook_flags & %d) > 0 or (xchan_flags & %d) > 0)", + $r = q("SELECT * FROM abook left join xchan on abook.abook_xchan = xchan.xchan_hash where abook_channel = %d and (abook_flags & %d) > 0 and not ((abook_flags & %d) > 0 or (xchan_flags & %d) > 0) ORDER BY abook_created DESC", intval(local_user()), intval(ABOOK_FLAG_PENDING), intval(ABOOK_FLAG_SELF|ABOOK_FLAG_IGNORED), -- cgit v1.2.3