aboutsummaryrefslogtreecommitdiffstats
path: root/include/feedutils.php
diff options
context:
space:
mode:
authorzotlabs <mike@macgirvin.com>2017-06-13 18:06:45 -0700
committerMario Vavti <mario@mariovavti.com>2017-06-14 16:55:57 +0200
commit8eccd7d47d300f569ddb06d85f1a38441610d61e (patch)
treedfb86b9866972dcca4115fdbe1028c33005bf563 /include/feedutils.php
parent5530833bf88342bc407375fb9c29b99b2c79e7bc (diff)
downloadvolse-hubzilla-8eccd7d47d300f569ddb06d85f1a38441610d61e.tar.gz
volse-hubzilla-8eccd7d47d300f569ddb06d85f1a38441610d61e.tar.bz2
volse-hubzilla-8eccd7d47d300f569ddb06d85f1a38441610d61e.zip
attempt to group gnu-social and mastodon conversations by ostatus:conversation in addition to falling back on thr:in_reply_to
Diffstat (limited to 'include/feedutils.php')
-rw-r--r--include/feedutils.php35
1 files changed, 25 insertions, 10 deletions
diff --git a/include/feedutils.php b/include/feedutils.php
index 317516c74..156a78a39 100644
--- a/include/feedutils.php
+++ b/include/feedutils.php
@@ -999,20 +999,35 @@ function consume_feed($xml, $importer, &$contact, $pass = 0) {
continue;
}
- $x = q("select mid from item where mid = '%s' and uid = %d limit 1",
- dbesc($parent_mid),
- intval($importer['channel_id'])
- );
-
- if($x) {
- $pmid = $x[0]['mid'];
- $datarray['parent_mid'] = $pmid;
+ $pmid = '';
+ $conv_id = get_iconfig($datarray,'ostatus','conversation');
+
+ if($conv_id) {
+ $c = q("select parent_mid from item left join iconfig on item.id = iconfig.iid where iconfig.cat = 'ostatus' and iconfig.k = 'conversation' and iconfig.v = '%s' and item.uid = %d order by item.id limit 1",
+ dbesc($conv_id),
+ intval($importer['channel_id'])
+ );
+ if($c) {
+ $pmid = $x[0]['parent_mid'];
+ $datarray['parent_mid'] = $pmid;
+ }
}
else {
+ $x = q("select mid from item where mid = '%s' and uid = %d limit 1",
+ dbesc($parent_mid),
+ intval($importer['channel_id'])
+ );
+
+ if($x) {
+ $pmid = $x[0]['mid'];
+ $datarray['parent_mid'] = $pmid;
+ }
+ }
+
+ if(! $pmid) {
// 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
+ // but save the thread_parent in case we need to refer to it later.
if(! post_is_importable($datarray, $contact))
continue;