Merge branch 'dev' of codeberg.org:streams/streams into dev

This commit is contained in:
Mike Macgirvin 2022-12-25 21:21:14 -08:00
commit 9a9b850028

View file

@ -292,10 +292,27 @@ class CommentApproval
protected function get_parent()
{
$result = q("select parent_mid from item where mid = '%s'",
$result = q("select mid, replyto from item where mid = '%s'",
dbesc($this->item['parent_mid'])
);
return $result ? $result[0]['parent_mid'] : '';
if ($result) {
$item = array_shift($result);
if($item['replyto']) {
// Not a Twitter-like platform. Use the conversation parent
return $item['mid'];
}
else {
$result = q("select mid from item where mid = '%s'",
dbesc($this->item['thr_parent'])
);
if ($result) {
// Twitter-like platform. Use the immediate parent
$item = array_shift($result);
return $item['mid'];
}
}
}
return '';
}
}