prevent expiration of conversations you are involved with - allows you to find your own comments months from now

This commit is contained in:
zotlabs 2017-07-10 20:18:33 -07:00
parent e3734328eb
commit 2d63bbb91e
6 changed files with 36 additions and 4 deletions

View File

@ -861,8 +861,8 @@ class Item extends \Zotlabs\Web\Controller {
}
if(mb_strlen($datarray['title']) > 255)
$datarray['title'] = mb_substr($datarray['title'],0,255);
if(mb_strlen($datarray['title']) > 191)
$datarray['title'] = mb_substr($datarray['title'],0,191);
if($webpage) {
Zlib\IConfig::Set($datarray,'system', webpage_to_namespace($webpage),
@ -928,6 +928,11 @@ class Item extends \Zotlabs\Web\Controller {
if($parent) {
// prevent conversations which you are involved from being expired
if(local_channel())
retain_item($parent);
// only send comment notification if this is a wall-to-wall comment,
// otherwise it will happen during delivery

View File

@ -504,6 +504,11 @@ class Like extends \Zotlabs\Web\Controller {
$post = item_store($arr);
$post_id = $post['item_id'];
// save the conversation from expiration
if(local_channel() && array_key_exists('item',$post) && (intval($post['item']['id']) != intval($post['item']['parent'])))
retain_item($post['item']['parent']);
$arr['id'] = $post_id;

View File

@ -39,6 +39,10 @@ class React extends \Zotlabs\Web\Controller {
$n['author_xchan'] = $channel['channel_hash'];
$x = item_store($n);
if(local_channel())
retain_item($postid);
if($x['success']) {
$nid = $x['item_id'];
\Zotlabs\Daemon\Master::Summon(array('Notifier','like',$nid));

View File

@ -627,6 +627,14 @@ function import_items($channel, $items, $sync = false, $relocate = null) {
$item_result = item_store($item,$allow_code,$deliver);
}
// preserve conversations you've been involved in from being expired
$stored = $item_result['item'];
if((is_array($stored)) && ($stored['id'] != $stored['parent'])
&& ($stored['author_xchan'] === $channel['channel_hash'])) {
retain_item($stored['item']['parent']);
}
fix_attached_photo_permissions($channel['channel_id'],$item['author_xchan'],$item['body'],$item['allow_cid'],$item['allow_gid'],$item['deny_cid'],$item['deny_gid']);
fix_attached_file_permissions($channel,$item['author_xchan'],$item['body'],$item['allow_cid'],$item['allow_gid'],$item['deny_cid'],$item['deny_gid']);

View File

@ -1737,7 +1737,7 @@ logger('revision: ' . $arr['revision']);
if($r[0]['owner_xchan'] !== $arr['owner_xchan']) {
$arr['owner_xchan'] = $r[0]['owner_xchan'];
// $uplinked_comment = true;
// $uplinked_comment = true;
}
// if the parent is private, force privacy for the entire conversation

View File

@ -1761,7 +1761,7 @@ function process_delivery($sender, $arr, $deliveries, $relay, $public = false, $
$result[] = $DR->get();
}
else {
update_imported_item($sender,$arr,$r[0],$channel['channel_id'],$tag_delivery);
$item_result = update_imported_item($sender,$arr,$r[0],$channel['channel_id'],$tag_delivery);
$DR->update('updated');
$result[] = $DR->get();
if(! $relay)
@ -1810,6 +1810,14 @@ function process_delivery($sender, $arr, $deliveries, $relay, $public = false, $
}
}
// preserve conversations with which you are involved from expiration
$stored = (($item_result && $item_result['item']) ? $item_result['item'] : false);
if((is_array($stored)) && ($stored['id'] != $stored['parent'])
&& ($stored['author_xchan'] === $channel['channel_hash'])) {
retain_item($stored['item']['parent']);
}
if($relay && $item_id) {
logger('process_delivery: invoking relay');
Zotlabs\Daemon\Master::Summon(array('Notifier','relay',intval($item_id)));
@ -1946,6 +1954,8 @@ function update_imported_item($sender, $item, $orig, $uid, $tag_delivery) {
logger('update_imported_item: failed: ' . $x['message']);
else
logger('update_imported_item');
return $x;
}
/**