aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMario <mario@mariovavti.com>2021-03-14 09:01:12 +0000
committerMario <mario@mariovavti.com>2021-03-15 08:49:53 +0000
commit4d3524ba9dd155d71969debc5c24198e8bd7b7a1 (patch)
tree5a6ed284c1cff4a9495d769346cc9c922e533231
parent29beea28c2604efcd10e4daa242d7e58bafe59d8 (diff)
downloadvolse-hubzilla-4d3524ba9dd155d71969debc5c24198e8bd7b7a1.tar.gz
volse-hubzilla-4d3524ba9dd155d71969debc5c24198e8bd7b7a1.tar.bz2
volse-hubzilla-4d3524ba9dd155d71969debc5c24198e8bd7b7a1.zip
mod subthread issue continued
(cherry picked from commit b6d30f67345f37dae8dfffd96b065e6139364bcd)
-rw-r--r--Zotlabs/Daemon/Notifier.php6
-rw-r--r--Zotlabs/Lib/Activity.php12
-rw-r--r--Zotlabs/Module/Activity.php17
-rw-r--r--Zotlabs/Module/Item.php14
-rw-r--r--include/items.php10
5 files changed, 50 insertions, 9 deletions
diff --git a/Zotlabs/Daemon/Notifier.php b/Zotlabs/Daemon/Notifier.php
index 02a0e155f..741078422 100644
--- a/Zotlabs/Daemon/Notifier.php
+++ b/Zotlabs/Daemon/Notifier.php
@@ -331,6 +331,12 @@ class Notifier {
return;
}
+ // follow/unfollow is for internal use only
+ if (in_array($target_item['verb'], [ACTIVITY_FOLLOW, ACTIVITY_UNFOLLOW])) {
+ logger('not fowarding follow/unfollow note activity');
+ return;
+ }
+
if (strpos($target_item['postopts'], 'nodeliver') !== false) {
logger('notifier: target item is undeliverable', LOGGER_DEBUG);
return;
diff --git a/Zotlabs/Lib/Activity.php b/Zotlabs/Lib/Activity.php
index 2dabfcceb..24fe5e5c0 100644
--- a/Zotlabs/Lib/Activity.php
+++ b/Zotlabs/Lib/Activity.php
@@ -376,6 +376,8 @@ 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';
@@ -719,7 +721,6 @@ class Activity {
$ret = [];
$reply = false;
-
if ($i['verb'] === ACTIVITY_FRIEND) {
// Hubzilla 'make-friend' activity, no direct mapping from AS1 to AS2 - make it a note
$ret['obj'] = [];
@@ -2095,6 +2096,15 @@ class Activity {
static function decode_note($act) {
+ // Within our family of projects, Follow/Unfollow of a thread is an internal activity which should not be transmitted,
+ // hence if we receive it - ignore or reject it.
+ // Unfollow is not defined by ActivityStreams, which prefers Undo->Follow.
+ // This may have to be revisited if AP projects start using Follow for objects other than actors.
+
+ if (in_array($act->type, [ 'Follow', 'Unfollow' ])) {
+ return false;
+ }
+
$response_activity = false;
$s = [];
diff --git a/Zotlabs/Module/Activity.php b/Zotlabs/Module/Activity.php
index 48f2663cf..2fbc35274 100644
--- a/Zotlabs/Module/Activity.php
+++ b/Zotlabs/Module/Activity.php
@@ -26,7 +26,12 @@ class Activity extends Controller {
$portable_id = EMPTY_STR;
- $item_normal = " and item.item_hidden = 0 and item.item_type = 0 and item.item_unpublished = 0 and item.item_delayed = 0 and item.item_blocked = 0 ";
+ $item_normal_extra = sprintf(" and not verb in ('%s', '%s') ",
+ dbesc(ACTIVITY_FOLLOW),
+ dbesc(ACTIVITY_UNFOLLOW)
+ );
+
+ $item_normal = " and item.item_hidden = 0 and item.item_type = 0 and item.item_unpublished = 0 and item.item_delayed = 0 and item.item_blocked = 0 $item_normal_extra ";
$i = null;
@@ -86,7 +91,7 @@ class Activity extends Controller {
}
$parents_str = ids_to_querystr($i,'item_id');
-
+
$items = q("SELECT item.*, item.id AS item_id FROM item WHERE item.parent IN ( %s ) $item_normal ",
dbesc($parents_str)
);
@@ -197,8 +202,12 @@ class Activity extends Controller {
}
}
- $item_normal = " and item.item_hidden = 0 and item.item_type = 0 and item.item_unpublished = 0
- and item.item_delayed = 0 and item.item_blocked = 0 ";
+ $item_normal_extra = sprintf(" and not verb in ('%s', '%s') ",
+ dbesc(ACTIVITY_FOLLOW),
+ dbesc(ACTIVITY_UNFOLLOW)
+ );
+
+ $item_normal = " and item.item_hidden = 0 and item.item_type = 0 and item.item_unpublished = 0 and item.item_delayed = 0 and item.item_blocked = 0 $item_normal_extra ";
$sigdata = HTTPSig::verify(EMPTY_STR);
if ($sigdata['portable_id'] && $sigdata['header_valid']) {
diff --git a/Zotlabs/Module/Item.php b/Zotlabs/Module/Item.php
index bc35ac452..f9a13a131 100644
--- a/Zotlabs/Module/Item.php
+++ b/Zotlabs/Module/Item.php
@@ -55,7 +55,12 @@ class Item extends Controller {
$portable_id = EMPTY_STR;
- $item_normal = " and item.item_hidden = 0 and item.item_type = 0 and item.item_unpublished = 0 and item.item_delayed = 0 and item.item_blocked = 0 ";
+ $item_normal_extra = sprintf(" and not verb in ('%s', '%s') ",
+ dbesc(ACTIVITY_FOLLOW),
+ dbesc(ACTIVITY_UNFOLLOW)
+ );
+
+ $item_normal = " and item.item_hidden = 0 and item.item_type = 0 and item.item_unpublished = 0 and item.item_delayed = 0 and item.item_blocked = 0 $item_normal_extra ";
$i = null;
@@ -167,7 +172,12 @@ class Item extends Controller {
$portable_id = EMPTY_STR;
- $item_normal = " and item.item_hidden = 0 and item.item_type = 0 and item.item_unpublished = 0 and item.item_delayed = 0 and item.item_blocked = 0 ";
+ $item_normal_extra = sprintf(" and not verb in ('%s', '%s') ",
+ dbesc(ACTIVITY_FOLLOW),
+ dbesc(ACTIVITY_UNFOLLOW)
+ );
+
+ $item_normal = " and item.item_hidden = 0 and item.item_type = 0 and item.item_unpublished = 0 and item.item_delayed = 0 and item.item_blocked = 0 $item_normal_extra ";
$i = null;
diff --git a/include/items.php b/include/items.php
index 9f37af225..5aee7a51c 100644
--- a/include/items.php
+++ b/include/items.php
@@ -4510,6 +4510,13 @@ function items_fetch($arr,$channel = null,$observer_hash = null,$client_mode = C
$item_uids = " item.uid = " . intval($uid) . " ";
}
+ if (! (isset($arr['include_follow']) && intval($arr['include_follow']))) {
+ $sql_options .= sprintf(" and not verb in ('%s', '%s') ",
+ dbesc(ACTIVITY_FOLLOW),
+ dbesc(ACTIVITY_UNFOLLOW)
+ );
+ }
+
if($arr['star'])
$sql_options .= " and item_starred = 1 ";
@@ -4577,7 +4584,7 @@ function items_fetch($arr,$channel = null,$observer_hash = null,$client_mode = C
}
if($channel && intval($arr['compat']) === 1) {
- $sql_extra = " AND author_xchan = '" . $channel['channel_hash'] . "' and item_private = 0 $item_normal ";
+ $sql_extra = " AND author_xchan = '" . $channel['channel_hash'] . "' and item_private = 0 $sql_options $item_normal ";
}
if ($arr['datequery']) {
@@ -4682,7 +4689,6 @@ function items_fetch($arr,$channel = null,$observer_hash = null,$client_mode = C
);
require_once('include/items.php');
-
xchan_query($items);
$items = fetch_post_tags($items,true);