aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMario <mario@mariovavti.com>2020-10-01 12:01:52 +0000
committerMario <mario@mariovavti.com>2020-10-01 12:01:52 +0000
commit869ce64f875dab7acc7833a9fc2d8577b705d35f (patch)
tree6ec9eb38b9549580b1a0b4879de80737536ba069
parent21b71401d3855ecf4ee34888176bb446a1f66b93 (diff)
parent86117c88595cf97a6173fabcb9e3b0d5ec6b1d09 (diff)
downloadvolse-hubzilla-869ce64f875dab7acc7833a9fc2d8577b705d35f.tar.gz
volse-hubzilla-869ce64f875dab7acc7833a9fc2d8577b705d35f.tar.bz2
volse-hubzilla-869ce64f875dab7acc7833a9fc2d8577b705d35f.zip
Merge branch 'dev' into 5.0RC
-rw-r--r--Zotlabs/Lib/Activity.php27
-rw-r--r--Zotlabs/Lib/Libzot.php2
-rw-r--r--include/network.php20
3 files changed, 40 insertions, 9 deletions
diff --git a/Zotlabs/Lib/Activity.php b/Zotlabs/Lib/Activity.php
index 7ad6c91ae..7cc77f124 100644
--- a/Zotlabs/Lib/Activity.php
+++ b/Zotlabs/Lib/Activity.php
@@ -643,8 +643,19 @@ class Activity {
$ret['obj'] = [];
}
+ $ret['type'] = self::activity_mapper($i['verb']);
+
+
+
if (intval($i['item_deleted'])) {
- $ret['type'] = 'Delete';
+ $is_response = false;
+ if (in_array($ret['type'], [ 'Like', 'Dislike', 'Accept', 'Reject', 'TentativeAccept', 'TentativeReject' ])) {
+ $ret['type'] = 'Undo';
+ $is_response = true;
+ }
+ else {
+ $ret['type'] = 'Delete';
+ }
$ret['id'] = str_replace('/item/','/activity/',$i['mid']) . '#delete';
$actor = self::encode_person($i['author'],false);
if ($actor)
@@ -652,7 +663,7 @@ class Activity {
else
return [];
- if ($i['obj']) {
+ if ($i['obj'] && !$is_response) {
if (! is_array($i['obj'])) {
$i['obj'] = json_decode($i['obj'],true);
}
@@ -663,7 +674,7 @@ class Activity {
return [];
}
else {
- $obj = self::encode_item($i,$activitypub);
+ $obj = self::encode_item($i);
if ($obj)
$ret['object'] = $obj;
else
@@ -674,8 +685,6 @@ class Activity {
return $ret;
}
- $ret['type'] = self::activity_mapper($i['verb']);
-
if($ret['type'] === 'emojiReaction') {
// There may not be an object for these items for legacy reasons - it should be the conversation parent.
$p = q("select * from item where mid = '%s' and uid = %d",
@@ -1070,6 +1079,8 @@ class Activity {
'http://purl.org/zot/activity/attendno' => 'Reject',
'http://purl.org/zot/activity/attendmaybe' => 'TentativeAccept',
'Invite' => 'Invite',
+ 'Delete' => 'Delete',
+ 'Undo' => 'Undo'
];
call_hooks('activity_mapper',$acts);
@@ -1117,6 +1128,8 @@ class Activity {
'http://purl.org/zot/activity/attendno' => 'Reject',
'http://purl.org/zot/activity/attendmaybe' => 'TentativeAccept',
'Invite' => 'Invite',
+ 'Delete' => 'Delete',
+ 'Undo' => 'Undo'
];
call_hooks('activity_decode_mapper',$acts);
@@ -2087,12 +2100,10 @@ class Activity {
$s['edited'] = datetime_convert();
}
- if($act->type === 'Tombstone' || $act->type === 'Delete' || ($act->type === 'Create' && $act->obj['type'] === 'Tombstone')) {
+ if(in_array($act->type, [ 'Delete', 'Undo', 'Tombstone' ]) || ($act->type === 'Create' && $act->obj['type'] === 'Tombstone')) {
$s['item_deleted'] = 1;
}
-
-
$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;
diff --git a/Zotlabs/Lib/Libzot.php b/Zotlabs/Lib/Libzot.php
index a6db9e431..87da5ff7a 100644
--- a/Zotlabs/Lib/Libzot.php
+++ b/Zotlabs/Lib/Libzot.php
@@ -2124,8 +2124,8 @@ class Libzot {
dbesc($sender),
dbesc($sender),
dbesc($sender),
- dbesc($item['mid']),
dbesc(str_replace('/activity/', '/item/', $item['mid'])),
+ dbesc(str_replace('/item/', '/activity/', $item['mid'])),
intval($uid)
);
diff --git a/include/network.php b/include/network.php
index d9d534cd7..750d56ac3 100644
--- a/include/network.php
+++ b/include/network.php
@@ -2061,3 +2061,23 @@ function get_request_string($url) {
return '/' . ((count($a) > 3) ? $a[3] : EMPTY_STR);
}
+
+
+/*
+ *
+ * Takes the output of parse_url and builds a URL from it
+ *
+ */
+
+function unparse_url($parsed_url) {
+ $scheme = isset($parsed_url['scheme']) ? $parsed_url['scheme'] . '://' : '';
+ $host = isset($parsed_url['host']) ? $parsed_url['host'] : '';
+ $port = isset($parsed_url['port']) ? ':' . $parsed_url['port'] : '';
+ $user = isset($parsed_url['user']) ? $parsed_url['user'] : '';
+ $pass = isset($parsed_url['pass']) ? ':' . $parsed_url['pass'] : '';
+ $pass = ($user || $pass) ? "$pass@" : '';
+ $path = isset($parsed_url['path']) ? $parsed_url['path'] : '';
+ $query = isset($parsed_url['query']) ? '?' . $parsed_url['query'] : '';
+ $fragment = isset($parsed_url['fragment']) ? '#' . $parsed_url['fragment'] : '';
+ return "$scheme$user$pass$host$port$path$query$fragment";
+}