aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorMichael Vogel <icarus@dabo.de>2012-03-18 18:21:51 +0100
committerMichael Vogel <icarus@dabo.de>2012-03-18 18:21:51 +0100
commit77e77027b40c5fc07b249d2b294148312852c673 (patch)
treeb0582fc5845457bf5dc3c820efee313d6f467701 /include
parent6f10142b2e4f65dd17157fee462e17ff370ab903 (diff)
downloadvolse-hubzilla-77e77027b40c5fc07b249d2b294148312852c673.tar.gz
volse-hubzilla-77e77027b40c5fc07b249d2b294148312852c673.tar.bz2
volse-hubzilla-77e77027b40c5fc07b249d2b294148312852c673.zip
API: Now threading seems to work
Diffstat (limited to 'include')
-rwxr-xr-xinclude/api.php16
1 files changed, 12 insertions, 4 deletions
diff --git a/include/api.php b/include/api.php
index 8a84ed1de..5c655990d 100755
--- a/include/api.php
+++ b/include/api.php
@@ -908,22 +908,30 @@
$status_user = (($item['cid']==$user_info['id'])?$user_info: api_item_get_user($a,$item));
if ($item['parent']!=$item['id']) {
+ $r = q("select id from item where parent=%s and id<%s order by id desc limit 1",
+ intval($item['parent']), intval($item['id']));
+ if ($r)
+ $in_reply_to_status_id = $r[0]['id'];
+ else
+ $in_reply_to_status_id = $item['parent'];
- $r = q("select `item`.`contact-id`, `contact`.nick from item, contact
- where `contact`.`id` = `item`.`contact-id` and `item`.id=%d", intval($item['parent']));
+ $r = q("select `item`.`contact-id`, `contact`.nick, `item`.`author-name` from item, contact
+ where `contact`.`id` = `item`.`contact-id` and `item`.id=%d", intval($in_reply_to_status_id));
- $in_reply_to_screen_name = $r[0]['nick'];
+ $in_reply_to_screen_name = $r[0]['author-name'];
$in_reply_to_user_id = $r[0]['contact-id'];
+
} else {
$in_reply_to_screen_name = '';
$in_reply_to_user_id = 0;
+ $in_reply_to_status_id = 0;
}
$status = array(
'text' => html2plain(bbcode($item['body']), 0),
'truncated' => False,
'created_at'=> api_date($item['created']),
- 'in_reply_to_status_id' => ($item['parent']!=$item['id']? intval($item['parent']):''),
+ 'in_reply_to_status_id' => $in_reply_to_status_id,
'source' => (($item['app']) ? $item['app'] : 'web'),
'id' => intval($item['id']),
'in_reply_to_user_id' => $in_reply_to_user_id,