Merge branch 'filters-workaround' into 'develop'
Workaround for filtering on latest Mastodon Closes #1043 See merge request soapbox-pub/soapbox-fe!1638
This commit is contained in:
commit
a5b407141d
3 changed files with 17 additions and 1 deletions
|
@ -2,6 +2,7 @@ import { defineMessages } from 'react-intl';
|
||||||
|
|
||||||
import snackbar from 'soapbox/actions/snackbar';
|
import snackbar from 'soapbox/actions/snackbar';
|
||||||
import { isLoggedIn } from 'soapbox/utils/auth';
|
import { isLoggedIn } from 'soapbox/utils/auth';
|
||||||
|
import { getFeatures } from 'soapbox/utils/features';
|
||||||
|
|
||||||
import api from '../api';
|
import api from '../api';
|
||||||
|
|
||||||
|
@ -28,6 +29,12 @@ const fetchFilters = () =>
|
||||||
(dispatch: AppDispatch, getState: () => RootState) => {
|
(dispatch: AppDispatch, getState: () => RootState) => {
|
||||||
if (!isLoggedIn(getState)) return;
|
if (!isLoggedIn(getState)) return;
|
||||||
|
|
||||||
|
const state = getState();
|
||||||
|
const instance = state.instance;
|
||||||
|
const features = getFeatures(instance);
|
||||||
|
|
||||||
|
if (!features.filters) return;
|
||||||
|
|
||||||
dispatch({
|
dispatch({
|
||||||
type: FILTERS_FETCH_REQUEST,
|
type: FILTERS_FETCH_REQUEST,
|
||||||
skipLoading: true,
|
skipLoading: true,
|
||||||
|
|
|
@ -144,6 +144,11 @@ const fixQuote = (status: ImmutableMap<string, any>) => {
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Workaround for not yet implemented filtering from Mastodon 3.6
|
||||||
|
const fixFiltered = (status: ImmutableMap<string, any>) => {
|
||||||
|
status.delete('filtered');
|
||||||
|
};
|
||||||
|
|
||||||
export const normalizeStatus = (status: Record<string, any>) => {
|
export const normalizeStatus = (status: Record<string, any>) => {
|
||||||
return StatusRecord(
|
return StatusRecord(
|
||||||
ImmutableMap(fromJS(status)).withMutations(status => {
|
ImmutableMap(fromJS(status)).withMutations(status => {
|
||||||
|
@ -155,6 +160,7 @@ export const normalizeStatus = (status: Record<string, any>) => {
|
||||||
fixMentionsOrder(status);
|
fixMentionsOrder(status);
|
||||||
addSelfMention(status);
|
addSelfMention(status);
|
||||||
fixQuote(status);
|
fixQuote(status);
|
||||||
|
fixFiltered(status);
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
|
@ -276,7 +276,10 @@ const getInstanceFeatures = (instance: Instance) => {
|
||||||
* Can edit and manage timeline filters (aka "muted words").
|
* Can edit and manage timeline filters (aka "muted words").
|
||||||
* @see {@link https://docs.joinmastodon.org/methods/accounts/filters/}
|
* @see {@link https://docs.joinmastodon.org/methods/accounts/filters/}
|
||||||
*/
|
*/
|
||||||
filters: v.software !== TRUTHSOCIAL,
|
filters: any([
|
||||||
|
v.software === MASTODON && lt(v.compatVersion, '3.6.0'),
|
||||||
|
v.software === PLEROMA,
|
||||||
|
]),
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Allows setting the focal point of a media attachment.
|
* Allows setting the focal point of a media attachment.
|
||||||
|
|
Loading…
Reference in a new issue