mirror of
https://github.com/friendica/friendica
synced 2024-11-10 09:02:53 +00:00
Avoid a database query when possible
This commit is contained in:
parent
835152d418
commit
eec6cdf01b
1 changed files with 10 additions and 5 deletions
|
@ -4051,13 +4051,18 @@ class Diaspora
|
||||||
*/
|
*/
|
||||||
public static function createCommentSignature(array $item)
|
public static function createCommentSignature(array $item)
|
||||||
{
|
{
|
||||||
$contact = Contact::getById($item['author-id'], ['url']);
|
if (!empty($item['author-link'])) {
|
||||||
if (empty($contact['url'])) {
|
$url = $item['author-link'];
|
||||||
Logger::warning('Author Contact not found', ['author-id' => $item['author-id']]);
|
} else {
|
||||||
return false;
|
$contact = Contact::getById($item['author-id'], ['url']);
|
||||||
|
if (empty($contact['url'])) {
|
||||||
|
Logger::warning('Author Contact not found', ['author-id' => $item['author-id']]);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
$url = $contact['url'];
|
||||||
}
|
}
|
||||||
|
|
||||||
$uid = User::getIdForURL($contact['url']);
|
$uid = User::getIdForURL($url);
|
||||||
if (empty($uid)) {
|
if (empty($uid)) {
|
||||||
Logger::info('No owner post, so not storing signature', ['url' => $contact['url']]);
|
Logger::info('No owner post, so not storing signature', ['url' => $contact['url']]);
|
||||||
return false;
|
return false;
|
||||||
|
|
Loading…
Reference in a new issue