Fix pinned posts not appearing

pull/894/merge
Lim Chee Aun 2025-06-13 15:34:31 +08:00
rodzic 96c02ce2e4
commit b429eaefd7
2 zmienionych plików z 22 dodań i 17 usunięć

Wyświetl plik

@ -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 = [];
}
}
}

Wyświetl plik

@ -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,