Avoid a database query when possible
This commit is contained in:
parent
835152d418
commit
eec6cdf01b
|
@ -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 New Issue
Block a user