Code is simplyfied
This commit is contained in:
parent
3c169b534e
commit
f569ccbbc2
2 changed files with 17 additions and 17 deletions
|
@ -748,8 +748,7 @@ class Item
|
||||||
return $body;
|
return $body;
|
||||||
}
|
}
|
||||||
|
|
||||||
$link = $post['plink'] ?: $post['uri'];
|
$body .= "\n♲ " . ($post['plink'] ?: $post['uri']);
|
||||||
$body .= "\n♲ " . $link;
|
|
||||||
|
|
||||||
return $body;
|
return $body;
|
||||||
}
|
}
|
||||||
|
|
|
@ -3662,24 +3662,26 @@ class Item
|
||||||
$shared_item = Post::selectFirst(['uri-id'], ['guid' => $shared['guid'], 'uid' => [0, $uid]]);
|
$shared_item = Post::selectFirst(['uri-id'], ['guid' => $shared['guid'], 'uid' => [0, $uid]]);
|
||||||
if (!empty($shared_item['uri-id'])) {
|
if (!empty($shared_item['uri-id'])) {
|
||||||
Logger::debug('Found post by guid', ['guid' => $shared['guid'], 'uid' => $uid]);
|
Logger::debug('Found post by guid', ['guid' => $shared['guid'], 'uid' => $uid]);
|
||||||
|
return $shared_item['uri-id'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (empty($shared_item['uri-id']) && !empty($shared['message_id'])) {
|
if (!empty($shared['message_id'])) {
|
||||||
$shared_item = Post::selectFirst(['uri-id'], ['uri' => $shared['message_id'], 'uid' => [0, $uid]]);
|
$shared_item = Post::selectFirst(['uri-id'], ['uri' => $shared['message_id'], 'uid' => [0, $uid]]);
|
||||||
if (!empty($shared_item['uri-id'])) {
|
if (!empty($shared_item['uri-id'])) {
|
||||||
Logger::debug('Found post by message_id', ['message_id' => $shared['message_id'], 'uid' => $uid]);
|
Logger::debug('Found post by message_id', ['message_id' => $shared['message_id'], 'uid' => $uid]);
|
||||||
|
return $shared_item['uri-id'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (empty($shared_item['uri-id']) && !empty($shared['link'])) {
|
if (!empty($shared['link'])) {
|
||||||
$shared_item = Post::selectFirst(['uri-id'], ['plink' => $shared['link'], 'uid' => [0, $uid]]);
|
$shared_item = Post::selectFirst(['uri-id'], ['plink' => $shared['link'], 'uid' => [0, $uid]]);
|
||||||
if (!empty($shared_item['uri-id'])) {
|
if (!empty($shared_item['uri-id'])) {
|
||||||
Logger::debug('Found post by link', ['link' => $shared['link'], 'uid' => $uid]);
|
Logger::debug('Found post by link', ['link' => $shared['link'], 'uid' => $uid]);
|
||||||
|
return $shared_item['uri-id'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (empty($shared_item['uri-id'])) {
|
|
||||||
$url = $shared['message_id'] ?: $shared['link'];
|
$url = $shared['message_id'] ?: $shared['link'];
|
||||||
$id = self::fetchByLink($url);
|
$id = self::fetchByLink($url);
|
||||||
if (!$id) {
|
if (!$id) {
|
||||||
|
@ -3687,13 +3689,12 @@ class Item
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
Logger::debug('Fetched shared post', ['id' => $id, 'url' => $url, 'uid' => $uid]);
|
|
||||||
|
|
||||||
$shared_item = Post::selectFirst(['uri-id'], ['id' => $id]);
|
$shared_item = Post::selectFirst(['uri-id'], ['id' => $id]);
|
||||||
if (!DBA::isResult($shared_item)) {
|
if (!DBA::isResult($shared_item)) {
|
||||||
Logger::warning('Post does not exist.', ['id' => $id, 'url' => $url, 'uid' => $uid]);
|
Logger::warning('Post does not exist.', ['id' => $id, 'url' => $url, 'uid' => $uid]);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
} else {
|
||||||
|
Logger::debug('Fetched shared post', ['id' => $id, 'url' => $url, 'uid' => $uid]);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $shared_item['uri-id'];
|
return $shared_item['uri-id'];
|
||||||
|
|
Loading…
Reference in a new issue