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