aboutsummaryrefslogtreecommitdiffstats
path: root/Zotlabs
diff options
context:
space:
mode:
Diffstat (limited to 'Zotlabs')
-rw-r--r--Zotlabs/Daemon/Notifier.php4
-rw-r--r--Zotlabs/Lib/Activity.php90
-rw-r--r--Zotlabs/Lib/ActivityStreams.php2
-rw-r--r--Zotlabs/Lib/Libzot.php15
-rw-r--r--Zotlabs/Module/Activity.php3
-rw-r--r--Zotlabs/Module/Moderate.php4
-rw-r--r--Zotlabs/Module/Photos.php21
7 files changed, 76 insertions, 63 deletions
diff --git a/Zotlabs/Daemon/Notifier.php b/Zotlabs/Daemon/Notifier.php
index b32a047a3..9fdb1defb 100644
--- a/Zotlabs/Daemon/Notifier.php
+++ b/Zotlabs/Daemon/Notifier.php
@@ -346,6 +346,10 @@ class Notifier {
$relay_to_owner = (!$top_level_post && intval($target_item['item_origin']) && comment_local_origin($target_item));
+ if (self::$channel['channel_hash'] === $target_item['owner_xchan']) {
+ $relay_to_owner = false;
+ }
+
// $cmd === 'relay' indicates the owner is sending it to the original recipients
// don't allow the item in the relay command to relay to owner under any circumstances, it will loop
diff --git a/Zotlabs/Lib/Activity.php b/Zotlabs/Lib/Activity.php
index 84b1cb4a2..4e04283ba 100644
--- a/Zotlabs/Lib/Activity.php
+++ b/Zotlabs/Lib/Activity.php
@@ -165,7 +165,7 @@ class Activity {
}
else {
logger('fetch failed: ' . $url);
- logger($x['body']);
+ logger(print_r($x, true), LOGGER_DEBUG);
}
@@ -2117,35 +2117,25 @@ class Activity {
$s['owner_xchan'] = $act->actor['id'];
$s['author_xchan'] = $act->actor['id'];
- $content = [];
+ $s['mid'] = self::getMessageID($act);
- if (is_array($act->obj)) {
- $content = self::get_content($act->obj);
+ if (!$s['mid']) {
+ return false;
}
- $s['mid'] = $act->objprop('id');
+ $s['uuid'] = self::getUUID($act);
- if (!$s['mid'] && is_string($act->obj)) {
- $s['mid'] = $act->obj;
+ if (!$s['uuid']) {
+ // If we have not found anything useful, create an uuid v5 from the mid
+ $s['uuid'] = uuid_from_url($s['mid']);
}
- // pleroma fetched activities
- if (!$s['mid'] && isset($act->obj['data']['id'])) {
- $s['mid'] = $act->obj['data']['id'];
- }
-
- if ($act->objprop('type') === 'Profile') {
- $s['mid'] = $act->id;
- }
+ $content = [];
- if (!$s['mid']) {
- return false;
+ if (is_array($act->obj)) {
+ $content = self::get_content($act->obj);
}
- // Friendica sends the diaspora guid in a nonstandard field via AP
- // If no uuid is provided we will create an uuid v5 from the mid
- $s['uuid'] = (($act->objprop('diaspora:guid')) ?: uuid_from_url($s['mid']));
-
$s['parent_mid'] = $act->parent_id;
if (array_key_exists('published', $act->data)) {
@@ -2184,23 +2174,8 @@ class Activity {
$response_activity = true;
- $s['mid'] = $act->id;
- $s['uuid'] = ((!empty($act->data['diaspora:guid'])) ? $act->data['diaspora:guid'] : uuid_from_url($s['mid']));
-
$s['parent_mid'] = $act->objprop('id') ?: $act->obj;
-/*
- if ($act->objprop('inReplyTo')) {
- $s['parent_mid'] = $act->objprop('inReplyTo');
- }
-
- $s['thr_parent'] = $act->objprop('id') ?: $act->obj;
-
- if (empty($s['parent_mid']) || empty($s['thr_parent'])) {
- logger('response activity without parent_mid or thr_parent');
- return;
- }
-*/
// over-ride the object timestamp with the activity
if (isset($act->data['published'])) {
@@ -2304,6 +2279,11 @@ class Activity {
$s['summary'] = self::bb_content($content, 'summary');
$s['body'] = ((self::bb_content($content, 'bbcode') && (!$response_activity)) ? self::bb_content($content, 'bbcode') : self::bb_content($content, 'content'));
+ // peertube quirks
+ if ($act->objprop('mediaType') === 'text/markdown') {
+ $s['body'] = markdown_to_bb($act->objprop('content'));
+ }
+
if ($act->objprop('quoteUrl')) {
$quote_bbcode = self::get_quote_bbcode($act->obj['quoteUrl']);
@@ -2435,7 +2415,8 @@ class Activity {
}
}
- $tag = (($poster) ? '[video poster="' . $poster . '"]' : '[video]' );
+ $tag = (($poster) ? '[video poster=\'' . $poster . '\']' : '[video]' );
+
$ptr = null;
if ($act->objprop('url')) {
@@ -3838,4 +3819,39 @@ class Activity {
return $result;
}
+
+ /**
+ * @brief Retrieves message ID from activity object.
+ * @param object $act Activity object
+ * @return string Message ID or empty string if not found
+ */
+ public static function getMessageID($act): string
+ {
+ if (ActivityStreams::is_response_activity($act->type) || $act->objprop('type') === 'Profile') {
+ return $act->id;
+ }
+
+ return $act->objprop('id', null)
+ ?? (is_string($act->obj) ? $act->obj : null)
+ ?? '';
+ }
+
+ /**
+ * @brief Retrieves the UUID from an activity object.
+ * @param object $act Activity object
+ * @return string UUID or empty string if not found
+ */
+ public static function getUUID($act): string
+ {
+ if (ActivityStreams::is_response_activity($act->type)) {
+ return $act->data['uuid']
+ ?? $act->data['diaspora:guid']
+ ?? '';
+ }
+
+ return $act->objprop('uuid', null)
+ ?? $act->objprop('diaspora:guid', null)
+ ?? '';
+ }
+
}
diff --git a/Zotlabs/Lib/ActivityStreams.php b/Zotlabs/Lib/ActivityStreams.php
index 55a1de5dd..f2b9050e3 100644
--- a/Zotlabs/Lib/ActivityStreams.php
+++ b/Zotlabs/Lib/ActivityStreams.php
@@ -529,8 +529,8 @@ class ActivityStreams {
public function checkEddsaSignature() {
$signer = $this->get_property_obj('verificationMethod', $this->sig);
-
$parseUrl = parse_url($signer);
+ $publicKey = null;
if (isset($parseUrl['fragment'])) {
if (str_starts_with($parseUrl['fragment'], 'z6Mk')) {
diff --git a/Zotlabs/Lib/Libzot.php b/Zotlabs/Lib/Libzot.php
index 60fb5e034..57c110d8b 100644
--- a/Zotlabs/Lib/Libzot.php
+++ b/Zotlabs/Lib/Libzot.php
@@ -1169,10 +1169,6 @@ class Libzot {
$raw_activity = $AS->data;
$AS = new ActivityStreams($raw_activity['object'], portable_id: $env['sender']);
-
- // Store the original activity id and type for later usage
- $AS->meta['original_id'] = $original_id;
- $AS->meta['original_type'] = $original_type;
}
if (is_array($AS->obj)) {
@@ -1853,19 +1849,12 @@ class Libzot {
dbesc($arr['author_xchan'])
);
- // If we import an add/remove activity ($is_collection_operation) we strip off the
- // add/remove part and only process the object.
- // When looking up the item to pass it to the notifier for relay, we need to look up
- // the original (stripped off) message id which we stored in $act->meta.
-
- $sql_mid = (($is_collection_operation && $relay && $channel['channel_hash'] === $arr['owner_xchan']) ? $act->meta['original_id'] : $arr['mid']);
-
// Reactions such as like and dislike could have an mid with /activity/ in it.
// Check for both forms in order to prevent duplicates.
$r = q("select * from item where mid in ('%s', '%s') and uid = %d limit 1",
- dbesc($sql_mid),
- dbesc(reverse_activity_mid($sql_mid)),
+ dbesc($arr['mid']),
+ dbesc(reverse_activity_mid($arr['mid'])),
intval($channel['channel_id'])
);
diff --git a/Zotlabs/Module/Activity.php b/Zotlabs/Module/Activity.php
index 85b9f3e7c..64da2586b 100644
--- a/Zotlabs/Module/Activity.php
+++ b/Zotlabs/Module/Activity.php
@@ -23,7 +23,7 @@ class Activity extends Controller {
if (! $item_id)
http_status_exit(404, 'Not found');
- $portable_id = EMPTY_STR;
+ $portable_id = null;
$item_normal_extra = sprintf(" and not verb in ('Follow', 'Ignore', '%s', '%s') ",
dbesc(ACTIVITY_FOLLOW),
@@ -166,6 +166,7 @@ class Activity extends Controller {
return;
}
+ $portable_id = null;
$ob_authorize = false;
$item_uid = 0;
diff --git a/Zotlabs/Module/Moderate.php b/Zotlabs/Module/Moderate.php
index 2103684ab..1d8f65348 100644
--- a/Zotlabs/Module/Moderate.php
+++ b/Zotlabs/Module/Moderate.php
@@ -67,7 +67,7 @@ class Moderate extends \Zotlabs\Web\Controller {
$item['item_blocked'] = 0;
item_update_parent_commented($item);
- notice( t('Item approved') . EOL);
+ info(t('Item approved') . EOL);
}
elseif($action === 'drop') {
// TODO: not implemented
@@ -75,7 +75,7 @@ class Moderate extends \Zotlabs\Web\Controller {
// Activity::send_rejection_activity(App::get_channel(), $item['author_xchan'], $item);
drop_item($post_id);
- notice( t('Item deleted') . EOL);
+ info(t('Item deleted') . EOL);
}
// refetch the item after changes have been made
diff --git a/Zotlabs/Module/Photos.php b/Zotlabs/Module/Photos.php
index e31aa9dc1..132c0ce33 100644
--- a/Zotlabs/Module/Photos.php
+++ b/Zotlabs/Module/Photos.php
@@ -557,7 +557,9 @@ class Photos extends \Zotlabs\Web\Controller {
$can_post = false;
$visitor = 0;
-
+ $link_item = null;
+ $like = null;
+ $dislike = null;
$owner_uid = \App::$data['channel']['channel_id'];
$owner_aid = \App::$data['channel']['channel_account_id'];
@@ -965,7 +967,6 @@ class Photos extends \Zotlabs\Web\Controller {
$map = null;
if($linked_items) {
-
xchan_query($linked_items);
$linked_items = fetch_post_tags($linked_items,true);
@@ -1103,9 +1104,6 @@ class Photos extends \Zotlabs\Web\Controller {
$alike = array();
$dlike = array();
- $like = '';
- $dislike = '';
-
$conv_responses = array(
'like' => array('title' => t('Likes','title')),'dislike' => array('title' => t('Dislikes','title')),
'attendyes' => array('title' => t('Attending','title')), 'attendno' => array('title' => t('Not attending','title')), 'attendmaybe' => array('title' => t('Might attend','title'))
@@ -1217,12 +1215,17 @@ class Photos extends \Zotlabs\Web\Controller {
$like_e = $like;
$dislike_e = $dislike;
$paginate = paginate();
+ $responses = [];
- $response_verbs = array('like');
- if(feature_enabled($owner_uid,'dislike'))
- $response_verbs[] = 'dislike';
+ if ($linkitem) {
+ $response_verbs = ['like'];
- $responses = get_responses($conv_responses,$response_verbs,'',$link_item);
+ if(feature_enabled($owner_uid,'dislike')) {
+ $response_verbs[] = 'dislike';
+ }
+
+ $responses = get_responses($conv_responses,$response_verbs,'',$link_item);
+ }
$hookdata = [
'onclick' => '$.colorbox({href: \'' . $photo['href'] . '\'}); return false;',