From: Hank Grabowski Date: Fri, 16 Jun 2023 19:31:39 +0000 (-0400) Subject: Fix Mastodon API bookmark, mute, pin, reblog EPs temporarily by checking if blog... X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=b0fe1927d59b5d7fbc5c293c0356af9b2f966b30;p=friendica.git Fix Mastodon API bookmark, mute, pin, reblog EPs temporarily by checking if blog in post func --- diff --git a/src/Module/Api/Mastodon/Statuses/Bookmark.php b/src/Module/Api/Mastodon/Statuses/Bookmark.php index 59c61f9913..9625b5e122 100644 --- a/src/Module/Api/Mastodon/Statuses/Bookmark.php +++ b/src/Module/Api/Mastodon/Statuses/Bookmark.php @@ -65,6 +65,9 @@ class Bookmark extends BaseApi Item::update(['starred' => true], ['id' => $item['id']]); - System::jsonExit(DI::mstdnStatus()->createFromUriId($this->parameters['id'], $uid, self::appSupportsQuotes())->toArray()); + // @TODO Remove once mstdnStatus()->createFromUriId is fixed + $isReblog = $item['uri-id'] != $this->parameters['id']; + + System::jsonExit(DI::mstdnStatus()->createFromUriId($this->parameters['id'], $uid, self::appSupportsQuotes(), $isReblog)->toArray()); } } diff --git a/src/Module/Api/Mastodon/Statuses/Mute.php b/src/Module/Api/Mastodon/Statuses/Mute.php index 1f00d39d0e..587999bad7 100644 --- a/src/Module/Api/Mastodon/Statuses/Mute.php +++ b/src/Module/Api/Mastodon/Statuses/Mute.php @@ -53,6 +53,9 @@ class Mute extends BaseApi Post\ThreadUser::setIgnored($item['uri-id'], $uid, true); - System::jsonExit(DI::mstdnStatus()->createFromUriId($this->parameters['id'], $uid, self::appSupportsQuotes())->toArray()); + // @TODO Remove once mstdnStatus()->createFromUriId is fixed + $isReblog = $item['uri-id'] != $this->parameters['id']; + + System::jsonExit(DI::mstdnStatus()->createFromUriId($this->parameters['id'], $uid, self::appSupportsQuotes(), $isReblog)->toArray()); } } diff --git a/src/Module/Api/Mastodon/Statuses/Pin.php b/src/Module/Api/Mastodon/Statuses/Pin.php index 33a0116eb1..601f82f2d0 100644 --- a/src/Module/Api/Mastodon/Statuses/Pin.php +++ b/src/Module/Api/Mastodon/Statuses/Pin.php @@ -48,6 +48,9 @@ class Pin extends BaseApi Post\Collection::add($item['uri-id'], Post\Collection::FEATURED, $item['author-id'], $uid); - System::jsonExit(DI::mstdnStatus()->createFromUriId($this->parameters['id'], $uid, self::appSupportsQuotes())->toArray()); + // @TODO Remove once mstdnStatus()->createFromUriId is fixed + $isReblog = $item['uri-id'] != $this->parameters['id']; + + System::jsonExit(DI::mstdnStatus()->createFromUriId($this->parameters['id'], $uid, self::appSupportsQuotes(),$isReblog)->toArray()); } } diff --git a/src/Module/Api/Mastodon/Statuses/Reblog.php b/src/Module/Api/Mastodon/Statuses/Reblog.php index f1922d7271..409f8e788f 100644 --- a/src/Module/Api/Mastodon/Statuses/Reblog.php +++ b/src/Module/Api/Mastodon/Statuses/Reblog.php @@ -45,7 +45,7 @@ class Reblog extends BaseApi DI::mstdnError()->UnprocessableEntity(); } - $item = Post::selectOriginalForUser($uid, ['id', 'network'], ['uri-id' => $this->parameters['id'], 'uid' => [$uid, 0]]); + $item = Post::selectOriginalForUser($uid, ['id', 'uri-id', 'network'], ['uri-id' => $this->parameters['id'], 'uid' => [$uid, 0]]); if (!DBA::isResult($item)) { DI::mstdnError()->RecordNotFound(); } @@ -58,6 +58,9 @@ class Reblog extends BaseApi Item::performActivity($item['id'], 'announce', $uid); } - System::jsonExit(DI::mstdnStatus()->createFromUriId($this->parameters['id'], $uid, self::appSupportsQuotes())->toArray()); + // @TODO Remove once mstdnStatus()->createFromUriId is fixed + $isReblog = $item['uri-id'] != $this->parameters['id']; + + System::jsonExit(DI::mstdnStatus()->createFromUriId($this->parameters['id'], $uid, self::appSupportsQuotes(), $isReblog)->toArray()); } } diff --git a/src/Module/Api/Mastodon/Statuses/Unbookmark.php b/src/Module/Api/Mastodon/Statuses/Unbookmark.php index f95fd9445d..03a3e6f002 100644 --- a/src/Module/Api/Mastodon/Statuses/Unbookmark.php +++ b/src/Module/Api/Mastodon/Statuses/Unbookmark.php @@ -65,6 +65,9 @@ class Unbookmark extends BaseApi Item::update(['starred' => false], ['id' => $item['id']]); - System::jsonExit(DI::mstdnStatus()->createFromUriId($this->parameters['id'], $uid, self::appSupportsQuotes())->toArray()); + // @TODO Remove once mstdnStatus()->createFromUriId is fixed + $isReblog = $item['uri-id'] != $this->parameters['id']; + + System::jsonExit(DI::mstdnStatus()->createFromUriId($this->parameters['id'], $uid, self::appSupportsQuotes(), $isReblog)->toArray()); } } diff --git a/src/Module/Api/Mastodon/Statuses/Unmute.php b/src/Module/Api/Mastodon/Statuses/Unmute.php index 2285422cac..63cd6d722d 100644 --- a/src/Module/Api/Mastodon/Statuses/Unmute.php +++ b/src/Module/Api/Mastodon/Statuses/Unmute.php @@ -53,6 +53,9 @@ class Unmute extends BaseApi Post\ThreadUser::setIgnored($item['uri-id'], $uid, false); - System::jsonExit(DI::mstdnStatus()->createFromUriId($this->parameters['id'], $uid, self::appSupportsQuotes())->toArray()); + // @TODO Remove once mstdnStatus()->createFromUriId is fixed + $isReblog = $item['uri-id'] != $this->parameters['id']; + + System::jsonExit(DI::mstdnStatus()->createFromUriId($this->parameters['id'], $uid, self::appSupportsQuotes(), $isReblog)->toArray()); } } diff --git a/src/Module/Api/Mastodon/Statuses/Unpin.php b/src/Module/Api/Mastodon/Statuses/Unpin.php index c80582d15a..22610f4468 100644 --- a/src/Module/Api/Mastodon/Statuses/Unpin.php +++ b/src/Module/Api/Mastodon/Statuses/Unpin.php @@ -48,6 +48,9 @@ class Unpin extends BaseApi Post\Collection::remove($item['uri-id'], Post\Collection::FEATURED, $uid); - System::jsonExit(DI::mstdnStatus()->createFromUriId($this->parameters['id'], $uid, self::appSupportsQuotes())->toArray()); + // @TODO Remove once mstdnStatus()->createFromUriId is fixed + $isReblog = $item['uri-id'] != $this->parameters['id']; + + System::jsonExit(DI::mstdnStatus()->createFromUriId($this->parameters['id'], $uid, self::appSupportsQuotes(), $isReblog)->toArray()); } } diff --git a/src/Module/Api/Mastodon/Statuses/Unreblog.php b/src/Module/Api/Mastodon/Statuses/Unreblog.php index 54a18823a7..a1544807f1 100644 --- a/src/Module/Api/Mastodon/Statuses/Unreblog.php +++ b/src/Module/Api/Mastodon/Statuses/Unreblog.php @@ -44,7 +44,7 @@ class Unreblog extends BaseApi DI::mstdnError()->UnprocessableEntity(); } - $item = Post::selectOriginalForUser($uid, ['id', 'network'], ['uri-id' => $this->parameters['id'], 'uid' => [$uid, 0]]); + $item = Post::selectOriginalForUser($uid, ['id', 'uri-id', 'network'], ['uri-id' => $this->parameters['id'], 'uid' => [$uid, 0]]); if (!DBA::isResult($item)) { DI::mstdnError()->RecordNotFound(); } @@ -64,6 +64,9 @@ class Unreblog extends BaseApi Item::performActivity($item['id'], 'unannounce', $uid); } - System::jsonExit(DI::mstdnStatus()->createFromUriId($this->parameters['id'], $uid, self::appSupportsQuotes())->toArray()); + // @TODO Remove once mstdnStatus()->createFromUriId is fixed + $isReblog = $item['uri-id'] != $this->parameters['id']; + + System::jsonExit(DI::mstdnStatus()->createFromUriId($this->parameters['id'], $uid, self::appSupportsQuotes(), $isReblog)->toArray()); } }