aboutsummaryrefslogtreecommitdiffstats
path: root/Zotlabs/Lib/Activity.php
diff options
context:
space:
mode:
authorMario <mario@mariovavti.com>2020-10-06 08:25:53 +0000
committerMario <mario@mariovavti.com>2020-10-06 08:25:53 +0000
commitb37c8bf9287efd3ae810560be356ba96848a2573 (patch)
treec094f9a8048992309d11e8075bdb0764c5b9c444 /Zotlabs/Lib/Activity.php
parent923ae14c471221fb3b199894a153eb136c477b65 (diff)
downloadvolse-hubzilla-b37c8bf9287efd3ae810560be356ba96848a2573.tar.gz
volse-hubzilla-b37c8bf9287efd3ae810560be356ba96848a2573.tar.bz2
volse-hubzilla-b37c8bf9287efd3ae810560be356ba96848a2573.zip
code optimisation
Diffstat (limited to 'Zotlabs/Lib/Activity.php')
-rw-r--r--Zotlabs/Lib/Activity.php15
1 files changed, 7 insertions, 8 deletions
diff --git a/Zotlabs/Lib/Activity.php b/Zotlabs/Lib/Activity.php
index 9a31304d1..13ba224cb 100644
--- a/Zotlabs/Lib/Activity.php
+++ b/Zotlabs/Lib/Activity.php
@@ -652,7 +652,7 @@ class Activity {
- static function encode_activity($i, $dismiss_deleted = false) {
+ static function encode_activity($i, $recurse = false) {
$ret = [];
$reply = false;
@@ -666,10 +666,10 @@ class Activity {
$ret['type'] = self::activity_mapper($i['verb']);
$fragment = '';
- if (intval($i['item_deleted']) && !$dismiss_deleted) {
+ if (intval($i['item_deleted']) && !$recurse) {
$is_response = false;
- if (in_array($ret['type'], [ 'Like', 'Dislike', 'Accept', 'Reject', 'TentativeAccept', 'TentativeReject' ])) {
+ if (ActivityStreams::is_response_activity($ret['type'])) {
$ret['type'] = 'Undo';
$fragment = 'undo';
$is_response = true;
@@ -686,12 +686,11 @@ class Activity {
else
return [];
-// $ret['object'] = str_replace('/item/','/activity/',$i['mid']);
-
$obj = (($is_response) ? self::encode_activity($i,true) : self::encode_item($i,true));
if ($obj) {
- // do not leak private content in deletes
- unset($obj['object']);
+ if (array_path_exists('object/id',$obj)) {
+ $obj['object'] = $obj['object']['id'];
+ }
unset($obj['cc']);
$obj['to'] = [ ACTIVITY_PUBLIC_INBOX ];
$ret['object'] = $obj;
@@ -2052,7 +2051,7 @@ class Activity {
$s['expires'] = datetime_convert('UTC','UTC',$act->obj['expires']);
}
- if(in_array($act->type, [ 'Like', 'Dislike', 'Flag', 'Block', 'Announce', 'Accept', 'Reject', 'TentativeAccept', 'emojiReaction' ])) {
+ if(ActivityStreams::is_response_activity($act->type)) {
$response_activity = true;