Quick fix for pinned post not showing pin

_pinned no longer stored with post, so pinned posts now can't be reactive
This commit is contained in:
Lim Chee Aun 2023-11-07 07:59:59 +08:00
parent 6d5b2ef9a6
commit d16cd501d4
2 changed files with 10 additions and 5 deletions

View file

@ -461,6 +461,7 @@ function TimelineItem({
view,
}) {
const { id: statusID, reblog, items, type, _pinned } = status;
if (_pinned) useItemID = false;
const actualStatusID = reblog?.id || statusID;
const url = instance
? `/${instance}/s/${actualStatusID}`
@ -496,11 +497,12 @@ function TimelineItem({
<li key={`timeline-${statusID}`} class="timeline-item-carousel">
<StatusCarousel title={title} class={`${type}-carousel`}>
{items.map((item) => {
const { id: statusID, reblog } = item;
const { id: statusID, reblog, _pinned } = item;
const actualStatusID = reblog?.id || statusID;
const url = instance
? `/${instance}/s/${actualStatusID}`
: `/s/${actualStatusID}`;
if (_pinned) useItemID = false;
return (
<li key={statusID}>
<Link class="status-carousel-link timeline-item-alt" to={url}>

View file

@ -152,16 +152,19 @@ function AccountStatuses() {
const results = [];
if (firstLoad) {
const { value: pinnedStatuses } = await masto.v1.accounts
const { value } = await masto.v1.accounts
.$select(id)
.statuses.list({
pinned: true,
})
.next();
if (pinnedStatuses?.length && !tagged && !media) {
pinnedStatuses.forEach((status) => {
if (value?.length && !tagged && !media) {
const pinnedStatuses = value.map((status) => {
saveStatus(status, instance);
status._pinned = true;
return {
...status,
_pinned: true,
};
});
if (pinnedStatuses.length >= 3) {
const pinnedStatusesIds = pinnedStatuses.map((status) => status.id);