API: Bugfix for an API result where "in reply to" was equal to the id of the post.

This commit is contained in:
Michael Vogel 2014-07-22 00:33:48 +02:00
parent 5114e018d0
commit f920fa229b

View file

@ -769,7 +769,7 @@
$in_reply_to_status_id_str = NULL; $in_reply_to_status_id_str = NULL;
$in_reply_to_user_id_str = NULL; $in_reply_to_user_id_str = NULL;
$in_reply_to_screen_name = NULL; $in_reply_to_screen_name = NULL;
if ($lastwall['parent']!=$lastwall['id']) { if (intval($lastwall['parent']) != intval($lastwall['id'])) {
$in_reply_to_status_id= intval($lastwall['parent']); $in_reply_to_status_id= intval($lastwall['parent']);
$in_reply_to_status_id_str = (string) intval($lastwall['parent']); $in_reply_to_status_id_str = (string) intval($lastwall['parent']);
@ -784,6 +784,18 @@
} }
} }
// There seems to be situation, where both fields are identical:
// https://github.com/friendica/friendica/issues/1010
// This is a bugfix for that.
if (intval($in_reply_to_status_id) == intval($lastwall['id'])) {
logger('api_status_show: this message should never appear: id: '.$lastwall['id'].' similar to reply-to: '.$in_reply_to_status_id, LOGGER_DEBUG);
$in_reply_to_status_id = NULL;
$in_reply_to_user_id = NULL;
$in_reply_to_status_id_str = NULL;
$in_reply_to_user_id_str = NULL;
$in_reply_to_screen_name = NULL;
}
$status_info = array( $status_info = array(
'text' => trim(html2plain(bbcode(api_clean_plain_items($lastwall['body']), false, false, 2, true), 0)), 'text' => trim(html2plain(bbcode(api_clean_plain_items($lastwall['body']), false, false, 2, true), 0)),
'truncated' => false, 'truncated' => false,