Swap order of Pleroma/Fedibird emoji probing

Akkoma offers the emoji_reactions field both in
the toplevel and in the pleroma namespace, to
achieve compatibility with fedibird’s frontend.

The current probing order will treat Akkoma as
a Fedibird instance. However, the relevant endpoint
emoji_reactioned_by returning more user details along with
reactions is currently not implemented in Akkoma.
(Only the minimal API viable for the frontend was implemented,
 i.e. currently just the emoji_reations duplication
 and PUT `/api/v1/statuses/:id/emoji_reactions/:emoji`)

Thus this order broke evaluation of emoji reactions for Akkoma
and even if all Fedibird API was implemented, limiting Akkoma
to Fedibird API may give suboptimal results.

However, fortunately this probing is only ever relied upon if the
ApiClient was manually initialised as Mastodon. If (as by default)
autodetect is used, Akkoma gets correctly identified as a
Pleroma variant and the probing-based guess isn’t used.
In practice this issues was likely rarely ever encountered.
This commit is contained in:
Oneric 2023-10-17 05:16:42 +02:00
parent 83d13fb659
commit 30dc06657c

View file

@ -365,10 +365,10 @@ class MastodonApiClient extends ApiClient {
return null;
}
if (response?.some(note => note?.["emoji_reactions"]?.length)) {
this._flavor = MastodonFlavor.FEDIBIRD;
} else if (response?.some(note => note?.["pleroma"]?.["emoji_reactions"]?.length)) {
if (response?.some(note => note?.["pleroma"]?.["emoji_reactions"]?.length)) {
this._flavor = MastodonFlavor.PLEROMA;
} else if (response?.some(note => note?.["emoji_reactions"]?.length)) {
this._flavor = MastodonFlavor.FEDIBIRD;
}
return response.map(note => ({
@ -407,10 +407,10 @@ class MastodonApiClient extends ApiClient {
return null;
}
if (response["descendants"]?.some(note => note?.["emoji_reactions"]?.length)) {
this._flavor = MastodonFlavor.FEDIBIRD;
} else if (response["descendants"]?.some(note => note?.["pleroma"]?.["emoji_reactions"]?.length)) {
if (response["descendants"]?.some(note => note?.["pleroma"]?.["emoji_reactions"]?.length)) {
this._flavor = MastodonFlavor.PLEROMA;
} else if (response["descendants"]?.some(note => note?.["emoji_reactions"]?.length)) {
this._flavor = MastodonFlavor.FEDIBIRD;
}
return response["descendants"].map(note => {