diff options
author | Mario <mario@mariovavti.com> | 2024-02-25 19:29:50 +0000 |
---|---|---|
committer | Mario <mario@mariovavti.com> | 2024-02-25 19:29:50 +0000 |
commit | 3dd739424718596b94f5a61d2015388db2491999 (patch) | |
tree | 336e19816349b7b0c3d5c4ba49bf4bf19ae4e46a /Zotlabs/Module | |
parent | b860b730a9fe718ad35cd918ab237afe42cf386c (diff) | |
download | volse-hubzilla-3dd739424718596b94f5a61d2015388db2491999.tar.gz volse-hubzilla-3dd739424718596b94f5a61d2015388db2491999.tar.bz2 volse-hubzilla-3dd739424718596b94f5a61d2015388db2491999.zip |
AS2
Diffstat (limited to 'Zotlabs/Module')
-rw-r--r-- | Zotlabs/Module/Item.php | 24 | ||||
-rw-r--r-- | Zotlabs/Module/Like.php | 50 | ||||
-rw-r--r-- | Zotlabs/Module/Network.php | 2 | ||||
-rw-r--r-- | Zotlabs/Module/Photos.php | 3 | ||||
-rw-r--r-- | Zotlabs/Module/Poke.php | 6 | ||||
-rw-r--r-- | Zotlabs/Module/Sharedwithme.php | 4 | ||||
-rw-r--r-- | Zotlabs/Module/Sse_bs.php | 40 | ||||
-rw-r--r-- | Zotlabs/Module/Subthread.php | 2 | ||||
-rw-r--r-- | Zotlabs/Module/Tagger.php | 6 | ||||
-rw-r--r-- | Zotlabs/Module/Vote.php | 2 |
10 files changed, 64 insertions, 75 deletions
diff --git a/Zotlabs/Module/Item.php b/Zotlabs/Module/Item.php index 574dffc69..7d71edc99 100644 --- a/Zotlabs/Module/Item.php +++ b/Zotlabs/Module/Item.php @@ -298,7 +298,6 @@ class Item extends Controller { function post() { - // This will change. Figure out who the observer is and whether or not // they have permission to post here. Else ignore the post. @@ -405,7 +404,7 @@ class Item extends Controller { $pagetitle = ((x($_REQUEST, 'pagetitle')) ? escape_tags($_REQUEST['pagetitle']) : ''); $layout_mid = ((x($_REQUEST, 'layout_mid')) ? escape_tags($_REQUEST['layout_mid']) : ''); $plink = ((x($_REQUEST, 'permalink')) ? escape_tags($_REQUEST['permalink']) : ''); - $obj_type = ((x($_REQUEST, 'obj_type')) ? escape_tags($_REQUEST['obj_type']) : ACTIVITY_OBJ_NOTE); + $obj_type = ((x($_REQUEST, 'obj_type')) ? escape_tags($_REQUEST['obj_type']) : 'Note'); // allow API to bulk load a bunch of imported items with sending out a bunch of posts. $nopush = ((x($_REQUEST, 'nopush')) ? intval($_REQUEST['nopush']) : 0); @@ -444,9 +443,6 @@ class Item extends Controller { if (!x($_REQUEST, 'type')) $_REQUEST['type'] = 'net-comment'; - if ($obj_type == ACTIVITY_OBJ_NOTE) - $obj_type = ACTIVITY_OBJ_COMMENT; - if ($parent) { $r = q("SELECT * FROM item WHERE id = %d LIMIT 1", intval($parent) @@ -1008,7 +1004,7 @@ class Item extends Controller { if (!strlen($verb)) - $verb = ACTIVITY_POST; + $verb = 'Create'; $notify_type = (($parent) ? 'comment-new' : 'wall-new'); @@ -1219,18 +1215,6 @@ class Item extends Controller { $this->add_listeners($datarray); } - // We only need edit activities for other federated protocols - // which do not support edits natively. While this does federate - // edits, it presents a number of issues locally - such as #757 and #758. - // The SQL check for an edit activity would not perform that well so to fix these issues - // requires an additional item flag (perhaps 'item_edit_activity') that we can add to the - // query for searches and notifications. - - // For now we'll just forget about trying to make edits work on network protocols that - // don't support them. - - // item_create_edit_activity($x); - if (!$parent) { $r = q("select * from item where id = %d", intval($post_id) @@ -1285,7 +1269,7 @@ class Item extends Controller { 'to_xchan' => $datarray['owner_xchan'], 'item' => $datarray, 'link' => z_root() . '/display/' . $datarray['uuid'], - 'verb' => ACTIVITY_POST, + 'verb' => 'Create', 'otype' => 'item', 'parent' => $parent, 'parent_mid' => $parent_item['mid'] @@ -1303,7 +1287,7 @@ class Item extends Controller { 'to_xchan' => $datarray['owner_xchan'], 'item' => $datarray, 'link' => z_root() . '/display/' . $datarray['uuid'], - 'verb' => ACTIVITY_POST, + 'verb' => 'Create', 'otype' => 'item' ]); } diff --git a/Zotlabs/Module/Like.php b/Zotlabs/Module/Like.php index 68234eb93..e19a74a23 100644 --- a/Zotlabs/Module/Like.php +++ b/Zotlabs/Module/Like.php @@ -19,15 +19,15 @@ class Like extends Controller { private function reaction_to_activity($reaction) { $acts = [ - 'like' => ACTIVITY_LIKE, - 'dislike' => ACTIVITY_DISLIKE, + 'like' => 'Like', + 'dislike' => 'Dislike', 'announce' => ACTIVITY_SHARE, 'agree' => ACTIVITY_AGREE, 'disagree' => ACTIVITY_DISAGREE, 'abstain' => ACTIVITY_ABSTAIN, - 'attendyes' => ACTIVITY_ATTEND, - 'attendno' => ACTIVITY_ATTENDNO, - 'attendmaybe' => ACTIVITY_ATTENDMAYBE + 'attendyes' => 'Accept', + 'attendno' => 'Reject', + 'attendmaybe' => 'TentativeAccept' ]; // unlike (etc.) reactions are an undo of positive reactions, rather than a negative action. @@ -72,11 +72,11 @@ class Like extends Controller { $activities = q("SELECT item.*, item.id AS item_id FROM item WHERE uid = %d $item_normal AND thr_parent = '%s' - AND verb IN ('%s', '%s', '%s', '%s', '%s', '%s')", + AND verb IN ('%s', '%s', '%s', '%s', '%s', '%s', 'Accept', 'Reject', 'TentativeAccept')", intval($arr['item']['uid']), dbesc($arr['item']['mid']), - dbesc(ACTIVITY_LIKE), - dbesc(ACTIVITY_DISLIKE), + dbesc('Like'), + dbesc('Dislike'), dbesc(ACTIVITY_SHARE), dbesc(ACTIVITY_ATTEND), dbesc(ACTIVITY_ATTENDNO), @@ -135,7 +135,7 @@ class Like extends Controller { } $is_rsvp = false; - if (in_array($activity, [ACTIVITY_ATTEND, ACTIVITY_ATTENDNO, ACTIVITY_ATTENDMAYBE])) { + if (in_array($activity, ['Accept', 'Reject', 'TentativeAccept', ACTIVITY_ATTEND, ACTIVITY_ATTENDNO, ACTIVITY_ATTENDMAYBE])) { $is_rsvp = true; } @@ -184,7 +184,7 @@ class Like extends Controller { } } $post_type = t('channel'); - $obj_type = ACTIVITY_OBJ_PROFILE; + $obj_type = 'Profile'; $profile = $r[0]; } @@ -213,7 +213,7 @@ class Like extends Controller { $public = false; $post_type = t('thing'); - $obj_type = ACTIVITY_OBJ_PROFILE; + $obj_type = 'Profile'; $tgttype = ACTIVITY_OBJ_THING; $links = array(); @@ -375,9 +375,9 @@ class Like extends Controller { // event participation and consensus items are essentially radio toggles. If you make a subsequent choice, // we need to eradicate your first choice. - if ($activity === ACTIVITY_ATTEND || $activity === ACTIVITY_ATTENDNO || $activity === ACTIVITY_ATTENDMAYBE) { - $verbs = " '" . dbesc(ACTIVITY_ATTEND) . "','" . dbesc(ACTIVITY_ATTENDNO) . "','" . dbesc(ACTIVITY_ATTENDMAYBE) . "' "; - $multi_undo = 1; + if (in_array($activity, ['Accept', 'Reject', 'TentativeAccept', ACTIVITY_ATTEND, ACTIVITY_ATTENDNO, ACTIVITY_ATTENDMAYBE])) { + $verbs = "'Accept','Reject','TentativeAccept','" . dbesc(ACTIVITY_ATTEND) . "','" . dbesc(ACTIVITY_ATTENDNO) . "','" . dbesc(ACTIVITY_ATTENDMAYBE) . "' "; + $multi_undo = true; } if ($activity === ACTIVITY_AGREE || $activity === ACTIVITY_DISAGREE || $activity === ACTIVITY_ABSTAIN) { $verbs = " '" . dbesc(ACTIVITY_AGREE) . "','" . dbesc(ACTIVITY_DISAGREE) . "','" . dbesc(ACTIVITY_ABSTAIN) . "' "; @@ -452,14 +452,20 @@ class Like extends Controller { $arr['item_wall'] = 1; } else { - $post_type = (($item['resource_type'] === 'photo') ? t('photo') : t('status')); - if (in_array($item['obj_type'], ['Event', ACTIVITY_OBJ_EVENT])) - $post_type = t('event'); - - $obj_type = (($item['resource_type'] === 'photo') ? ACTIVITY_OBJ_PHOTO : ACTIVITY_OBJ_NOTE); - - if ($obj_type === ACTIVITY_OBJ_NOTE && (!intval($item['item_thread_top']))) - $obj_type = ACTIVITY_OBJ_COMMENT; + switch ($item['resource_type']) { + case 'photo': + $obj_type = 'Image'; + $post_type = t('photo'); + break; + case 'event': + $obj_type = 'Invite'; + $post_type = t('event'); + break; + default: + $obj_type = 'Note'; + $post_type = t('status'); + break; + } $object = json_encode(Activity::fetch_item(['id' => $item['mid']])); diff --git a/Zotlabs/Module/Network.php b/Zotlabs/Module/Network.php index 4f8e2f4e4..3ea813547 100644 --- a/Zotlabs/Module/Network.php +++ b/Zotlabs/Module/Network.php @@ -275,7 +275,7 @@ class Network extends \Zotlabs\Web\Controller { $vnotify = get_pconfig(local_channel(), 'system', 'vnotify'); if(! ($vnotify & VNOTIFY_LIKE)) - $likes_sql = " AND verb NOT IN ('" . dbesc(ACTIVITY_LIKE) . "', '" . dbesc(ACTIVITY_DISLIKE) . "') "; + $likes_sql = " AND verb NOT IN ('Like', 'Dislike', '" . dbesc(ACTIVITY_LIKE) . "', '" . dbesc(ACTIVITY_DISLIKE) . "') "; // This is for nouveau view public forum cid queries (if a forum notification is clicked) //$p = q("SELECT oid AS parent FROM term WHERE uid = %d AND ttype = %d AND term = '%s'", diff --git a/Zotlabs/Module/Photos.php b/Zotlabs/Module/Photos.php index 6c73c411e..0a490d1db 100644 --- a/Zotlabs/Module/Photos.php +++ b/Zotlabs/Module/Photos.php @@ -1152,8 +1152,9 @@ class Photos extends \Zotlabs\Web\Controller { $template = $tpl; $sparkle = ''; - if(((activity_match($item['verb'],ACTIVITY_LIKE)) || (activity_match($item['verb'],ACTIVITY_DISLIKE))) && ($item['id'] != $item['parent'])) + if(activity_match($item['verb'], ['Like', 'Dislike', ACTIVITY_LIKE, ACTIVITY_DISLIKE]) && $item['id'] != $item['parent']) { continue; + } $redirect_url = z_root() . '/redir/' . $item['cid'] ; diff --git a/Zotlabs/Module/Poke.php b/Zotlabs/Module/Poke.php index 30585bf3d..ee355f2a9 100644 --- a/Zotlabs/Module/Poke.php +++ b/Zotlabs/Module/Poke.php @@ -47,8 +47,6 @@ class Poke extends Controller { if(! array_key_exists($verb,$verbs)) return; - $activity = ACTIVITY_POKE . '#' . urlencode($verbs[$verb][0]); - $contact_id = intval($_REQUEST['cid']); $xchan = trim($_REQUEST['xchan']); @@ -116,9 +114,9 @@ class Poke extends Controller { $arr['allow_gid'] = $allow_gid; $arr['deny_cid'] = $deny_cid; $arr['deny_gid'] = $deny_gid; - $arr['verb'] = $activity; + $arr['verb'] = 'Create'; $arr['item_private'] = $item_private; - $arr['obj_type'] = ACTIVITY_OBJ_NOTE; + $arr['obj_type'] = 'Note'; $arr['body'] = '[zrl=' . $channel['xchan_url'] . ']' . $channel['xchan_name'] . '[/zrl]' . ' ' . t($verbs[$verb][0]) . ' ' . '[zrl=' . $target['xchan_url'] . ']' . $target['xchan_name'] . '[/zrl]'; $arr['item_origin'] = 1; $arr['item_unseen'] = 1; diff --git a/Zotlabs/Module/Sharedwithme.php b/Zotlabs/Module/Sharedwithme.php index c294079d4..6489959f0 100644 --- a/Zotlabs/Module/Sharedwithme.php +++ b/Zotlabs/Module/Sharedwithme.php @@ -40,7 +40,7 @@ class Sharedwithme extends Controller { //drop all files - localuser if((argc() > 1) && (argv(1) === 'dropall')) { - $r = q("SELECT id FROM item WHERE verb = '%s' AND obj_type IN ('Document', 'Video', 'Audio', 'Image') AND uid = %d AND owner_xchan != '%s' $item_normal", + $r = q("SELECT id FROM item WHERE (verb = 'Create' OR verb = '%s') AND obj_type IN ('Document', 'Video', 'Audio', 'Image') AND uid = %d AND owner_xchan != '%s' $item_normal", dbesc(ACTIVITY_POST), intval(local_channel()), dbesc($channel['channel_hash']) @@ -56,7 +56,7 @@ class Sharedwithme extends Controller { } //list files - $r = q("SELECT id, uid, obj, item_unseen FROM item WHERE verb = '%s' AND obj_type IN ('Document', 'Video', 'Audio', 'Image') AND uid = %d AND owner_xchan != '%s' $item_normal", + $r = q("SELECT id, uid, obj, item_unseen FROM item WHERE (verb = 'Create' OR verb = '%s') AND obj_type IN ('Document', 'Video', 'Audio', 'Image') AND uid = %d AND owner_xchan != '%s' $item_normal", dbesc(ACTIVITY_POST), intval(local_channel()), dbesc($channel['channel_hash']) diff --git a/Zotlabs/Module/Sse_bs.php b/Zotlabs/Module/Sse_bs.php index 1f56d8033..047b7e507 100644 --- a/Zotlabs/Module/Sse_bs.php +++ b/Zotlabs/Module/Sse_bs.php @@ -181,10 +181,10 @@ class Sse_bs extends Controller { $sql_extra = ''; if (!(self::$vnotify & VNOTIFY_LIKE)) { - $sql_extra = " AND verb NOT IN ('" . dbesc(ACTIVITY_LIKE) . "', '" . dbesc(ACTIVITY_DISLIKE) . "') "; + $sql_extra = " AND verb NOT IN ('Like', 'Dislike', '" . dbesc(ACTIVITY_LIKE) . "', '" . dbesc(ACTIVITY_DISLIKE) . "') "; } elseif (!feature_enabled(self::$uid, 'dislike')) { - $sql_extra = " AND verb NOT IN ('" . dbesc(ACTIVITY_DISLIKE) . "') "; + $sql_extra = " AND verb NOT IN ('Dislike', '" . dbesc(ACTIVITY_DISLIKE) . "') "; } $sql_extra2 = ''; @@ -193,8 +193,8 @@ class Sse_bs extends Controller { $item_normal = item_normal(); - // Filter FEP-5624 approvals for comments and internal follow activities - $item_normal .= " AND verb NOT IN ('" . dbesc(ACTIVITY_ATTEND) . "', 'Accept', '" . dbesc(ACTIVITY_ATTENDNO) . "', 'Reject', '" . dbesc(ACTIVITY_FOLLOW) . "') "; + // Filter internal follow activities + $item_normal .= " AND verb NOT IN ('" . dbesc(ACTIVITY_FOLLOW) . "') "; if ($notifications) { $items = q("SELECT * FROM item @@ -264,10 +264,10 @@ class Sse_bs extends Controller { $sql_extra = ''; if (!(self::$vnotify & VNOTIFY_LIKE)) { - $sql_extra = " AND verb NOT IN ('" . dbesc(ACTIVITY_LIKE) . "', '" . dbesc(ACTIVITY_DISLIKE) . "') "; + $sql_extra = " AND verb NOT IN ('Like', 'Dislike', '" . dbesc(ACTIVITY_LIKE) . "', '" . dbesc(ACTIVITY_DISLIKE) . "') "; } elseif (!feature_enabled(self::$uid, 'dislike')) { - $sql_extra = " AND verb NOT IN ('" . dbesc(ACTIVITY_DISLIKE) . "') "; + $sql_extra = " AND verb NOT IN ('Dislike', '" . dbesc(ACTIVITY_DISLIKE) . "') "; } $sql_extra2 = ''; @@ -276,8 +276,8 @@ class Sse_bs extends Controller { $item_normal = item_normal(); - // Filter FEP-5624 approvals for comments and internal follow activities - $item_normal .= " AND verb NOT IN ('" . dbesc(ACTIVITY_ATTEND) . "', 'Accept', '" . dbesc(ACTIVITY_ATTENDNO) . "', 'Reject', '" . dbesc(ACTIVITY_FOLLOW) . "') "; + // Filter internal follow activities + $item_normal .= " AND verb NOT IN ('" . dbesc(ACTIVITY_FOLLOW) . "') "; if ($notifications) { $items = q("SELECT * FROM item @@ -346,10 +346,10 @@ class Sse_bs extends Controller { $sql_extra = ''; if (!(self::$vnotify & VNOTIFY_LIKE)) { - $sql_extra = " AND verb NOT IN ('" . dbesc(ACTIVITY_LIKE) . "', '" . dbesc(ACTIVITY_DISLIKE) . "') "; + $sql_extra = " AND verb NOT IN ('Like', 'Dislike', '" . dbesc(ACTIVITY_LIKE) . "', '" . dbesc(ACTIVITY_DISLIKE) . "') "; } elseif (!feature_enabled(self::$uid, 'dislike')) { - $sql_extra = " AND verb NOT IN ('" . dbesc(ACTIVITY_DISLIKE) . "') "; + $sql_extra = " AND verb NOT IN ('Dislike', '" . dbesc(ACTIVITY_DISLIKE) . "') "; } $sql_extra2 = ''; @@ -359,8 +359,8 @@ class Sse_bs extends Controller { $item_normal = item_normal(); - // Filter FEP-5624 approvals for comments and internal follow activities - $item_normal .= " AND verb NOT IN ('" . dbesc(ACTIVITY_ATTEND) . "', 'Accept', '" . dbesc(ACTIVITY_ATTENDNO) . "', 'Reject', '" . dbesc(ACTIVITY_FOLLOW) . "') "; + // Filter internal follow activities + $item_normal .= " AND verb NOT IN ('" . dbesc(ACTIVITY_FOLLOW) . "') "; if ($notifications) { $items = q("SELECT * FROM item @@ -441,10 +441,10 @@ class Sse_bs extends Controller { $sys = get_sys_channel(); $sql_extra = ''; if (!(self::$vnotify & VNOTIFY_LIKE)) { - $sql_extra = " AND verb NOT IN ('" . dbesc(ACTIVITY_LIKE) . "', '" . dbesc(ACTIVITY_DISLIKE) . "') "; + $sql_extra = " AND verb NOT IN ('Like', 'Dislike', '" . dbesc(ACTIVITY_LIKE) . "', '" . dbesc(ACTIVITY_DISLIKE) . "') "; } elseif (!feature_enabled(self::$uid, 'dislike')) { - $sql_extra = " AND verb NOT IN ('" . dbesc(ACTIVITY_DISLIKE) . "') "; + $sql_extra = " AND verb NOT IN ('Dislike', '" . dbesc(ACTIVITY_DISLIKE) . "') "; } $sql_extra2 = ''; @@ -466,8 +466,8 @@ class Sse_bs extends Controller { $item_normal = item_normal(); - // Filter FEP-5624 approvals for comments and internal follow activities - $item_normal .= " AND verb NOT IN ('" . dbesc(ACTIVITY_ATTEND) . "', 'Accept', '" . dbesc(ACTIVITY_ATTENDNO) . "', 'Reject', '" . dbesc(ACTIVITY_FOLLOW) . "') "; + // Filter internal follow activities + $item_normal .= " AND verb NOT IN ('" . dbesc(ACTIVITY_FOLLOW) . "') "; if ($notifications) { $items = q("SELECT * FROM item @@ -592,7 +592,7 @@ class Sse_bs extends Controller { $sql_extra = ''; if(! (self::$vnotify & VNOTIFY_LIKE)) - $sql_extra = " AND verb NOT IN ('" . dbesc(ACTIVITY_LIKE) . "', '" . dbesc(ACTIVITY_DISLIKE) . "') "; + $sql_extra = " AND verb NOT IN ('Like', 'Dislike', '" . dbesc(ACTIVITY_LIKE) . "', '" . dbesc(ACTIVITY_DISLIKE) . "') "; $fcount = count($forums); $i = 0; @@ -662,12 +662,12 @@ class Sse_bs extends Controller { $item_normal = item_normal(); - // Filter FEP-5624 approvals for comments and internal follow activities - $item_normal .= " AND verb NOT IN ('" . dbesc(ACTIVITY_ATTEND) . "', 'Accept', '" . dbesc(ACTIVITY_ATTENDNO) . "', 'Reject', '" . dbesc(ACTIVITY_FOLLOW) . "') "; + // Filter internal follow activities + $item_normal .= " AND verb NOT IN ('" . dbesc(ACTIVITY_FOLLOW) . "') "; $r = q("SELECT * FROM item - WHERE verb = '%s' + WHERE (verb = 'Create' OR verb = '%s') AND obj_type IN ('Document', 'Video', 'Audio', 'Image') AND uid = %d AND author_xchan != '%s' diff --git a/Zotlabs/Module/Subthread.php b/Zotlabs/Module/Subthread.php index e8181dde3..5ddcaffc6 100644 --- a/Zotlabs/Module/Subthread.php +++ b/Zotlabs/Module/Subthread.php @@ -112,7 +112,7 @@ class Subthread extends \Zotlabs\Web\Controller { $post_type = (($item['resource_type'] === 'photo') ? t('photo') : t('status')); $links = array(array('rel' => 'alternate','type' => 'text/html', 'href' => $item['plink'])); - $objtype = (($item['resource_type'] === 'photo') ? ACTIVITY_OBJ_PHOTO : ACTIVITY_OBJ_NOTE ); + $objtype = (($item['resource_type'] === 'photo') ? 'Image' : 'Note'); $body = $item['body']; diff --git a/Zotlabs/Module/Tagger.php b/Zotlabs/Module/Tagger.php index ebe28c444..b6067be5e 100644 --- a/Zotlabs/Module/Tagger.php +++ b/Zotlabs/Module/Tagger.php @@ -67,15 +67,15 @@ class Tagger extends \Zotlabs\Web\Controller { switch($item['resource_type']) { case 'photo': - $targettype = ACTIVITY_OBJ_PHOTO; + $targettype = 'Image'; $post_type = t('photo'); break; case 'event': - $targettype = ACTIVITY_OBJ_EVENT; + $targettype = 'Event'; $post_type = t('event'); break; default: - $targettype = ACTIVITY_OBJ_NOTE; + $targettype = 'Note'; $post_type = t('post'); if($item['mid'] != $item['parent_mid']) $post_type = t('comment'); diff --git a/Zotlabs/Module/Vote.php b/Zotlabs/Module/Vote.php index 870fd760c..06c47f91f 100644 --- a/Zotlabs/Module/Vote.php +++ b/Zotlabs/Module/Vote.php @@ -98,7 +98,7 @@ class Vote extends Controller { // now reset the placeholders - $item['verb'] = ACTIVITY_POST; + $item['verb'] = 'Create'; $item['obj_type'] = 'Answer'; unset($item['author']); |