mirror of
https://github.com/friendica/friendica
synced 2024-11-18 10:23:41 +00:00
Fix Mastodon API fav/unfav temporarily by checking if blog in post func
This commit is contained in:
parent
532a46d188
commit
7a556d1588
2 changed files with 10 additions and 4 deletions
|
@ -42,13 +42,16 @@ class Favourite extends BaseApi
|
||||||
DI::mstdnError()->UnprocessableEntity();
|
DI::mstdnError()->UnprocessableEntity();
|
||||||
}
|
}
|
||||||
|
|
||||||
$item = Post::selectOriginalForUser($uid, ['id'], ['uri-id' => $this->parameters['id'], 'uid' => [$uid, 0]]);
|
$item = Post::selectOriginalForUser($uid, ['id', 'uri-id'], ['uri-id' => $this->parameters['id'], 'uid' => [$uid, 0]]);
|
||||||
if (!DBA::isResult($item)) {
|
if (!DBA::isResult($item)) {
|
||||||
DI::mstdnError()->RecordNotFound();
|
DI::mstdnError()->RecordNotFound();
|
||||||
}
|
}
|
||||||
|
|
||||||
Item::performActivity($item['id'], 'like', $uid);
|
Item::performActivity($item['id'], 'like', $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());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,13 +42,16 @@ class Unfavourite extends BaseApi
|
||||||
DI::mstdnError()->UnprocessableEntity();
|
DI::mstdnError()->UnprocessableEntity();
|
||||||
}
|
}
|
||||||
|
|
||||||
$item = Post::selectOriginalForUser($uid, ['id'], ['uri-id' => $this->parameters['id'], 'uid' => [$uid, 0]]);
|
$item = Post::selectOriginalForUser($uid, ['id', 'uri-id'], ['uri-id' => $this->parameters['id'], 'uid' => [$uid, 0]]);
|
||||||
if (!DBA::isResult($item)) {
|
if (!DBA::isResult($item)) {
|
||||||
DI::mstdnError()->RecordNotFound();
|
DI::mstdnError()->RecordNotFound();
|
||||||
}
|
}
|
||||||
|
|
||||||
Item::performActivity($item['id'], 'unlike', $uid);
|
Item::performActivity($item['id'], 'unlike', $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