aboutsummaryrefslogtreecommitdiffstats
path: root/Zotlabs
diff options
context:
space:
mode:
Diffstat (limited to 'Zotlabs')
-rw-r--r--Zotlabs/Daemon/Notifier.php3
-rw-r--r--Zotlabs/Lib/Activity.php142
-rw-r--r--Zotlabs/Lib/Enotify.php12
-rw-r--r--Zotlabs/Lib/Libzot.php2
-rw-r--r--Zotlabs/Lib/Share.php2
-rw-r--r--Zotlabs/Lib/ThreadItem.php2
-rw-r--r--Zotlabs/Lib/ThreadStream.php2
-rw-r--r--Zotlabs/Module/Item.php24
-rw-r--r--Zotlabs/Module/Like.php50
-rw-r--r--Zotlabs/Module/Network.php2
-rw-r--r--Zotlabs/Module/Photos.php3
-rw-r--r--Zotlabs/Module/Poke.php6
-rw-r--r--Zotlabs/Module/Sharedwithme.php4
-rw-r--r--Zotlabs/Module/Sse_bs.php40
-rw-r--r--Zotlabs/Module/Subthread.php2
-rw-r--r--Zotlabs/Module/Tagger.php6
-rw-r--r--Zotlabs/Module/Vote.php2
-rw-r--r--Zotlabs/Widget/Messages.php15
-rw-r--r--Zotlabs/Widget/Pinned.php22
19 files changed, 113 insertions, 228 deletions
diff --git a/Zotlabs/Daemon/Notifier.php b/Zotlabs/Daemon/Notifier.php
index 0474a4a26..948aba80c 100644
--- a/Zotlabs/Daemon/Notifier.php
+++ b/Zotlabs/Daemon/Notifier.php
@@ -270,8 +270,7 @@ class Notifier {
// Check for non published items, but allow an exclusion for transmitting hidden file activities
if (intval($target_item['item_unpublished']) || intval($target_item['item_delayed']) ||
- intval($target_item['item_blocked']) ||
- (intval($target_item['item_hidden']) && ($target_item['obj_type'] !== ACTIVITY_OBJ_FILE))) {
+ intval($target_item['item_blocked']) || intval($target_item['item_hidden'])) {
logger('notifier: target item not published, so not forwardable', LOGGER_DEBUG);
return;
}
diff --git a/Zotlabs/Lib/Activity.php b/Zotlabs/Lib/Activity.php
index 9a76ccf2e..844dc5905 100644
--- a/Zotlabs/Lib/Activity.php
+++ b/Zotlabs/Lib/Activity.php
@@ -27,19 +27,23 @@ class Activity {
return $x['asld'];
}
- if ($x['type'] === ACTIVITY_OBJ_PERSON) {
+ if (in_array($x['type'], ['Person', ACTIVITY_OBJ_PERSON])) {
return self::fetch_person($x);
}
- if ($x['type'] === ACTIVITY_OBJ_PROFILE) {
+
+ if (in_array($x['type'], ['Profile', ACTIVITY_OBJ_PROFILE])) {
return self::fetch_profile($x);
}
- if (in_array($x['type'], [ACTIVITY_OBJ_NOTE, ACTIVITY_OBJ_ARTICLE])) {
+
+ if (in_array($x['type'], ['Note', 'Article', ACTIVITY_OBJ_NOTE, ACTIVITY_OBJ_ARTICLE])) {
return self::fetch_item($x);
}
+
if ($x['type'] === ACTIVITY_OBJ_THING) {
return self::fetch_thing($x);
}
- if ($x['type'] === ACTIVITY_OBJ_EVENT) {
+
+ if (in_array($x['type'], ['Event', ACTIVITY_OBJ_EVENT])) {
return self::fetch_event($x);
}
@@ -224,7 +228,7 @@ class Activity {
if ($r) {
xchan_query($r, true);
$r = fetch_post_tags($r);
- if (in_array($r[0]['verb'], ['Create', 'Invite']) && $r[0]['obj_type'] === ACTIVITY_OBJ_EVENT) {
+ if (in_array($r[0]['verb'], ['Create', 'Invite']) && in_array($r[0]['obj_type'], ['Event', ACTIVITY_OBJ_EVENT])) {
$r[0]['verb'] = 'Invite';
return self::encode_activity($r[0]);
}
@@ -936,7 +940,7 @@ class Activity {
if (!is_array($i['obj'])) {
$i['obj'] = json_decode($i['obj'], true);
}
- if ($i['obj']['type'] === ACTIVITY_OBJ_PHOTO) {
+ if (in_array($i['obj']['type'], ['Image', ACTIVITY_OBJ_PHOTO])) {
$i['obj']['id'] = $i['mid'];
}
@@ -1174,7 +1178,7 @@ class Activity {
if (!is_array($item[$elm])) {
$item[$elm] = json_decode($item[$elm], true);
}
- if ($item[$elm]['type'] === ACTIVITY_OBJ_PHOTO) {
+ if (in_array($item[$elm]['type'], ['Image', ACTIVITY_OBJ_PHOTO])) {
$item[$elm]['id'] = $item['mid'];
}
@@ -1208,19 +1212,13 @@ class Activity {
'http://activitystrea.ms/schema/1.0/like' => 'Like',
'http://activitystrea.ms/schema/1.0/favorite' => 'Like',
'http://purl.org/zot/activity/dislike' => 'Dislike',
- // 'http://activitystrea.ms/schema/1.0/tag' => 'Add',
+ //'http://activitystrea.ms/schema/1.0/tag' => 'Add',
'http://activitystrea.ms/schema/1.0/follow' => 'Follow',
'http://activitystrea.ms/schema/1.0/unfollow' => 'Unfollow',
'http://activitystrea.ms/schema/1.0/stop-following' => 'Unfollow',
'http://purl.org/zot/activity/attendyes' => 'Accept',
'http://purl.org/zot/activity/attendno' => 'Reject',
'http://purl.org/zot/activity/attendmaybe' => 'TentativeAccept',
- 'Announce' => 'Announce',
- 'Invite' => 'Invite',
- 'Delete' => 'Delete',
- 'Undo' => 'Undo',
- 'Add' => 'Add',
- 'Remove' => 'Remove'
];
call_hooks('activity_mapper', $acts);
@@ -1232,7 +1230,7 @@ class Activity {
// Reactions will just map to normal activities
if (strpos($verb, ACTIVITY_REACT) !== false)
- return 'emojiReaction';
+ return 'Create';
if (strpos($verb, ACTIVITY_MOOD) !== false)
return 'Create';
@@ -1341,13 +1339,7 @@ class Activity {
'http://purl.org/zot/activity/tagterm' => 'zot:Tag',
'http://purl.org/zot/activity/thing' => 'Object',
'http://purl.org/zot/activity/file' => 'zot:File',
- 'http://purl.org/zot/activity/mood' => 'zot:Mood',
- 'Invite' => 'Invite',
- 'Question' => 'Question',
- 'Audio' => 'Audio',
- 'Video' => 'Video',
- 'Delete' => 'Delete',
- 'Undo' => 'Undo'
+ 'http://purl.org/zot/activity/mood' => 'zot:Mood'
];
call_hooks('activity_obj_mapper', $objs);
@@ -2256,7 +2248,7 @@ class Activity {
$s['body'] .= $quote_bbcode;
}
- $s['verb'] = self::activity_decode_mapper($act->type);
+ $s['verb'] = self::activity_mapper($act->type);
// Mastodon does not provide update timestamps when updating poll tallies which means race conditions may occur here.
if ($act->type === 'Update' && $act->objprop('type') === 'Question' && $s['edited'] === $s['created']) {
@@ -2267,63 +2259,16 @@ class Activity {
$s['item_deleted'] = 1;
}
- if (isset($act->obj['type'])) {
- $s['obj_type'] = self::activity_obj_decode_mapper($act->obj['type']);
- }
-
- if ($s['obj_type'] === ACTIVITY_OBJ_NOTE && $s['mid'] !== $s['parent_mid']) {
- $s['obj_type'] = ACTIVITY_OBJ_COMMENT;
+ if ($act->objprop('type')) {
+ $s['obj_type'] = self::activity_obj_mapper($act->obj['type']);
}
$s['obj'] = $act->obj;
+
if (array_path_exists('actor/id', $s['obj'])) {
$s['obj']['actor'] = $s['obj']['actor']['id'];
}
-/*
- $eventptr = null;
-
- if ($act->obj['type'] === 'Invite' && array_path_exists('object/type', $act->obj) && $act->obj['object']['type'] === 'Event') {
- $eventptr = $act->obj['object'];
- $s['mid'] = $s['parent_mid'] = $act->obj['id'];
- }
-
- if ($act->obj['type'] === 'Event') {
- if ($act->type === 'Invite') {
- $s['mid'] = $s['parent_mid'] = $act->id;
- }
- $eventptr = $act->obj;
- }
-
- if ($eventptr) {
-
- $s['obj'] = [];
- $s['obj']['asld'] = $eventptr;
- $s['obj']['type'] = ACTIVITY_OBJ_EVENT;
- $s['obj']['id'] = $eventptr['id'];
- $s['obj']['title'] = html2plain($eventptr['name']);
-
- if (strpos($act->obj['startTime'], 'Z'))
- $s['obj']['adjust'] = true;
- else
- $s['obj']['adjust'] = true;
-
- $s['obj']['dtstart'] = datetime_convert('UTC', 'UTC', $eventptr['startTime']);
- if ($act->obj['endTime'])
- $s['obj']['dtend'] = datetime_convert('UTC', 'UTC', $eventptr['endTime']);
- else
- $s['obj']['nofinish'] = true;
- $s['obj']['description'] = html2bbcode($eventptr['content']);
-
- if (array_path_exists('location/content', $eventptr))
- $s['obj']['location'] = $eventptr['location']['content'];
-
- }
- else {
- $s['obj'] = $act->obj;
- }
-*/
-
$generator = $act->get_property_obj('generator');
if ((!$generator) && (!$response_activity)) {
$generator = $act->get_property_obj('generator', $act->obj);
@@ -2715,16 +2660,13 @@ class Activity {
return;
}
-
- // TODO: if we do not have a parent stop here and move the fetch to background?
-
- if ($parent && $parent[0]['obj_type'] === 'Question') {
- if ($item['obj_type'] === ACTIVITY_OBJ_COMMENT && $item['title'] && (!$item['body'])) {
+ if ($parent[0]['obj_type'] === 'Question') {
+ if (in_array($item['obj_type'], ['Note', ACTIVITY_OBJ_COMMENT]) && $item['title'] && (!$item['body'])) {
$item['obj_type'] = 'Answer';
}
}
- if ($parent && $parent[0]['item_wall']) {
+ if ($parent[0]['item_wall']) {
// set the owner to the owner of the parent
$item['owner_xchan'] = $parent[0]['owner_xchan'];
@@ -3313,49 +3255,7 @@ class Activity {
$event['nofinish'] = true;
}
}
-/*
- $eventptr = null;
-
- if ($act->obj['type'] === 'Invite' && array_path_exists('object/type', $act->obj) && $act->obj['object']['type'] === 'Event') {
- $eventptr = $act->obj['object'];
- $s['mid'] = $s['parent_mid'] = $act->obj['id'];
- }
- if ($act->obj['type'] === 'Event') {
- if ($act->type === 'Invite') {
- $s['mid'] = $s['parent_mid'] = $act->id;
- }
- $eventptr = $act->obj;
- }
-
- if ($eventptr) {
-
- $s['obj'] = [];
- $s['obj']['asld'] = $eventptr;
- $s['obj']['type'] = ACTIVITY_OBJ_EVENT;
- $s['obj']['id'] = $eventptr['id'];
- $s['obj']['title'] = html2plain($eventptr['name']);
-
- if (strpos($act->obj['startTime'], 'Z'))
- $s['obj']['adjust'] = true;
- else
- $s['obj']['adjust'] = true;
-
- $s['obj']['dtstart'] = datetime_convert('UTC', 'UTC', $eventptr['startTime']);
- if ($act->obj['endTime'])
- $s['obj']['dtend'] = datetime_convert('UTC', 'UTC', $eventptr['endTime']);
- else
- $s['obj']['nofinish'] = true;
- $s['obj']['description'] = html2bbcode($eventptr['content']);
-
- if (array_path_exists('location/content', $eventptr))
- $s['obj']['location'] = $eventptr['location']['content'];
-
- }
- else {
- $s['obj'] = $act->obj;
- }
-*/
foreach (['name', 'summary', 'content'] as $a) {
if (($x = self::get_textfield($act, $a)) !== false) {
$content[$a] = $x;
diff --git a/Zotlabs/Lib/Enotify.php b/Zotlabs/Lib/Enotify.php
index 8a980519d..48a255e95 100644
--- a/Zotlabs/Lib/Enotify.php
+++ b/Zotlabs/Lib/Enotify.php
@@ -149,7 +149,7 @@ class Enotify {
if(array_key_exists('item',$params)) {
- if(in_array($params['item']['verb'], [ACTIVITY_LIKE, ACTIVITY_DISLIKE, ACTIVITY_SHARE])) {
+ if(in_array($params['item']['verb'], ['Like', 'Dislike', ACTIVITY_LIKE, ACTIVITY_DISLIKE, ACTIVITY_SHARE])) {
if(! $always_show_in_notices || !($vnotify & VNOTIFY_LIKE)) {
logger('notification: not a visible activity. Ignoring.');
@@ -157,10 +157,10 @@ class Enotify {
return;
}
- if(activity_match($params['verb'], ACTIVITY_LIKE))
+ if(activity_match($params['verb'], ['Like', ACTIVITY_LIKE]))
$action = (($moderated) ? t('requested to like') : t('liked'));
- if(activity_match($params['verb'], ACTIVITY_DISLIKE))
+ if(activity_match($params['verb'], ['Dislike', ACTIVITY_DISLIKE]))
$action = (($moderated) ? t('requested to dislike') : t('disliked'));
if(activity_match($params['verb'], ACTIVITY_SHARE))
@@ -262,7 +262,7 @@ class Enotify {
$itemlink = $params['link'];
- if (array_key_exists('item',$params) && (activity_match($params['item']['verb'], ACTIVITY_LIKE) || activity_match($params['item']['verb'], ACTIVITY_DISLIKE))) {
+ if (array_key_exists('item',$params) && (activity_match($params['item']['verb'], ['Like', 'Dislike', ACTIVITY_LIKE, ACTIVITY_DISLIKE]))) {
if(! $always_show_in_notices || !($vnotify & VNOTIFY_LIKE) || !feature_enabled($recip['channel_id'], 'dislike')) {
logger('notification: not a visible activity. Ignoring.');
pop_lang();
@@ -313,10 +313,10 @@ class Enotify {
//$verb = ((activity_match($params['item']['verb'], ACTIVITY_DISLIKE)) ? t('disliked') : t('liked'));
$moderated = (($params['item']['item_blocked'] == ITEM_MODERATED) ? true : false);
- if(activity_match($params['item']['verb'], ACTIVITY_LIKE))
+ if(activity_match($params['item']['verb'], ['Like', ACTIVITY_LIKE]))
$verb = (($moderated) ? t('requested to like') : t('liked'));
- if(activity_match($params['item']['verb'], ACTIVITY_DISLIKE))
+ if(activity_match($params['item']['verb'], ['Dislike', ACTIVITY_DISLIKE]))
$verb = (($moderated) ? t('requested to dislike') : t('disliked'));
// "your post"
diff --git a/Zotlabs/Lib/Libzot.php b/Zotlabs/Lib/Libzot.php
index ba75d9fa9..a98ae8f20 100644
--- a/Zotlabs/Lib/Libzot.php
+++ b/Zotlabs/Lib/Libzot.php
@@ -1699,7 +1699,7 @@ class Libzot {
// route checking doesn't work correctly here because we've changed the privacy
$parent[0]['route'] = EMPTY_STR;
// If this is a poll response, convert the obj_type to our (internal-only) "Answer" type
- if ($arr['obj_type'] === ACTIVITY_OBJ_COMMENT && $arr['title'] && (!$arr['body'])) {
+ if (in_array($arr['obj_type'], ['Note', ACTIVITY_OBJ_COMMENT]) && $arr['title'] && (!$arr['body'])) {
$arr['obj_type'] = 'Answer';
}
}
diff --git a/Zotlabs/Lib/Share.php b/Zotlabs/Lib/Share.php
index 81f378d0d..8abbfda80 100644
--- a/Zotlabs/Lib/Share.php
+++ b/Zotlabs/Lib/Share.php
@@ -112,7 +112,7 @@ class Share {
if(! $this->item)
return $bb;
- $is_photo = (($this->item['obj_type'] === ACTIVITY_OBJ_PHOTO) ? true : false);
+ $is_photo = ((in_array($this->item['obj_type'], ['Image', ACTIVITY_OBJ_PHOTO])) ? true : false);
if($is_photo) {
$object = json_decode($this->item['obj'],true);
$photo_bb = $object['body'];
diff --git a/Zotlabs/Lib/ThreadItem.php b/Zotlabs/Lib/ThreadItem.php
index 6b07e32e9..42d76bf17 100644
--- a/Zotlabs/Lib/ThreadItem.php
+++ b/Zotlabs/Lib/ThreadItem.php
@@ -643,7 +643,7 @@ class ThreadItem {
* Only add what will be displayed
*/
- if(activity_match($item->get_data_value('verb'),ACTIVITY_LIKE) || activity_match($item->get_data_value('verb'),ACTIVITY_DISLIKE)) {
+ if(activity_match($item->get_data_value('verb'), ['Like', 'Dislike', ACTIVITY_LIKE, ACTIVITY_DISLIKE])) {
return false;
}
diff --git a/Zotlabs/Lib/ThreadStream.php b/Zotlabs/Lib/ThreadStream.php
index 72d2bd2f8..fb3b6dd9b 100644
--- a/Zotlabs/Lib/ThreadStream.php
+++ b/Zotlabs/Lib/ThreadStream.php
@@ -171,7 +171,7 @@ class ThreadStream {
*/
- if(($item->get_data_value('id') != $item->get_data_value('parent')) && (activity_match($item->get_data_value('verb'),ACTIVITY_LIKE) || activity_match($item->get_data_value('verb'),ACTIVITY_DISLIKE))) {
+ if($item->get_data_value('id') != $item->get_data_value('parent') && activity_match($item->get_data_value('verb'), ['Like', 'Dislike', ACTIVITY_LIKE, ACTIVITY_DISLIKE])) {
return false;
}
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']);
diff --git a/Zotlabs/Widget/Messages.php b/Zotlabs/Widget/Messages.php
index 6e452735a..157b3f535 100644
--- a/Zotlabs/Widget/Messages.php
+++ b/Zotlabs/Widget/Messages.php
@@ -75,16 +75,16 @@ class Messages {
$vnotify_sql_i = '';
if (!($vnotify & VNOTIFY_LIKE)) {
- $vnotify_sql_c = " AND c.verb NOT IN ('" . dbesc(ACTIVITY_LIKE) . "', '" . dbesc(ACTIVITY_DISLIKE) . "') ";
- $vnotify_sql_i = " AND i.verb NOT IN ('" . dbesc(ACTIVITY_LIKE) . "', '" . dbesc(ACTIVITY_DISLIKE) . "') ";
+ $vnotify_sql_c = " AND c.verb NOT IN ('Like', 'Dislike', '" . dbesc(ACTIVITY_LIKE) . "', '" . dbesc(ACTIVITY_DISLIKE) . "') ";
+ $vnotify_sql_i = " AND i.verb NOT IN ('Like', 'Dislike', '" . dbesc(ACTIVITY_LIKE) . "', '" . dbesc(ACTIVITY_DISLIKE) . "') ";
}
elseif (!feature_enabled(local_channel(), 'dislike')) {
- $vnotify_sql_c = " AND c.verb NOT IN ('" . dbesc(ACTIVITY_DISLIKE) . "') ";
- $vnotify_sql_i = " AND i.verb NOT IN ('" . dbesc(ACTIVITY_DISLIKE) . "') ";
+ $vnotify_sql_c = " AND c.verb NOT IN ('Dislike', '" . dbesc(ACTIVITY_DISLIKE) . "') ";
+ $vnotify_sql_i = " AND i.verb NOT IN ('Dislike', '" . dbesc(ACTIVITY_DISLIKE) . "') ";
}
if($author) {
- $author_sql = " AND i.owner_xchan = '" . protect_sprintf(dbesc($author)) . "' ";
+ $author_sql = " AND (i.owner_xchan = '" . protect_sprintf(dbesc($author)) . "' OR i.source_xchan = '" . protect_sprintf(dbesc($author)) . "') ";
}
switch($type) {
@@ -101,11 +101,8 @@ class Messages {
$type_sql = ' AND i.item_private IN (0, 1) ';
}
- // FEP-5624 filter approvals for comments
- $approvals_c = " AND c.verb NOT IN ('" . dbesc(ACTIVITY_ATTEND) . "', 'Accept', '" . dbesc(ACTIVITY_ATTENDNO) . "', 'Reject') ";
-
$items = q("SELECT *,
- (SELECT count(*) FROM item c WHERE c.uid = %d AND c.parent = i.parent AND c.item_unseen = 1 AND c.item_thread_top = 0 $item_normal_c $approvals_c $vnotify_sql_c) AS unseen_count
+ (SELECT count(*) FROM item c WHERE c.uid = %d AND c.parent = i.parent AND c.item_unseen = 1 AND c.item_thread_top = 0 $item_normal_c $vnotify_sql_c) AS unseen_count
FROM item i WHERE i.uid = %d
AND i.created <= '%s'
$type_sql
diff --git a/Zotlabs/Widget/Pinned.php b/Zotlabs/Widget/Pinned.php
index 91a9f45b9..3c6484b36 100644
--- a/Zotlabs/Widget/Pinned.php
+++ b/Zotlabs/Widget/Pinned.php
@@ -225,39 +225,39 @@ class Pinned {
private function activity($item, &$conv_responses) {
foreach(array_keys($conv_responses) as $verb) {
+ $verb_sql = '';
switch($verb) {
case 'like':
- $v = ACTIVITY_LIKE;
+ $verb_sql = " AND verb IN ('Like', '" . ACTIVITY_LIKE . "') ";
break;
case 'dislike':
- $v = ACTIVITY_DISLIKE;
+ $verb_sql = " AND verb IN ('Dislike', '" . ACTIVITY_DISLIKE . "') ";
break;
case 'agree':
- $v = ACTIVITY_AGREE;
+ $verb_sql = " AND verb = '" . ACTIVITY_AGREE . "' ";
break;
case 'disagree':
- $v = ACTIVITY_DISAGREE;
+ $verb_sql = " AND verb = '" . ACTIVITY_DISAGREE . "' ";
break;
case 'abstain':
- $v = ACTIVITY_ABSTAIN;
+ $verb_sql = " AND verb = '" . ACTIVITY_ABSTAIN . "' ";
break;
case 'attendyes':
- $v = ACTIVITY_ATTEND;
+ $verb_sql = " AND verb IN ('Accept', '" . ACTIVITY_ATTEND . "') ";
break;
case 'attendno':
- $v = ACTIVITY_ATTENDNO;
+ $verb_sql = " AND verb IN ('Reject', '" . ACTIVITY_ATTENDNO . "') ";
break;
case 'attendmaybe':
- $v = ACTIVITY_ATTENDMAYBE;
+ $verb_sql = " AND verb IN ('TentativeAccept', '" . ACTIVITY_ATTENDMAYBE . "') ";
break;
default:
break;
}
- $r = q("SELECT * FROM item WHERE parent = %d AND id <> parent AND verb = '%s' AND item_deleted = 0",
- intval($item['id']),
- dbesc($v)
+ $r = q("SELECT * FROM item WHERE parent = %d AND id <> parent $verb_sql AND item_deleted = 0",
+ intval($item['id'])
);
if(! $r) {
unset($conv_responses[$verb]);