1
0
Fork 0

Merge pull request #5991 from annando/api-source

API: The source field does now reliably return the correct network name
This commit is contained in:
Hypolite Petovan 2018-10-22 10:52:22 -04:00 committed by GitHub
commit 65f29800ff
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1335,9 +1335,9 @@ function api_status_show($type, $item_id = 0)
}
if ($status_info["source"] == 'web') {
$status_info["source"] = ContactSelector::networkToName($lastwall['network'], $user_info['url']);
} elseif (ContactSelector::networkToName($lastwall['network'], $user_info['url']) != $status_info["source"]) {
$status_info["source"] = trim($status_info["source"].' ('.ContactSelector::networkToName($lastwall['network'], $user_info['url']).')');
$status_info["source"] = ContactSelector::networkToName($lastwall['network'], $lastwall['author-link']);
} elseif (ContactSelector::networkToName($lastwall['network'], $lastwall['author-link']) != $status_info["source"]) {
$status_info["source"] = trim($status_info["source"].' ('.ContactSelector::networkToName($lastwall['network'], $lastwall['author-link']).')');
}
// "uid" and "self" are only needed for some internal stuff, so remove it from here
@ -1410,11 +1410,11 @@ function api_users_show($type)
}
if ($user_info["status"]["source"] == 'web') {
$user_info["status"]["source"] = ContactSelector::networkToName($lastwall['network'], $user_info['url']);
$user_info["status"]["source"] = ContactSelector::networkToName($lastwall['network'], $lastwall['author-link']);
}
if (ContactSelector::networkToName($lastwall['network'], $user_info['url']) != $user_info["status"]["source"]) {
$user_info["status"]["source"] = trim($user_info["status"]["source"] . ' (' . ContactSelector::networkToName($lastwall['network'], $user_info['url']) . ')');
$user_info["status"]["source"] = trim($user_info["status"]["source"] . ' (' . ContactSelector::networkToName($lastwall['network'], $lastwall['author-link']) . ')');
}
}
@ -2912,9 +2912,9 @@ function api_format_items($r, $user_info, $filter_user = false, $type = "json")
}
if ($status["source"] == 'web') {
$status["source"] = ContactSelector::networkToName($item['network'], $user_info['url']);
} elseif (ContactSelector::networkToName($item['network'], $user_info['url']) != $status["source"]) {
$status["source"] = trim($status["source"].' ('.ContactSelector::networkToName($item['network'], $user_info['url']).')');
$status["source"] = ContactSelector::networkToName($item['network'], $item['author-link']);
} elseif (ContactSelector::networkToName($item['network'], $item['author-link']) != $status["source"]) {
$status["source"] = trim($status["source"].' ('.ContactSelector::networkToName($item['network'], $item['author-link']).')');
}
if ($item["id"] == $item["parent"]) {