diff --git a/app/soapbox/actions/trending_statuses.js b/app/soapbox/actions/trending_statuses.js index b01a3da01..23cf56977 100644 --- a/app/soapbox/actions/trending_statuses.js +++ b/app/soapbox/actions/trending_statuses.js @@ -1,3 +1,5 @@ +import { getFeatures } from 'soapbox/utils/features'; + import api from '../api'; import { importFetchedStatuses } from './importer'; @@ -8,8 +10,13 @@ export const TRENDING_STATUSES_FETCH_FAIL = 'TRENDING_STATUSES_FETCH_FAIL'; export function fetchTrendingStatuses() { return (dispatch, getState) => { + const state = getState(); + + const instance = state.get('instance'); + const features = getFeatures(instance); + dispatch({ type: TRENDING_STATUSES_FETCH_REQUEST }); - return api(getState).get('/api/v1/truth/trending/truths').then(({ data: statuses }) => { + return api(getState).get(features.trendingTruths ? '/api/v1/truth/trending/truths' : '/api/v1/trends/statuses').then(({ data: statuses }) => { dispatch(importFetchedStatuses(statuses)); dispatch({ type: TRENDING_STATUSES_FETCH_SUCCESS, statuses }); return statuses; diff --git a/app/soapbox/utils/features.ts b/app/soapbox/utils/features.ts index 1bb256172..7e5ca16ed 100644 --- a/app/soapbox/utils/features.ts +++ b/app/soapbox/utils/features.ts @@ -123,6 +123,8 @@ const getInstanceFeatures = (instance: Instance) => { v.software === MASTODON && gte(v.compatVersion, '3.2.0'), v.software === PLEROMA && gte(v.version, '2.4.50'), ]), + trendingTruths: v.software === TRUTHSOCIAL, + trendingStatuses: v.software === MASTODON && gte(v.compatVersion, '3.5.0'), }; };