Fix Mastodon API bookmark, mute, pin, reblog EPs temporarily by checking if blog in post func
This commit is contained in:
parent
7a556d1588
commit
b0fe1927d5
8 changed files with 34 additions and 10 deletions
|
@ -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());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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());
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue