Fix errors introduced by PR #11997

This commit is contained in:
Michael 2022-10-18 18:32:20 +00:00
parent f3abef0979
commit ae82737445
2 changed files with 6 additions and 6 deletions

View file

@ -580,11 +580,11 @@ class Item
public function createSharedPostByUrl(string $url, int $uid = 0, bool $add_media = false): string
{
if (!empty($uid)) {
$id = ModelItem::searchByLink($url, $uid);
$id = ItemModel::searchByLink($url, $uid);
}
if (empty($id)) {
$id = ModelItem::fetchByLink($url);
$id = ItemModel::fetchByLink($url);
}
if (!$id) {
@ -614,7 +614,7 @@ class Item
public function createSharedPostByUriId(int $UriId, int $uid = 0, bool $add_media = false): string
{
$fields = ['uri-id', 'uri', 'body', 'title', 'author-name', 'author-link', 'author-avatar', 'guid', 'created', 'plink', 'network'];
$shared_item = Post::selectFirst($fields, ['uri-id' => $UriId, 'uid' => [$uid, 0], 'private' => [ModelItem::PUBLIC, ModelItem::UNLISTED]]);
$shared_item = Post::selectFirst($fields, ['uri-id' => $UriId, 'uid' => [$uid, 0], 'private' => [ItemModel::PUBLIC, ItemModel::UNLISTED]]);
if (!DBA::isResult($shared_item)) {
Logger::notice('Post does not exist.', ['uri-id' => $UriId, 'uid' => $uid]);
return '';
@ -634,11 +634,11 @@ class Item
public function createSharedPostByGuid(string $guid, int $uid = 0, string $host = '', bool $add_media = false): string
{
$fields = ['uri-id', 'uri', 'body', 'title', 'author-name', 'author-link', 'author-avatar', 'guid', 'created', 'plink', 'network'];
$shared_item = Post::selectFirst($fields, ['guid' => $guid, 'uid' => [$uid, 0], 'private' => [ModelItem::PUBLIC, ModelItem::UNLISTED]]);
$shared_item = Post::selectFirst($fields, ['guid' => $guid, 'uid' => [$uid, 0], 'private' => [ItemModel::PUBLIC, ItemModel::UNLISTED]]);
if (!DBA::isResult($shared_item) && !empty($host) && Diaspora::storeByGuid($guid, $host, true)) {
Logger::debug('Fetched post', ['guid' => $guid, 'host' => $host, 'uid' => $uid]);
$shared_item = Post::selectFirst($fields, ['guid' => $guid, 'uid' => [$uid, 0], 'private' => [ModelItem::PUBLIC, ModelItem::UNLISTED]]);
$shared_item = Post::selectFirst($fields, ['guid' => $guid, 'uid' => [$uid, 0], 'private' => [ItemModel::PUBLIC, ItemModel::UNLISTED]]);
} elseif (DBA::isResult($shared_item)) {
Logger::debug('Found existing post', ['guid' => $guid, 'host' => $host, 'uid' => $uid]);
}

View file

@ -176,7 +176,7 @@ class Status extends BaseProfile
$condition = DBA::mergeConditions($condition, ["((`gravity` = ? AND `wall`) OR
(`gravity` = ? AND `vid` = ? AND `origin`
AND `thr-parent-id` IN (SELECT `uri-id` FROM `post` WHERE `gravity` = ? AND `network` = ?)))",
GRAVITY_PARENT, Item::GRAVITY_ACTIVITY, Verb::getID(Activity::ANNOUNCE), Item::GRAVITY_PARENT, Protocol::ACTIVITYPUB]);
Item::GRAVITY_PARENT, Item::GRAVITY_ACTIVITY, Verb::getID(Activity::ANNOUNCE), Item::GRAVITY_PARENT, Protocol::ACTIVITYPUB]);
$condition = DBA::mergeConditions($condition, ['uid' => $profile['uid'], 'network' => Protocol::FEDERATED,
'visible' => true, 'deleted' => false]);