kopia lustrzana https://github.com/cheeaun/phanpy
Fix pinned posts not appearing
rodzic
96c02ce2e4
commit
b429eaefd7
|
@ -22,6 +22,7 @@ import pmem from '../utils/pmem';
|
||||||
import showToast from '../utils/show-toast';
|
import showToast from '../utils/show-toast';
|
||||||
import states, { saveStatus } from '../utils/states';
|
import states, { saveStatus } from '../utils/states';
|
||||||
import { isMediaFirstInstance } from '../utils/store-utils';
|
import { isMediaFirstInstance } from '../utils/store-utils';
|
||||||
|
import supports from '../utils/supports';
|
||||||
import useTitle from '../utils/useTitle';
|
import useTitle from '../utils/useTitle';
|
||||||
|
|
||||||
const LIMIT = 20;
|
const LIMIT = 20;
|
||||||
|
@ -198,23 +199,26 @@ function AccountStatuses() {
|
||||||
}
|
}
|
||||||
const { value, done } = await accountStatusesIterator.current.next();
|
const { value, done } = await accountStatusesIterator.current.next();
|
||||||
if (value?.length) {
|
if (value?.length) {
|
||||||
// Check if value is same as pinned post (results)
|
if (!supports('@mastodon/pinned-posts')) {
|
||||||
// If the index for every post is the same, means API might not support pinned posts
|
// Check if value is same as pinned post (results)
|
||||||
if (results.length) {
|
// If the index for every post is the same, means API might not support pinned posts
|
||||||
let pinnedStatusesIds = [];
|
// TODO: This is a really weird check, fix this at some point
|
||||||
if (results[0]?.type === 'pinned') {
|
if (results.length) {
|
||||||
pinnedStatusesIds = results[0].id;
|
let pinnedStatusesIds = [];
|
||||||
} else {
|
if (results[0]?.type === 'pinned') {
|
||||||
pinnedStatusesIds = results
|
pinnedStatusesIds = results[0].id;
|
||||||
.filter((status) => status._pinned)
|
} else {
|
||||||
.map((status) => status.id);
|
pinnedStatusesIds = results
|
||||||
}
|
.filter((status) => status._pinned)
|
||||||
const containsAllPinned = pinnedStatusesIds.every((postId) =>
|
.map((status) => status.id);
|
||||||
value.some((status) => status.id === postId),
|
}
|
||||||
);
|
const containsAllPinned = pinnedStatusesIds.every((postId) =>
|
||||||
if (containsAllPinned) {
|
value.some((status) => status.id === postId),
|
||||||
// Remove pinned posts
|
);
|
||||||
results = [];
|
if (containsAllPinned) {
|
||||||
|
// Remove pinned posts
|
||||||
|
results = [];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -20,6 +20,7 @@ const platformFeatures = {
|
||||||
'@mastodon/post-edit': notContainPixelfed,
|
'@mastodon/post-edit': notContainPixelfed,
|
||||||
'@mastodon/profile-edit': notContainPixelfed,
|
'@mastodon/profile-edit': notContainPixelfed,
|
||||||
'@mastodon/profile-private-note': notContainPixelfed,
|
'@mastodon/profile-private-note': notContainPixelfed,
|
||||||
|
'@mastodon/pinned-posts': notContainPixelfed,
|
||||||
'@pixelfed/trending': containPixelfed,
|
'@pixelfed/trending': containPixelfed,
|
||||||
'@pixelfed/home-include-reblogs': containPixelfed,
|
'@pixelfed/home-include-reblogs': containPixelfed,
|
||||||
'@pixelfed/global-feed': containPixelfed,
|
'@pixelfed/global-feed': containPixelfed,
|
||||||
|
|
Ładowanie…
Reference in New Issue