Add initial threaded comments support

This commit is contained in:
Max Kostikov 2019-04-29 23:26:20 +02:00
parent 6db323b15e
commit d9be443e53

View File

@ -329,9 +329,14 @@ class Item extends Controller {
$obj_type = ACTIVITY_OBJ_COMMENT; $obj_type = ACTIVITY_OBJ_COMMENT;
if($parent) { if($parent) {
$r = q("SELECT * FROM item WHERE id = %d LIMIT 1", // Get commented post data
$rr = q("SELECT parent, mid FROM item WHERE id = %d LIMIT 1",
intval($parent) intval($parent)
); );
// and its parent
$r = q("SELECT * FROM item WHERE id = %d LIMIT 1",
intval($rr[0]['parent'])
);
} }
elseif($parent_mid && $uid) { elseif($parent_mid && $uid) {
// This is coming from an API source, and we are logged in // This is coming from an API source, and we are logged in
@ -910,8 +915,7 @@ class Item extends Controller {
} }
if($parent_item) if($parent_item)
$parent_mid = $parent_item['mid']; $parent_mid = $rr[0]['mid'];
// Fallback so that we alway have a thr_parent // Fallback so that we alway have a thr_parent
@ -1160,7 +1164,7 @@ class Item extends Controller {
'verb' => ACTIVITY_POST, 'verb' => ACTIVITY_POST,
'otype' => 'item', 'otype' => 'item',
'parent' => $parent, 'parent' => $parent,
'parent_mid' => $parent_item['mid'] 'parent_mid' => $rr[0]['mid']
)); ));
} }