diff --git a/src/pages/account-statuses.jsx b/src/pages/account-statuses.jsx index 2cc2351a..d27e1e1c 100644 --- a/src/pages/account-statuses.jsx +++ b/src/pages/account-statuses.jsx @@ -22,6 +22,7 @@ import pmem from '../utils/pmem'; import showToast from '../utils/show-toast'; import states, { saveStatus } from '../utils/states'; import { isMediaFirstInstance } from '../utils/store-utils'; +import supports from '../utils/supports'; import useTitle from '../utils/useTitle'; const LIMIT = 20; @@ -198,23 +199,26 @@ function AccountStatuses() { } const { value, done } = await accountStatusesIterator.current.next(); if (value?.length) { - // Check if value is same as pinned post (results) - // If the index for every post is the same, means API might not support pinned posts - if (results.length) { - let pinnedStatusesIds = []; - if (results[0]?.type === 'pinned') { - pinnedStatusesIds = results[0].id; - } else { - pinnedStatusesIds = results - .filter((status) => status._pinned) - .map((status) => status.id); - } - const containsAllPinned = pinnedStatusesIds.every((postId) => - value.some((status) => status.id === postId), - ); - if (containsAllPinned) { - // Remove pinned posts - results = []; + if (!supports('@mastodon/pinned-posts')) { + // Check if value is same as pinned post (results) + // If the index for every post is the same, means API might not support pinned posts + // TODO: This is a really weird check, fix this at some point + if (results.length) { + let pinnedStatusesIds = []; + if (results[0]?.type === 'pinned') { + pinnedStatusesIds = results[0].id; + } else { + pinnedStatusesIds = results + .filter((status) => status._pinned) + .map((status) => status.id); + } + const containsAllPinned = pinnedStatusesIds.every((postId) => + value.some((status) => status.id === postId), + ); + if (containsAllPinned) { + // Remove pinned posts + results = []; + } } } diff --git a/src/utils/supports.js b/src/utils/supports.js index e240037a..f1a15566 100644 --- a/src/utils/supports.js +++ b/src/utils/supports.js @@ -20,6 +20,7 @@ const platformFeatures = { '@mastodon/post-edit': notContainPixelfed, '@mastodon/profile-edit': notContainPixelfed, '@mastodon/profile-private-note': notContainPixelfed, + '@mastodon/pinned-posts': notContainPixelfed, '@pixelfed/trending': containPixelfed, '@pixelfed/home-include-reblogs': containPixelfed, '@pixelfed/global-feed': containPixelfed,