mirror of
https://github.com/friendica/friendica
synced 2024-12-23 02:40:17 +00:00
Merge pull request #12017 from annando/gravity
Fix errors introduced by PR #11997
This commit is contained in:
commit
99d5441007
2 changed files with 6 additions and 6 deletions
|
@ -580,11 +580,11 @@ class Item
|
||||||
public function createSharedPostByUrl(string $url, int $uid = 0, bool $add_media = false): string
|
public function createSharedPostByUrl(string $url, int $uid = 0, bool $add_media = false): string
|
||||||
{
|
{
|
||||||
if (!empty($uid)) {
|
if (!empty($uid)) {
|
||||||
$id = ModelItem::searchByLink($url, $uid);
|
$id = ItemModel::searchByLink($url, $uid);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (empty($id)) {
|
if (empty($id)) {
|
||||||
$id = ModelItem::fetchByLink($url);
|
$id = ItemModel::fetchByLink($url);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$id) {
|
if (!$id) {
|
||||||
|
@ -614,7 +614,7 @@ class Item
|
||||||
public function createSharedPostByUriId(int $UriId, int $uid = 0, bool $add_media = false): string
|
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'];
|
$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)) {
|
if (!DBA::isResult($shared_item)) {
|
||||||
Logger::notice('Post does not exist.', ['uri-id' => $UriId, 'uid' => $uid]);
|
Logger::notice('Post does not exist.', ['uri-id' => $UriId, 'uid' => $uid]);
|
||||||
return '';
|
return '';
|
||||||
|
@ -634,11 +634,11 @@ class Item
|
||||||
public function createSharedPostByGuid(string $guid, int $uid = 0, string $host = '', bool $add_media = false): string
|
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'];
|
$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)) {
|
if (!DBA::isResult($shared_item) && !empty($host) && Diaspora::storeByGuid($guid, $host, true)) {
|
||||||
Logger::debug('Fetched post', ['guid' => $guid, 'host' => $host, 'uid' => $uid]);
|
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)) {
|
} elseif (DBA::isResult($shared_item)) {
|
||||||
Logger::debug('Found existing post', ['guid' => $guid, 'host' => $host, 'uid' => $uid]);
|
Logger::debug('Found existing post', ['guid' => $guid, 'host' => $host, 'uid' => $uid]);
|
||||||
}
|
}
|
||||||
|
|
|
@ -176,7 +176,7 @@ class Status extends BaseProfile
|
||||||
$condition = DBA::mergeConditions($condition, ["((`gravity` = ? AND `wall`) OR
|
$condition = DBA::mergeConditions($condition, ["((`gravity` = ? AND `wall`) OR
|
||||||
(`gravity` = ? AND `vid` = ? AND `origin`
|
(`gravity` = ? AND `vid` = ? AND `origin`
|
||||||
AND `thr-parent-id` IN (SELECT `uri-id` FROM `post` WHERE `gravity` = ? AND `network` = ?)))",
|
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,
|
$condition = DBA::mergeConditions($condition, ['uid' => $profile['uid'], 'network' => Protocol::FEDERATED,
|
||||||
'visible' => true, 'deleted' => false]);
|
'visible' => true, 'deleted' => false]);
|
||||||
|
|
Loading…
Reference in a new issue