From 18136788e4bfd86b6d6492daeccf270222d0b5fc Mon Sep 17 00:00:00 2001 From: Mario Date: Wed, 18 Nov 2020 20:33:32 +0000 Subject: be more specific --- 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 960aa3580..cda53ac82 100755 --- a/include/items.php +++ b/include/items.php @@ -2502,7 +2502,7 @@ function item_update_parent_commented($item) { ); q("UPDATE item set commented = '%s', changed = '%s' WHERE id = %d", - dbesc(($z) ? $z[0]['commented'] : datetime_convert()), + dbesc(($z[0]['commented']) ? $z[0]['commented'] : datetime_convert()), dbesc(datetime_convert()), intval($item['parent']) ); -- cgit v1.2.3 From 87d7a3053ac06e966ca54911fe50005fb0530e2f Mon Sep 17 00:00:00 2001 From: Mario Date: Wed, 25 Nov 2020 11:01:25 +0000 Subject: do not reset item_origin to 1 for deleted items to prevent possible looping and do not set item_uplink for sourced rss items - we can not sen anything to them. --- 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 cda53ac82..e10b2be0f 100755 --- a/include/items.php +++ b/include/items.php @@ -3299,7 +3299,7 @@ function start_delivery_chain($channel, $item, $item_id, $parent, $group = false $private = 1; $item_wall = 1; - $item_origin = 1; + $item_origin = (($item['item_deleted']) ? 0 : 1); // item_origin for deleted items is set to 0 in delete_imported_item() to prevent looping. In this case we probably should not set it back to 1 here. $item_uplink = 0; $item_nocomment = 0; @@ -3315,7 +3315,7 @@ function start_delivery_chain($channel, $item, $item_id, $parent, $group = false ); } else { - $item_uplink = 1; + $item_uplink = (($item['item_rss']) ? 0 : 1); // Do not set item_uplink for rss items - we can not send anything to them. // if this is an edit, item_store_update() will have already updated the item // with the correct value for source_xchan (by ignoring it). We cannot set to owner_xchan -- cgit v1.2.3 From 941db04260b32e41a4302b7c7accc2c13c809d4a Mon Sep 17 00:00:00 2001 From: Mario Date: Wed, 25 Nov 2020 13:52:27 +0000 Subject: add a uuid version 5 based uuid to imported feeds. if rewrite author for sourced items, also rewrite mid to be fetchable --- 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 e10b2be0f..a027be4b2 100755 --- a/include/items.php +++ b/include/items.php @@ -3179,8 +3179,18 @@ function start_delivery_chain($channel, $item, $item_id, $parent, $group = false if($rewrite_author) { $item['author_xchan'] = $channel['channel_hash']; - $r = q("update item set author_xchan = '%s' where id = %d", + //if it's a toplevel rss item we will also rewrite the mid to something fetchable + if($item['item_rss'] && $item['item_thread_top']) { + $item['mid'] = z_root() . '/item/' . $item['uuid']; + $item['parent_mid'] = $item['mid']; + $item['thr_parent'] = $item['mid']; + } + + $r = q("UPDATE item SET author_xchan = '%s', mid = '%s', parent_mid = '%s', thr_parent = '%s' WHERE id = %d", dbesc($item['author_xchan']), + dbesc($item['mid']), + dbesc($item['parent_mid']), + dbesc($item['thr_parent']), intval($item_id) ); } @@ -3235,7 +3245,6 @@ function start_delivery_chain($channel, $item, $item_id, $parent, $group = false $arr['item_origin'] = 1; $arr['item_wall'] = 1; - $arr['item_thread_top'] = 1; if (strpos($item['body'], "[/share]") !== false) { -- cgit v1.2.3 From 21ac4b513996df80a12e249b29eca0bee40e47cc Mon Sep 17 00:00:00 2001 From: Mario Date: Mon, 7 Dec 2020 09:49:38 +0000 Subject: remove announce activity from response activites array (cherry picked from commit 52c78c757ae73082ed29e48707b2313e65020db3) --- include/items.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'include/items.php') diff --git a/include/items.php b/include/items.php index a027be4b2..bcdc6c687 100755 --- a/include/items.php +++ b/include/items.php @@ -1551,7 +1551,7 @@ function get_mail_elements($x) { $arr['expires'] = datetime_convert('UTC','UTC',$x['expires']); $arr['mail_flags'] = 0; - + if(array_key_exists('sig',$x)) $arr['sig'] = $x['sig']; @@ -3022,7 +3022,7 @@ function tgroup_check($uid, $item) { } // post to group via DM - + if ($is_group) { if (intval($item['item_private']) === 2 && $item['mid'] === $item['parent_mid']) { return true; @@ -3199,7 +3199,7 @@ function start_delivery_chain($channel, $item, $item_id, $parent, $group = false if ($group && (! $parent)) { $arr = []; - + if ($edit) { // process edit or delete action $r = q("select * from item where source_xchan = '%s' and body like '%s' and uid = %d limit 1", @@ -3231,12 +3231,12 @@ function start_delivery_chain($channel, $item, $item_id, $parent, $group = false $arr['mid'] = z_root() . '/activity/' . $arr['uuid']; $arr['parent_mid'] = $arr['mid']; } - + $arr['aid'] = $channel['channel_account_id']; $arr['uid'] = $channel['channel_id']; // WARNING: the presence of both source_xchan and non-zero item_uplink here will cause a delivery loop - + $arr['item_uplink'] = 0; $arr['source_xchan'] = $item['owner_xchan']; @@ -3246,14 +3246,14 @@ function start_delivery_chain($channel, $item, $item_id, $parent, $group = false $arr['item_origin'] = 1; $arr['item_wall'] = 1; $arr['item_thread_top'] = 1; - + if (strpos($item['body'], "[/share]") !== false) { $pos = strpos($item['body'], "[share"); $bb = substr($item['body'], $pos); } else { $bb = "[share author='" . urlencode($item['author']['xchan_name']). "' profile='" . $item['author']['xchan_url'] . - "' portable_id='" . $item['author']['xchan_hash'] . + "' portable_id='" . $item['author']['xchan_hash'] . "' avatar='" . $item['author']['xchan_photo_s'] . "' link='" . $item['plink'] . "' auth='" . ((in_array($item['author']['xchan_network'], ['zot6','zot'])) ? 'true' : 'false') . -- cgit v1.2.3 From 600dcdfc583ab671fc61ff957ad7fd1a3a0c547d Mon Sep 17 00:00:00 2001 From: Max Kostikov Date: Sat, 12 Dec 2020 10:10:32 +0100 Subject: Remove duplicate delete terms query --- include/items.php | 5 ----- 1 file changed, 5 deletions(-) (limited to 'include/items.php') diff --git a/include/items.php b/include/items.php index bcdc6c687..956b259af 100755 --- a/include/items.php +++ b/include/items.php @@ -4072,11 +4072,6 @@ function delete_item_lowlevel($item, $stage = DROPITEM_NORMAL) { if($stage == DROPITEM_PHASE1) return true; - $r = q("delete from term where otype = %d and oid = %d", - intval(TERM_OBJ_POST), - intval($item['id']) - ); - q("delete from iconfig where iid = %d", intval($item['id']) ); -- cgit v1.2.3 From a27c593a2aeb8db7de64ce53f14e9061f3b0d3f5 Mon Sep 17 00:00:00 2001 From: Max Kostikov Date: Sat, 12 Dec 2020 19:43:57 +0100 Subject: Remove duplicate delete terms query --- include/items.php | 5 ----- 1 file changed, 5 deletions(-) (limited to 'include/items.php') diff --git a/include/items.php b/include/items.php index bcdc6c687..956b259af 100755 --- a/include/items.php +++ b/include/items.php @@ -4072,11 +4072,6 @@ function delete_item_lowlevel($item, $stage = DROPITEM_NORMAL) { if($stage == DROPITEM_PHASE1) return true; - $r = q("delete from term where otype = %d and oid = %d", - intval(TERM_OBJ_POST), - intval($item['id']) - ); - q("delete from iconfig where iid = %d", intval($item['id']) ); -- cgit v1.2.3 From 2a154f8c9a772d61e7dabb5e3fd110ba00cc6007 Mon Sep 17 00:00:00 2001 From: Mario Date: Mon, 14 Dec 2020 11:02:20 +0000 Subject: merge branch files_ng into dev --- include/items.php | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'include/items.php') diff --git a/include/items.php b/include/items.php index 956b259af..bcdc6c687 100755 --- a/include/items.php +++ b/include/items.php @@ -4072,6 +4072,11 @@ function delete_item_lowlevel($item, $stage = DROPITEM_NORMAL) { if($stage == DROPITEM_PHASE1) return true; + $r = q("delete from term where otype = %d and oid = %d", + intval(TERM_OBJ_POST), + intval($item['id']) + ); + q("delete from iconfig where iid = %d", intval($item['id']) ); -- cgit v1.2.3 From 8640e6d1df1004191a1cac9a2d894c73aa06f84a Mon Sep 17 00:00:00 2001 From: Mario Date: Fri, 18 Dec 2020 13:26:51 +0000 Subject: deprecate ! and !! forum tags --- include/items.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'include/items.php') diff --git a/include/items.php b/include/items.php index bcdc6c687..8537c3299 100755 --- a/include/items.php +++ b/include/items.php @@ -2813,7 +2813,7 @@ function tag_deliver($uid, $item_id) { // standard forum tagging sequence !forumname - +/* $forumpattern = '/\!\!?\[[uz]rl\=([^\]]*?)\]((?:.(?!\[[uz]rl\=))*?)\[\/[uz]rl\]/'; $forumpattern2 = '/\[[uz]rl\=([^\]]*?)\]\!((?:.(?!\[[uz]rl\=))*?)\[\/[uz]rl\]/'; @@ -2847,6 +2847,8 @@ function tag_deliver($uid, $item_id) { } } +*/ + if(! ($tagged || $plustagged)) { logger('Mention was in a reshare or exceeded max_tagged_forums - ignoring'); continue; @@ -3076,7 +3078,7 @@ function tgroup_check($uid, $item) { $body = preg_replace('/\[share(.*?)\[\/share\]/','',$item['body']); - +/* $forumpattern = '/\!\!?\[zrl\=([^\]]*?)\]((?:.(?!\[zrl\=))*?)\[\/zrl\]/'; $forumpattern2 = '/\[zrl\=([^\]]*?)\]\!((?:.(?!\[zrl\=))*?)\[\/zrl\]/'; @@ -3111,7 +3113,7 @@ function tgroup_check($uid, $item) { } } } - +*/ if(! $found) { logger('tgroup_check: mention was in a reshare or exceeded max_tagged_forums - ignoring'); continue; @@ -4805,7 +4807,7 @@ function set_linkified_perms($linkified, &$str_contact_allow, &$str_group_allow, elseif(strpos($access_tag,'gid:') === 0) { $str_group_allow .= '<' . substr($access_tag,4) . '>'; $access_tag = ''; - $private = 2; + $private = 1; } } } -- cgit v1.2.3 From efc8ed484504e2e01a8bc9dc8c720144995be210 Mon Sep 17 00:00:00 2001 From: Mario Date: Sat, 2 Jan 2021 11:20:03 +0000 Subject: make share title h3 --- 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 2426c189f..18f4e6f02 100755 --- a/include/items.php +++ b/include/items.php @@ -3263,7 +3263,7 @@ function start_delivery_chain($channel, $item, $item_id, $parent, $group = false "' message_id='" . $item['mid'] . "']"; if($item['title']) - $bb .= '[b]'.$item['title'].'[/b]'."\r\n"; + $bb .= '[h3][b]'.$item['title'].'[/b][/h3]'."\r\n"; $bb .= $item['body']; $bb .= "[/share]"; } -- cgit v1.2.3 From 291644f29d80670bdff8160b57c152c140bd8155 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Mon, 4 Jan 2021 20:36:24 +0100 Subject: fix issue where categories were not saved on forum wall post --- include/items.php | 2 ++ 1 file changed, 2 insertions(+) (limited to 'include/items.php') diff --git a/include/items.php b/include/items.php index 18f4e6f02..a90ddd208 100755 --- a/include/items.php +++ b/include/items.php @@ -3270,6 +3270,8 @@ function start_delivery_chain($channel, $item, $item_id, $parent, $group = false $arr['body'] = $bb; + $arr['term'] = $item['term']; + $arr['author_xchan'] = $channel['channel_hash']; $arr['owner_xchan'] = $channel['channel_hash']; -- cgit v1.2.3 From 7f51ff0a8d9a63773a176a13d5202693c35a5a67 Mon Sep 17 00:00:00 2001 From: Mario Date: Fri, 8 Jan 2021 21:27:06 +0000 Subject: set resource_type = group_item and resource_id = original mid for forum items so we do not need to query the body for the original mid on edit. --- include/items.php | 28 ++++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-) (limited to 'include/items.php') diff --git a/include/items.php b/include/items.php index a90ddd208..85465192d 100755 --- a/include/items.php +++ b/include/items.php @@ -2206,6 +2206,7 @@ function item_store_update($arr, $allow_exec = false, $deliver = true) { return $ret; } + // override the unseen flag with the original $arr['item_unseen'] = $orig[0]['item_unseen']; @@ -2682,6 +2683,12 @@ function tag_deliver($uid, $item_id) { if ($is_group && intval($item['item_thread_top']) && intval($item['item_wall']) && $item['author_xchan'] !== $item['owner_xchan']) { + + if($item['resource_type'] === 'group_item') { + logger('resource_type group_item: already shared'); + return; + } + if (strpos($item['body'],'[/share]')) { logger('W2W post already shared'); return; @@ -3113,11 +3120,12 @@ function tgroup_check($uid, $item) { } } } -*/ + if(! $found) { logger('tgroup_check: mention was in a reshare or exceeded max_tagged_forums - ignoring'); continue; } +*/ return true; } @@ -3203,16 +3211,18 @@ function start_delivery_chain($channel, $item, $item_id, $parent, $group = false $arr = []; if ($edit) { + // process edit or delete action - $r = q("select * from item where source_xchan = '%s' and body like '%s' and uid = %d limit 1", - dbesc($item['owner_xchan']), - dbesc("%message_id='" . $item['mid'] . "'%"), - intval($channel['channel_id']) + $r = q("select * from item where uid = %d and resource_id = '%s' and source_xchan = '%s' and resource_type = 'group_item' limit 1", + intval($channel['channel_id']), + dbesc($item['mid']), + dbesc($item['author_xchan']) ); + if ($r) { if (intval($item['item_deleted'])) { - drop_item($r[0]['id'],false,DROPITEM_PHASE1); - Master::Summon([ 'Notifier','drop',$r[0]['id'] ]); + drop_item($r[0]['id'], false, DROPITEM_PHASE1); + Master::Summon([ 'Notifier', 'drop', $r[0]['id'] ]); return; } $arr['id'] = intval($r[0]['id']); @@ -3242,6 +3252,9 @@ function start_delivery_chain($channel, $item, $item_id, $parent, $group = false $arr['item_uplink'] = 0; $arr['source_xchan'] = $item['owner_xchan']; + $arr['resource_id'] = $item['mid']; + $arr['resource_type'] = 'group_item'; + $arr['item_private'] = (($channel['channel_allow_cid'] || $channel['channel_allow_gid'] || $channel['channel_deny_cid'] || $channel['channel_deny_gid']) ? 1 : 0); @@ -3269,7 +3282,6 @@ function start_delivery_chain($channel, $item, $item_id, $parent, $group = false } $arr['body'] = $bb; - $arr['term'] = $item['term']; $arr['author_xchan'] = $channel['channel_hash']; -- cgit v1.2.3 From b9fd87b004fe083c3f8064de5defea4ff439bce0 Mon Sep 17 00:00:00 2001 From: Mario Date: Wed, 13 Jan 2021 08:54:58 +0000 Subject: do not turn the groups own direkt messages into group items - fixes #1510 --- include/items.php | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'include/items.php') diff --git a/include/items.php b/include/items.php index 85465192d..317a84730 100755 --- a/include/items.php +++ b/include/items.php @@ -2673,6 +2673,11 @@ function tag_deliver($uid, $item_id) { } if ($is_group && intval($item['item_private']) === 2 && intval($item['item_thread_top'])) { + + // do not turn the groups own direkt messages into group items + if($item['item_wall'] && $item['author_xchan'] === $u[0]['channel_hash']) + return; + // group delivery via DM if(perm_is_allowed($uid,$item['owner_xchan'],'post_wall') || perm_is_allowed($uid,$item['owner_xchan'],'tag_deliver')) { logger('group DM delivery for ' . $u[0]['channel_address']); -- cgit v1.2.3 From cb3131a1667b6abdee52ce8605e476773f27c688 Mon Sep 17 00:00:00 2001 From: Mario Date: Fri, 15 Jan 2021 15:06:07 +0000 Subject: also check for zot6 (cherry picked from commit 3bcb3221568d80d3ae8dec47d2416b7c1b091304) --- 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 317a84730..2661f76a7 100755 --- a/include/items.php +++ b/include/items.php @@ -130,7 +130,7 @@ function collect_recipients($item, &$private_envelope,$include_groups = true) { case 'sit': case 'any': case 'con': - if($rr['xchan_network'] != 'zot') + if(in_array($rr['xchan_network'], ['zot6', 'zot'])) break; case 'pub': case '': -- cgit v1.2.3 From d3f81188741759703271c47d3df1e75f0a06b59a Mon Sep 17 00:00:00 2001 From: Mario Date: Sat, 16 Jan 2021 09:17:45 +0000 Subject: wrong logic (cherry picked from commit 0d544e2294149efe5f442fa1191c02f241b85b6a) --- 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 2661f76a7..322e44471 100755 --- a/include/items.php +++ b/include/items.php @@ -130,7 +130,7 @@ function collect_recipients($item, &$private_envelope,$include_groups = true) { case 'sit': case 'any': case 'con': - if(in_array($rr['xchan_network'], ['zot6', 'zot'])) + if(!in_array($rr['xchan_network'], ['zot6', 'zot'])) break; case 'pub': case '': -- cgit v1.2.3