From 4bf758cc5b4b204fce0560af2fce719f37f2a9a3 Mon Sep 17 00:00:00 2001 From: friendica Date: Sun, 12 Oct 2014 01:40:48 -0700 Subject: content deletion issue --- include/items.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'include/items.php') diff --git a/include/items.php b/include/items.php index c4ae948b8..40343d505 100755 --- a/include/items.php +++ b/include/items.php @@ -3977,7 +3977,12 @@ function drop_item($id,$interactive = true,$stage = DROPITEM_NORMAL) { // send the notification upstream/downstream as the case may be // only send notifications to others if this is the owner's wall item. - if(($item['item_flags'] & ITEM_WALL) && ($stage != DROPITEM_PHASE2)) + // This isn't optimal. We somehow need to pass to this function whether or not + // to call the notifier, or we need to call the notifier from the calling function. + // We'll rely on the undocumented behaviour that DROPITEM_PHASE1 is (hopefully) only + // set if we know we're going to send delete notifications out to others. + + if((($item['item_flags'] & ITEM_WALL) && ($stage != DROPITEM_PHASE2)) || ($stage == DROPITEM_PHASE1)) proc_run('php','include/notifier.php','drop',$notify_id); goaway($a->get_baseurl() . '/' . $_SESSION['return_url']); -- cgit v1.2.3 From ed7712cfbf9835368de79f8686954b536c12e4d1 Mon Sep 17 00:00:00 2001 From: friendica Date: Tue, 21 Oct 2014 16:33:35 -0700 Subject: private forum issues --- include/items.php | 1 + 1 file changed, 1 insertion(+) (limited to 'include/items.php') diff --git a/include/items.php b/include/items.php index 40343d505..75eaecb20 100755 --- a/include/items.php +++ b/include/items.php @@ -98,6 +98,7 @@ function collect_recipients($item,&$private_envelope) { } } + // This is a somewhat expensive operation but important. // Don't send this item to anybody who isn't allowed to see it -- cgit v1.2.3 From d7cb5c0436081214afefbd876a127173ebfa1b74 Mon Sep 17 00:00:00 2001 From: friendica Date: Wed, 22 Oct 2014 16:41:06 -0700 Subject: you've gotta' be on your toes to catch this bug... though it's been here for about 2 1/2 years and even survived a rewrite. Symptoms are that the archive widget only lists one month (the month when you first posted), and only if your first post was written between the 28th and 31st of whatever month that was. --- include/items.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'include/items.php') diff --git a/include/items.php b/include/items.php index 75eaecb20..a0c81f5ae 100755 --- a/include/items.php +++ b/include/items.php @@ -4131,7 +4131,7 @@ function list_post_dates($uid,$wall) { if(intval(substr($dnow,8)) > 28) $dnow = substr($dnow,0,8) . '28'; if(intval(substr($dthen,8)) > 28) - $dnow = substr($dthen,0,8) . '28'; + $dthen = substr($dthen,0,8) . '28'; $ret = array(); // Starting with the current month, get the first and last days of every @@ -4165,7 +4165,7 @@ function posted_dates($uid,$wall) { if(intval(substr($dnow,8)) > 28) $dnow = substr($dnow,0,8) . '28'; if(intval(substr($dthen,8)) > 28) - $dnow = substr($dthen,0,8) . '28'; + $dthen = substr($dthen,0,8) . '28'; $ret = array(); // Starting with the current month, get the first and last days of every -- cgit v1.2.3 From 58c692e3897a7807fed23e2633496c4960f022ca Mon Sep 17 00:00:00 2001 From: friendica Date: Wed, 22 Oct 2014 20:39:49 -0700 Subject: improved wall-to-wall detection for comments so we can handle Diaspora signing and wall-to-wall attribution correctly. Do it at the point of submission. This also fixes a potential bug in yesterday's wall-to-wall permission setting, if it was a local comment to a remote post. --- include/items.php | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'include/items.php') diff --git a/include/items.php b/include/items.php index a0c81f5ae..e3526b0a5 100755 --- a/include/items.php +++ b/include/items.php @@ -2517,7 +2517,7 @@ function item_store_update($arr,$allow_exec = false) { return $ret; } -function store_diaspora_comment_sig($datarray, $channel, $parent_item, $post_id) { +function store_diaspora_comment_sig($datarray, $channel, $parent_item, $post_id, $walltowall = false) { // We won't be able to sign Diaspora comments for authenticated visitors // - we don't have their private key @@ -2527,7 +2527,16 @@ function store_diaspora_comment_sig($datarray, $channel, $parent_item, $post_id) require_once('include/bb2diaspora.php'); $signed_body = bb2diaspora_itembody($datarray); - logger('mod_item: storing diaspora comment signature',LOGGER_DEBUG); + if($walltowall) { + logger('wall to wall comment',LOGGER_DEBUG); + // post will come across with the owner's identity. Throw a preamble onto the post to indicate the true author. + $signed_body = "\n\n" + . '[img]' . $datarray['author']['xchan_photo_m'] . '[/img]' + . '[url=' . $datarray['author']['xchan_url'] . ']' . $datarray['author']['xchan_name'] . '[/url]' . "\n\n" + . $signed_body; + } + + logger('storing diaspora comment signature',LOGGER_DEBUG); $diaspora_handle = $channel['channel_address'] . '@' . get_app()->get_hostname(); -- cgit v1.2.3 From f29c5a35f14f2a49b7c4a56fed577ebcf1010709 Mon Sep 17 00:00:00 2001 From: Thomas Willingham Date: Thu, 23 Oct 2014 21:50:53 +0100 Subject: Provide comment box for PERMS_AUTHED items. Presently only commentable from owners wall. --- include/items.php | 1 + 1 file changed, 1 insertion(+) (limited to 'include/items.php') diff --git a/include/items.php b/include/items.php index e3526b0a5..2805b9b21 100755 --- a/include/items.php +++ b/include/items.php @@ -214,6 +214,7 @@ function can_comment_on_post($observer_xchan,$item) { break; case 'any connections': case 'contacts': + case 'authenticated': case '': if(array_key_exists('owner',$item)) { if(($item['owner']['abook_xchan']) && ($item['owner']['abook_their_perms'] & PERMS_W_COMMENT)) -- cgit v1.2.3 From 1c4bbbd13e35e164c7da96674b3678bb1011b817 Mon Sep 17 00:00:00 2001 From: friendica Date: Thu, 23 Oct 2014 16:08:29 -0700 Subject: diaspora walltowall comment signature, force update. --- include/items.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include/items.php') diff --git a/include/items.php b/include/items.php index 2805b9b21..8d46f64c1 100755 --- a/include/items.php +++ b/include/items.php @@ -2526,7 +2526,7 @@ function store_diaspora_comment_sig($datarray, $channel, $parent_item, $post_id, // since Diaspora doesn't handle edits we can only do this for the original text and not update it. require_once('include/bb2diaspora.php'); - $signed_body = bb2diaspora_itembody($datarray); + $signed_body = bb2diaspora_itembody($datarray,$walltowall); if($walltowall) { logger('wall to wall comment',LOGGER_DEBUG); -- cgit v1.2.3 From ce8a891682a7d8ceca71ec762063367744428a53 Mon Sep 17 00:00:00 2001 From: friendica Date: Fri, 24 Oct 2014 14:18:02 -0700 Subject: doh - this needs to be markdown, not bbcode --- include/items.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'include/items.php') diff --git a/include/items.php b/include/items.php index 8d46f64c1..41c211953 100755 --- a/include/items.php +++ b/include/items.php @@ -2532,8 +2532,8 @@ function store_diaspora_comment_sig($datarray, $channel, $parent_item, $post_id, logger('wall to wall comment',LOGGER_DEBUG); // post will come across with the owner's identity. Throw a preamble onto the post to indicate the true author. $signed_body = "\n\n" - . '[img]' . $datarray['author']['xchan_photo_m'] . '[/img]' - . '[url=' . $datarray['author']['xchan_url'] . ']' . $datarray['author']['xchan_name'] . '[/url]' . "\n\n" + . '![' . $datarray['author']['xchan_name'] . '](' . $datarray['author']['xchan_photo_m'] . ')' + . '[' . $datarray['author']['xchan_name'] . '](' . $datarray['author']['xchan_url'] . ')' . "\n\n" . $signed_body; } -- cgit v1.2.3 From 28a35261dbc8c21e27ca4a449ff5cd6cb0501c8a Mon Sep 17 00:00:00 2001 From: friendica Date: Thu, 30 Oct 2014 19:15:03 -0700 Subject: What this checkin does is catch the case where a comment arrived and there's a missing top-level post to match it with. So we'll send a request back to the sender that you've never seen this thread and please send a fresh copy of the entire conversation to date. We could soon have posts in the matrix from different platforms from days gone by, which have been migrated into the modern world. We'll be polite and not deliver these to everybody. However, if someone comments on one of these antique threads we wouldn't be able to see it in our own matrix because we won't have a copy of the parent post. So this rectifies that situation. Be aware that item deletion may need to change to keep "hard deleted" items indefinitely so that they don't keep coming back. We'll have to null out the important data of the former item to accomplish the deletion aspect. --- include/items.php | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) (limited to 'include/items.php') diff --git a/include/items.php b/include/items.php index 41c211953..d173e1a98 100755 --- a/include/items.php +++ b/include/items.php @@ -4249,14 +4249,24 @@ function fetch_post_tags($items,$link = false) { -function zot_feed($uid,$observer_xchan,$mindate) { +function zot_feed($uid,$observer_xchan,$arr) { $result = array(); - $mindate = datetime_convert('UTC','UTC',$mindate); + $mindate = null; + $message_id = null; + + if(array_key_exists('mindate',$arr)) { + $mindate = datetime_convert('UTC','UTC',$arr['mindate']); + } + + if(array_key_exists('message_id',$arr)) { + $message_id = $arr['message_id']; + } + + if(! $mindate) $mindate = NULL_DATE; - $mindate = dbesc($mindate); logger('zot_feed: ' . $uid); @@ -4278,6 +4288,11 @@ function zot_feed($uid,$observer_xchan,$mindate) { else $limit = " limit 0, 50 "; + if($message_id) { + $sql_extra .= " and mid = '" . dbesc($message_id) . "' "; + $limit = ''; + } + $items = array(); if(is_sys_channel($uid)) { -- cgit v1.2.3