API: Improvement for Twidere/Conversation call improved

This commit is contained in:
Michael Vogel 2016-04-09 22:44:32 +02:00 committed by Roland Haeder
parent f674795a20
commit a201d5b9cc
No known key found for this signature in database
GPG Key ID: B72F8185C6C7BD78

View File

@ -1524,15 +1524,21 @@
if ($max_id > 0) if ($max_id > 0)
$sql_extra = ' AND `item`.`id` <= '.intval($max_id); $sql_extra = ' AND `item`.`id` <= '.intval($max_id);
// Not sure why this query was so complicated. We should keep it here for a while,
// just to make sure that we really don't need it.
// FROM `item` INNER JOIN (SELECT `uri`,`parent` FROM `item` WHERE `id` = %d) AS `temp1`
// ON (`item`.`thr-parent` = `temp1`.`uri` AND `item`.`parent` = `temp1`.`parent`)
$r = q("SELECT `item`.*, `item`.`id` AS `item_id`, `item`.`network` AS `item_network`, $r = q("SELECT `item`.*, `item`.`id` AS `item_id`, `item`.`network` AS `item_network`,
`contact`.`name`, `contact`.`photo`, `contact`.`url`, `contact`.`rel`, `contact`.`name`, `contact`.`photo`, `contact`.`url`, `contact`.`rel`,
`contact`.`network`, `contact`.`thumb`, `contact`.`dfrn-id`, `contact`.`self`, `contact`.`network`, `contact`.`thumb`, `contact`.`dfrn-id`, `contact`.`self`,
`contact`.`id` AS `cid`, `contact`.`uid` AS `contact-uid` `contact`.`id` AS `cid`, `contact`.`uid` AS `contact-uid`
FROM `item` INNER JOIN (SELECT `uri`,`parent` FROM `item` WHERE `id` = %d) AS `temp1` FROM `item`
ON (`item`.`thr-parent` = `temp1`.`uri` AND `item`.`parent` = `temp1`.`parent`), `contact` INNER JOIN `contact` ON `contact`.`id` = `item`.`contact-id`
WHERE `item`.`visible` = 1 and `item`.`moderated` = 0 AND `item`.`deleted` = 0 WHERE `item`.`parent` = %d AND `item`.`visible`
AND `item`.`uid` = %d AND `item`.`verb` = '%s' AND `contact`.`id` = `item`.`contact-id` AND NOT `item`.`moderated` AND NOT `item`.`deleted`
AND `contact`.`blocked` = 0 AND `contact`.`pending` = 0 AND `item`.`uid` = %d AND `item`.`verb` = '%s'
AND NOT `contact`.`blocked` AND NOT `contact`.`pending`
AND `item`.`id`>%d $sql_extra AND `item`.`id`>%d $sql_extra
ORDER BY `item`.`id` DESC LIMIT %d ,%d", ORDER BY `item`.`id` DESC LIMIT %d ,%d",
intval($id), intval(api_user()), intval($id), intval(api_user()),
@ -2059,6 +2065,10 @@
$statushtml = trim(bbcode($body, false, false)); $statushtml = trim(bbcode($body, false, false));
$search = array("<br>", "<blockquote>", "</blockquote>");
$replace = array("<br>\n", "\n<blockquote>", "</blockquote>\n");
$statushtml = str_replace($search, $replace, $statushtml);
if ($item['title'] != "") if ($item['title'] != "")
$statushtml = "<h4>".bbcode($item['title'])."</h4>\n".$statushtml; $statushtml = "<h4>".bbcode($item['title'])."</h4>\n".$statushtml;