aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfriendica <info@friendica.com>2015-02-25 16:51:39 -0800
committerfriendica <info@friendica.com>2015-02-25 16:51:39 -0800
commitb9e485be54317b68c994c5ffa3b2ffe21f767775 (patch)
tree7943d75238bfa7549878183e1ff57b109fee8264
parentb32841e2ddc53758957ca3afccb3e045fdf2e9fe (diff)
downloadvolse-hubzilla-b9e485be54317b68c994c5ffa3b2ffe21f767775.tar.gz
volse-hubzilla-b9e485be54317b68c994c5ffa3b2ffe21f767775.tar.bz2
volse-hubzilla-b9e485be54317b68c994c5ffa3b2ffe21f767775.zip
this may actually fix the deliver loop when deleting existing items. It's hackish but I don't see any other way out.
-rwxr-xr-xinclude/items.php15
-rw-r--r--include/notifier.php9
2 files changed, 23 insertions, 1 deletions
diff --git a/include/items.php b/include/items.php
index b7bdad838..d6c6f5043 100755
--- a/include/items.php
+++ b/include/items.php
@@ -4799,3 +4799,18 @@ function set_linkified_perms($linkified, &$str_contact_allow, &$str_group_allow,
}
}
}
+
+
+/*
+ * We can't trust ITEM_ORIGIN to tell us if this is a local comment
+ * which needs to be relayed, because it was misconfigured at one point for several
+ * months and set for some remote items (in alternate delivery chains). This could
+ * cause looping, so use this hackish but accurate method.
+ */
+
+
+function comment_local_origin($item) {
+ if(stripos($item['mid'],get_app()->get_hostname()) && ($item['parent'] != $item['id']))
+ return true;
+ return false;
+} \ No newline at end of file
diff --git a/include/notifier.php b/include/notifier.php
index f64732884..22adc78a3 100644
--- a/include/notifier.php
+++ b/include/notifier.php
@@ -371,7 +371,14 @@ function notifier_run($argv, $argc){
// To clarify, a site accepting a new comment is responsible for sending it to the owner for relay.
// Relaying should never be initiated on a post that arrived from elsewhere.
- $relay_to_owner = (((! $top_level_post) && ($target_item['item_flags'] & ITEM_ORIGIN)) ? true : false);
+ // We should normally be able to rely on ITEM_ORIGIN, but start_delivery_chain() incorrectly set this
+ // flag on comments for an extended period. So we'll also call comment_local_origin() which looks at
+ // the hostname in the message_id and provides a second (fallback) opinion.
+
+ $relay_to_owner = (((! $top_level_post) && ($target_item['item_flags'] & ITEM_ORIGIN) && comment_local_origin())
+ ? true
+ : false
+ );
$uplink = false;