From 37878bf0a35bcd0fc799892618a8b34ca0440c2c Mon Sep 17 00:00:00 2001 From: Mario Date: Wed, 28 Feb 2024 09:18:31 +0000 Subject: do away with deprecated activity types --- Zotlabs/Lib/Activity.php | 14 +--- Zotlabs/Lib/Apps.php | 2 - Zotlabs/Module/Like.php | 9 +- Zotlabs/Module/Mood.php | 163 ------------------------------------ Zotlabs/Module/Poke.php | 205 ---------------------------------------------- Zotlabs/Widget/Pinned.php | 9 -- app/mood.apd | 7 -- app/poke.apd | 7 -- boot.php | 13 +-- include/conversation.php | 101 +---------------------- include/items.php | 34 -------- include/text.php | 71 ---------------- view/js/mod_poke.js | 5 -- view/tpl/mood_content.tpl | 33 -------- view/tpl/poke_content.tpl | 48 ----------- 15 files changed, 10 insertions(+), 711 deletions(-) delete mode 100644 Zotlabs/Module/Mood.php delete mode 100644 Zotlabs/Module/Poke.php delete mode 100644 app/mood.apd delete mode 100644 app/poke.apd delete mode 100644 view/js/mod_poke.js delete mode 100644 view/tpl/mood_content.tpl delete mode 100644 view/tpl/poke_content.tpl diff --git a/Zotlabs/Lib/Activity.php b/Zotlabs/Lib/Activity.php index 6b2c4d58a..15e292ec4 100644 --- a/Zotlabs/Lib/Activity.php +++ b/Zotlabs/Lib/Activity.php @@ -448,13 +448,7 @@ class Activity { $ret = []; - if ($i['verb'] === ACTIVITY_FRIEND) { - // Hubzilla 'make-friend' activity, no direct mapping from AS1 to AS2 - make it a note - $objtype = 'Note'; - } - else { - $objtype = self::activity_obj_mapper($i['obj_type']); - } + $objtype = self::activity_obj_mapper($i['obj_type']); if (intval($i['item_deleted'])) { $ret['type'] = 'Tombstone'; @@ -1227,15 +1221,9 @@ class Activity { return $acts[$verb]; } - if (strpos($verb, ACTIVITY_MOOD) !== false) - return 'Create'; - if (strpos($verb, ACTIVITY_FRIEND) !== false) return 'Create'; - if (strpos($verb, ACTIVITY_POKE) !== false) - return 'Activity'; - // We should return false, however this will trigger an uncaught execption and crash // the delivery system if encountered by the JSON-LDSignature library diff --git a/Zotlabs/Lib/Apps.php b/Zotlabs/Lib/Apps.php index 00e65479e..1c05d69b1 100644 --- a/Zotlabs/Lib/Apps.php +++ b/Zotlabs/Lib/Apps.php @@ -352,8 +352,6 @@ class Apps { 'Directory' => t('Directory'), 'Help' => t('Help'), 'Mail' => t('Mail'), - 'Mood' => t('Mood'), - 'Poke' => t('Poke'), 'Chat' => t('Chat'), 'Search' => t('Search'), 'Probe' => t('Probe'), diff --git a/Zotlabs/Module/Like.php b/Zotlabs/Module/Like.php index e19a74a23..18111a3e1 100644 --- a/Zotlabs/Module/Like.php +++ b/Zotlabs/Module/Like.php @@ -22,9 +22,6 @@ class Like extends Controller { 'like' => 'Like', 'dislike' => 'Dislike', 'announce' => ACTIVITY_SHARE, - 'agree' => ACTIVITY_AGREE, - 'disagree' => ACTIVITY_DISAGREE, - 'abstain' => ACTIVITY_ABSTAIN, 'attendyes' => 'Accept', 'attendno' => 'Reject', 'attendmaybe' => 'TentativeAccept' @@ -372,17 +369,13 @@ class Like extends Controller { $multi_undo = false; - // event participation and consensus items are essentially radio toggles. If you make a subsequent choice, + // event participation items are essentially radio toggles. If you make a subsequent choice, // we need to eradicate your first choice. 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) . "' "; - $multi_undo = true; - } $item_normal = item_normal(); diff --git a/Zotlabs/Module/Mood.php b/Zotlabs/Module/Mood.php deleted file mode 100644 index edd3f0e1a..000000000 --- a/Zotlabs/Module/Mood.php +++ /dev/null @@ -1,163 +0,0 @@ - $v) - if($v !== 'NOTRANSLATION') - $shortlist[] = array($k,$v); - - - $tpl = get_markup_template('mood_content.tpl'); - - $o = replace_macros($tpl,array( - '$title' => t('Mood'), - '$desc' => t('Set your current mood and tell your friends'), - '$verbs' => $shortlist, - '$parent' => $parent, - '$submit' => t('Submit'), - )); - - return $o; - - } - -} diff --git a/Zotlabs/Module/Poke.php b/Zotlabs/Module/Poke.php deleted file mode 100644 index ee355f2a9..000000000 --- a/Zotlabs/Module/Poke.php +++ /dev/null @@ -1,205 +0,0 @@ -' : $channel['channel_allow_cid']); - $allow_gid = (($item_private) ? '' : $channel['channel_allow_gid']); - $deny_cid = (($item_private) ? '' : $channel['channel_deny_cid']); - $deny_gid = (($item_private) ? '' : $channel['channel_deny_gid']); - } - - $arr['item_wall'] = 1; - $arr['owner_xchan'] = (($parent_item) ? $parent_item['owner_xchan'] : $channel['channel_hash']); - $arr['parent_mid'] = (($parent_mid) ? $parent_mid : ''); - $arr['title'] = ''; - $arr['allow_cid'] = $allow_cid; - $arr['allow_gid'] = $allow_gid; - $arr['deny_cid'] = $deny_cid; - $arr['deny_gid'] = $deny_gid; - $arr['verb'] = 'Create'; - $arr['item_private'] = $item_private; - $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; - if(! $parent_item) - $arr['item_thread_top'] = 1; - - $arr['obj'] = Activity::encode_item($arr); - - - post_activity_item($arr); - - return; - } - - - - function get() { - - if(! local_channel()) { - notice( t('Permission denied.') . EOL); - return; - } - - if(! Apps::system_app_installed(local_channel(), 'Poke')) { - //Do not display any associated widgets at this point - App::$pdl = ''; - $papp = Apps::get_papp('Poke'); - return Apps::app_render($papp, 'module'); - } - - nav_set_selected('Poke'); - - $name = ''; - $id = ''; - - if(isset($_REQUEST['c']) && intval($_REQUEST['c'])) { - $r = q("select abook_id, xchan_name from abook left join xchan on abook_xchan = xchan_hash - where abook_id = %d and abook_channel = %d limit 1", - intval($_REQUEST['c']), - intval(local_channel()) - ); - if($r) { - $name = $r[0]['xchan_name']; - $id = $r[0]['abook_id']; - } - } - - $parent = ((x($_REQUEST,'parent')) ? intval($_REQUEST['parent']) : '0'); - - $verbs = get_poke_verbs(); - - $shortlist = array(); - foreach($verbs as $k => $v) - if($v[1] !== 'NOTRANSLATION') - $shortlist[] = array($k,$v[1]); - - - $poke_basic = get_config('system','poke_basic'); - if($poke_basic) { - $title = t('Poke'); - $desc = t('Poke somebody'); - } - else { - $title = t('Poke'); - $desc = t('Poke or ping somebody'); - } - - $o = replace_macros(get_markup_template('poke_content.tpl'),array( - '$title' => $title, - '$poke_basic' => $poke_basic, - '$desc' => $desc, - '$clabel' => t('Recipient'), - '$choice' => t('Choose action'), - '$verbs' => $shortlist, - '$parent' => $parent, - '$prv_desc' => t('Make this post private'), - '$private' => array('private', t('Make this post private'), false, ''), - '$submit' => t('Submit'), - '$name' => $name, - '$id' => $id - )); - - return $o; - - } -} diff --git a/Zotlabs/Widget/Pinned.php b/Zotlabs/Widget/Pinned.php index 3c6484b36..a93937aa9 100644 --- a/Zotlabs/Widget/Pinned.php +++ b/Zotlabs/Widget/Pinned.php @@ -234,15 +234,6 @@ class Pinned { case 'dislike': $verb_sql = " AND verb IN ('Dislike', '" . ACTIVITY_DISLIKE . "') "; break; - case 'agree': - $verb_sql = " AND verb = '" . ACTIVITY_AGREE . "' "; - break; - case 'disagree': - $verb_sql = " AND verb = '" . ACTIVITY_DISAGREE . "' "; - break; - case 'abstain': - $verb_sql = " AND verb = '" . ACTIVITY_ABSTAIN . "' "; - break; case 'attendyes': $verb_sql = " AND verb IN ('Accept', '" . ACTIVITY_ATTEND . "') "; break; diff --git a/app/mood.apd b/app/mood.apd deleted file mode 100644 index 81b53a2ce..000000000 --- a/app/mood.apd +++ /dev/null @@ -1,7 +0,0 @@ -version: 3 -url: $baseurl/mood -requires: local_channel -name: Mood -photo: icon:smile-o -categories: Social -desc: Set your current mood and tell your friends. diff --git a/app/poke.apd b/app/poke.apd deleted file mode 100644 index 490f98740..000000000 --- a/app/poke.apd +++ /dev/null @@ -1,7 +0,0 @@ -version: 3 -url: $baseurl/poke -requires: local_channel -name: Poke -photo: icon:hand-o-right -categories: Social -desc: Poke somebody in your addressbook. diff --git a/boot.php b/boot.php index 733da3dbd..8bd6c1451 100644 --- a/boot.php +++ b/boot.php @@ -488,6 +488,7 @@ define('NAMESPACE_YMEDIA', 'http://search.yahoo.com/mrss/'); define('ACTIVITYSTREAMS_JSONLD_REV', 'https://www.w3.org/ns/activitystreams'); define('ZOT_APSCHEMA_REV', '/apschema/v1.11'); + /** * activity stream defines */ @@ -499,15 +500,15 @@ define('ACTIVITY_REACT', NAMESPACE_ZOT . '/activity/react'); // deprecated define('ACTIVITY_LIKE', NAMESPACE_ACTIVITY_SCHEMA . 'like'); // AS2 Like define('ACTIVITY_DISLIKE', NAMESPACE_ZOT . '/activity/dislike'); // AS2 Dislike -define('ACTIVITY_AGREE', NAMESPACE_ZOT . '/activity/agree'); // deprecated - remove from code? -define('ACTIVITY_DISAGREE', NAMESPACE_ZOT . '/activity/disagree'); // deprecated - remove from code? -define('ACTIVITY_ABSTAIN', NAMESPACE_ZOT . '/activity/abstain'); // deprecated - remove from code? +define('ACTIVITY_AGREE', NAMESPACE_ZOT . '/activity/agree'); // deprecated +define('ACTIVITY_DISAGREE', NAMESPACE_ZOT . '/activity/disagree'); // deprecated +define('ACTIVITY_ABSTAIN', NAMESPACE_ZOT . '/activity/abstain'); // deprecated define('ACTIVITY_ATTEND', NAMESPACE_ZOT . '/activity/attendyes'); // AS2 Accept define('ACTIVITY_ATTENDNO', NAMESPACE_ZOT . '/activity/attendno'); // AS2 Reject define('ACTIVITY_ATTENDMAYBE', NAMESPACE_ZOT . '/activity/attendmaybe'); // AS2 TentativeAccept -define('ACTIVITY_FRIEND', NAMESPACE_ACTIVITY_SCHEMA . 'make-friend'); // deprecated - remove from code? +define('ACTIVITY_FRIEND', NAMESPACE_ACTIVITY_SCHEMA . 'make-friend'); // deprecated define('ACTIVITY_FOLLOW', NAMESPACE_ACTIVITY_SCHEMA . 'follow'); define('ACTIVITY_UNFOLLOW', NAMESPACE_ACTIVITY_SCHEMA . 'stop-following'); @@ -525,8 +526,8 @@ define('ACTIVITY_CREATE', NAMESPACE_ACTIVITY_SCHEMA . 'create'); // deprecated define('ACTIVITY_DELETE', NAMESPACE_ACTIVITY_SCHEMA . 'delete'); // AS2 Delete -define('ACTIVITY_POKE', NAMESPACE_ZOT . '/activity/poke'); // TODO: deprecate -define('ACTIVITY_MOOD', NAMESPACE_ZOT . '/activity/mood'); // TODO: deprecate +define('ACTIVITY_POKE', NAMESPACE_ZOT . '/activity/poke'); // deprecated +define('ACTIVITY_MOOD', NAMESPACE_ZOT . '/activity/mood'); // deprecated define('ACTIVITY_OBJ_COMMENT', NAMESPACE_ACTIVITY_SCHEMA . 'comment'); // AS2 Note define('ACTIVITY_OBJ_NOTE', NAMESPACE_ACTIVITY_SCHEMA . 'note'); // AS2 Note diff --git a/include/conversation.php b/include/conversation.php index 7074e1c36..498fefa99 100644 --- a/include/conversation.php +++ b/include/conversation.php @@ -217,96 +217,6 @@ function localize_item(&$item){ } - if (activity_match($item['verb'], ACTIVITY_FRIEND)) { - - if ($item['obj_type'] == "" || !in_array($item['obj_type'], ['Person', ACTIVITY_OBJ_PERSON])) - return; - - $Aname = $item['author']['xchan_name']; - $Alink = $item['author']['xchan_url']; - - - $obj= json_decode($item['obj'],true); - - $Blink = $Bphoto = ''; - - if($obj['link']) { - $Blink = get_rel_link($obj['link'],'alternate'); - $Bphoto = get_rel_link($obj['link'],'photo'); - } - $Bname = $obj['title']; - - - $A = '[zrl=' . chanlink_url($Alink) . '][bdi]' . $Aname . '[/bdi][/zrl]'; - $B = '[zrl=' . chanlink_url($Blink) . '][bdi]' . $Bname . '[/bdi][/zrl]'; - if ($Bphoto!="") $Bphoto = '[zrl=' . chanlink_url($Blink) . '][zmg=80x80]' . $Bphoto . '[/zmg][/zrl]'; - - $item['shortlocalize'] = sprintf( t('%1$s is now connected with %2$s'), '[bdi]' . $Aname . '[/bdi]', '[bdi]' . $Bname . '[/bdi]'); - - $item['body'] = $item['localize'] = sprintf( t('%1$s is now connected with %2$s'), $A, $B); - $item['body'] .= "\n\n\n" . $Bphoto; - } - - if (stristr($item['verb'], ACTIVITY_POKE)) { - - /** @FIXME for obscured private posts, until then leave untranslated */ - return; - - $verb = urldecode(substr($item['verb'],strpos($item['verb'],'#')+1)); - if(! $verb) - return; - - if ($item['obj_type']=="" || !in_array($item['obj_type'], ['Person', ACTIVITY_OBJ_PERSON])) - return; - - $Aname = $item['author']['xchan_name']; - $Alink = $item['author']['xchan_url']; - - $obj= json_decode($item['obj'],true); - - $Blink = $Bphoto = ''; - - if($obj['link']) { - $Blink = get_rel_link($obj['link'],'alternate'); - $Bphoto = get_rel_link($obj['link'],'photo'); - } - $Bname = $obj['title']; - - $A = '[zrl=' . chanlink_url($Alink) . '][bdi]' . $Aname . '[/bdi][/zrl]'; - $B = '[zrl=' . chanlink_url($Blink) . '][bdi]' . $Bname . '[/bdi][/zrl]'; - if ($Bphoto!="") $Bphoto = '[zrl=' . chanlink_url($Blink) . '][zmg=80x80]' . $Bphoto . '[/zmg][/zrl]'; - - // we can't have a translation string with three positions but no distinguishable text - // So here is the translate string. - - $txt = t('%1$s poked %2$s'); - - // now translate the verb - - $txt = str_replace( t('poked'), t($verb), $txt); - - // then do the sprintf on the translation string - - $item['shortlocalize'] = sprintf($txt, '[bdi]' . $Aname . '[/bdi]', '[bdi]' . $Bname . '[/bdi]'); - - $item['body'] = $item['localize'] = sprintf($txt, $A, $B); - $item['body'] .= "\n\n\n" . $Bphoto; - } - if (stristr($item['verb'],ACTIVITY_MOOD)) { - $verb = urldecode(substr($item['verb'],strpos($item['verb'],'#')+1)); - if(! $verb) - return; - - $Aname = $item['author']['xchan_name']; - $Alink = $item['author']['xchan_url']; - - $A = '[zrl=' . chanlink_url($Alink) . '][bdi]' . $Aname . '[/bdi][/zrl]'; - - $txt = t('%1$s is %2$s','mood'); - - $item['body'] = sprintf($txt, $A, t($verb)); - } - } /** @@ -345,7 +255,7 @@ function count_descendants($item) { * @return boolean */ function visible_activity($item) { - $hidden_activities = ['Like', 'Dislike', 'Accept', 'Reject', 'TentativeAccept', ACTIVITY_LIKE, ACTIVITY_DISLIKE, ACTIVITY_SHARE, ACTIVITY_AGREE, ACTIVITY_DISAGREE, ACTIVITY_ABSTAIN, ACTIVITY_ATTEND, ACTIVITY_ATTENDNO, ACTIVITY_ATTENDMAYBE]; + $hidden_activities = ['Like', 'Dislike', 'Accept', 'Reject', 'TentativeAccept', ACTIVITY_LIKE, ACTIVITY_DISLIKE, ACTIVITY_SHARE, ACTIVITY_ATTEND, ACTIVITY_ATTENDNO, ACTIVITY_ATTENDMAYBE]; if(intval($item['item_notshown'])) return false; @@ -1082,15 +992,6 @@ function builtin_activity_puller($item, &$conv_responses) { case 'dislike': $verb = ['Dislike', ACTIVITY_DISLIKE]; break; - case 'agree': - $verb = ACTIVITY_AGREE; - break; - case 'disagree': - $verb = ACTIVITY_DISAGREE; - break; - case 'abstain': - $verb = ACTIVITY_ABSTAIN; - break; case 'attendyes': $verb = ['Accept', ACTIVITY_ATTEND]; break; diff --git a/include/items.php b/include/items.php index f689cc7b5..8a0af5679 100644 --- a/include/items.php +++ b/include/items.php @@ -2607,7 +2607,6 @@ function tag_deliver($uid, $item_id) { return; } - if ($is_group && intval($item['item_thread_top']) && intval($item['item_wall']) && $item['author_xchan'] !== $item['owner_xchan']) { if($item['resource_type'] === 'group_item') { @@ -2624,39 +2623,6 @@ function tag_deliver($uid, $item_id) { return; } - /* - * Seems like a good place to plug in a poke notification. - */ - - if (stristr($item['verb'],ACTIVITY_POKE)) { - $poke_notify = true; - - if(($item['obj_type'] == "") || (!in_array($item['obj_type'], ['Person', ACTIVITY_OBJ_PERSON])) || (! $item['obj'])) - $poke_notify = false; - - $obj = json_decode($item['obj'],true); - if($obj) { - if($obj['id'] !== $u[0]['channel_hash']) - $poke_notify = false; - } - if(intval($item['item_deleted'])) - $poke_notify = false; - - $verb = urldecode(substr($item['verb'],strpos($item['verb'],'#')+1)); - if($poke_notify) { - Enotify::submit(array( - 'to_xchan' => $u[0]['channel_hash'], - 'from_xchan' => $item['author_xchan'], - 'type' => NOTIFY_POKE, - 'item' => $item, - 'link' => $i[0]['llink'], - 'verb' => ACTIVITY_POKE, - 'activity' => $verb, - 'otype' => 'item' - )); - } - } - /* * Do community tagging */ diff --git a/include/text.php b/include/text.php index ea9cf45e1..d6256b75b 100644 --- a/include/text.php +++ b/include/text.php @@ -1270,77 +1270,6 @@ function sslify($s) { return $s; } -/** - * @brief Get an array of poke verbs. - * - * @return array - * * \e index is present tense verb - * * \e value is array containing past tense verb, translation of present, translation of past - */ -function get_poke_verbs() { - - $arr = [ - 'poke' => ['poked', t('poke'), t('poked')], - 'ping' => ['pinged', t('ping'), t('pinged')], - - // Those might be better suited for a nsfw poke addon - - // 'prod' => ['prodded', t('prod'), t('prodded')], - // 'slap' => ['slapped', t('slap'), t('slapped')], - // 'finger' => ['fingered', t('finger'), t('fingered')], - // 'rebuff' => ['rebuffed', t('rebuff'), t('rebuffed')] - ]; - - /** - * @hooks poke_verbs - * * \e array associative array with another array as value - */ - call_hooks('poke_verbs', $arr); - - return $arr; -} - -/** - * @brief Get an array of mood verbs. - * - * @return array - * * \e index is the verb - * * \e value is the translated verb - */ -function get_mood_verbs() { - - $arr = [ - 'happy' => t('happy'), - 'sad' => t('sad'), - 'mellow' => t('mellow'), - 'tired' => t('tired'), - 'perky' => t('perky'), - 'angry' => t('angry'), - 'stupefied' => t('stupefied'), - 'puzzled' => t('puzzled'), - 'interested' => t('interested'), - 'bitter' => t('bitter'), - 'cheerful' => t('cheerful'), - 'alive' => t('alive'), - 'annoyed' => t('annoyed'), - 'anxious' => t('anxious'), - 'cranky' => t('cranky'), - 'disturbed' => t('disturbed'), - 'frustrated' => t('frustrated'), - 'depressed' => t('depressed'), - 'motivated' => t('motivated'), - 'relaxed' => t('relaxed'), - 'surprised' => t('surprised'), - ]; - - /** - * @hooks mood_verbs - * * \e array associative array with mood verbs - */ - call_hooks('mood_verbs', $arr); - - return $arr; -} /** * @brief Function to list all smilies, both internal and from addons. diff --git a/view/js/mod_poke.js b/view/js/mod_poke.js deleted file mode 100644 index 88fa9f7c2..000000000 --- a/view/js/mod_poke.js +++ /dev/null @@ -1,5 +0,0 @@ -$(document).ready(function() { - $("#poke-recip").contact_autocomplete(baseurl + '/acl', 'a', false, function(data) { - $("#poke-recip-complete").val(data.id); - }); -}); diff --git a/view/tpl/mood_content.tpl b/view/tpl/mood_content.tpl deleted file mode 100644 index 4cb5207f6..000000000 --- a/view/tpl/mood_content.tpl +++ /dev/null @@ -1,33 +0,0 @@ - -
-
-

{{$title}}

-
-
- -
{{$desc}}
- -
-
- - -
-
-
- - - -
- -
-
-
- - -
-
-
diff --git a/view/tpl/poke_content.tpl b/view/tpl/poke_content.tpl deleted file mode 100644 index 3872d21ff..000000000 --- a/view/tpl/poke_content.tpl +++ /dev/null @@ -1,48 +0,0 @@ - -
-
-

{{$title}}

-
-
- -
{{$desc}}
- -
-
- - -
- - -
- - -
- - - - - -{{if $poke_basic}} - -{{else}} -
- - -
-{{/if}} - -{{if ! $parent}} -{{include file="field_checkbox.tpl" field=$private}} -{{/if}} - - -
- - -
-
-- cgit v1.2.3