aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorzotlabs <mike@macgirvin.com>2017-06-12 21:12:14 -0700
committerMario Vavti <mario@mariovavti.com>2017-06-14 16:55:00 +0200
commit2f8fb2b663c9b1ea1879724d8542654263085b6d (patch)
treece82673bf4bc7f43e25dbf52842b6771fdb99e27
parent5d2035b729d2d0075addf19cbe29536fbff5914a (diff)
downloadvolse-hubzilla-2f8fb2b663c9b1ea1879724d8542654263085b6d.tar.gz
volse-hubzilla-2f8fb2b663c9b1ea1879724d8542654263085b6d.tar.bz2
volse-hubzilla-2f8fb2b663c9b1ea1879724d8542654263085b6d.zip
ostatus is almost unrecognisable these days from its former self. In this case thr:in-reply-to has almost no meaning since it almost never refers to a top level post; which makes it quite difficult to preserve conversations
-rw-r--r--include/feedutils.php18
1 files changed, 15 insertions, 3 deletions
diff --git a/include/feedutils.php b/include/feedutils.php
index 23a065298..22e2b5add 100644
--- a/include/feedutils.php
+++ b/include/feedutils.php
@@ -996,11 +996,23 @@ function consume_feed($xml, $importer, &$contact, $pass = 0) {
dbesc($parent_mid),
intval($importer['channel_id'])
);
- if($x)
- $parent_mid = $x[0]['mid'];
- $datarray['parent_mid'] = $parent_mid;
+ if($x) {
+ $pmid = $x[0]['mid'];
+ $datarray['parent_mid'] = $pmid;
+ }
+ else {
+ // immediate parent wasn't found. Turn into a top-level post if permissions allow
+ // but save the thread_parent in case we need to refer to it later. We should probably
+ // also save the ostatus:conversation_id
+
+ if(! post_is_importable($datarray, $contact))
+ continue;
+ $datarray['parent_mid'] = $datarray['mid'];
+ set_iconfig($datarray,'system','parent_mid',$parent_mid,true);
+ }
+
$datarray['aid'] = $importer['channel_account_id'];
$datarray['uid'] = $importer['channel_id'];