restore sorting of pinned notes

This commit is contained in:
Hazel K 2024-10-07 16:26:30 -04:00
parent c783ccf8cb
commit 5f435f7250

View file

@ -156,13 +156,13 @@ SPDX-License-Identifier: AGPL-3.0-only
</template> </template>
<MkLazy> <MkLazy>
<div v-if="noteview === 'pinned'" class="_gaps"> <div v-if="noteview === 'pinned'" class="_gaps">
<div v-if="pinnedNotes.length < 1" class="_fullinfo"> <div v-if="user.pinnedNotes.length < 1" class="_fullinfo">
<img :src="infoImageUrl" class="_ghost" aria-hidden="true" :alt="i18n.ts.noNotes"/> <img :src="infoImageUrl" class="_ghost" aria-hidden="true" :alt="i18n.ts.noNotes"/>
<div>{{ i18n.ts.noNotes }}</div> <div>{{ i18n.ts.noNotes }}</div>
</div> </div>
<MkDateSeparatedList v-else v-slot="{ item: note }" :items="pinnedNotes" :noGap="true" :ad="true" class="_panel"> <div v-else class="_panel">
<MkNote :key="note.id" class="note" :note="note" :pinned="true"/> <MkNote v-for="note of user.pinnedNotes" :key="note.id" class="note" :class="$style.pinnedNote" :note="note" :pinned="true"/>
</MkDateSeparatedList> </div>
</div> </div>
<MkNotes v-else :class="$style.tl" :noGap="true" :pagination="AllPagination"/> <MkNotes v-else :class="$style.tl" :noGap="true" :pagination="AllPagination"/>
</MkLazy> </MkLazy>
@ -205,7 +205,6 @@ import { isFollowingVisibleForMe, isFollowersVisibleForMe } from '@/scripts/isFf
import { useRouter } from '@/router/supplier.js'; import { useRouter } from '@/router/supplier.js';
import { getStaticImageUrl } from '@/scripts/media-proxy.js'; import { getStaticImageUrl } from '@/scripts/media-proxy.js';
import { infoImageUrl } from '@/instance.js'; import { infoImageUrl } from '@/instance.js';
import MkDateSeparatedList from '@/components/MkDateSeparatedList.vue';
const MkNote = defineAsyncComponent(() => const MkNote = defineAsyncComponent(() =>
(defaultStore.state.noteDesign === 'misskey') ? import('@/components/MkNote.vue') : (defaultStore.state.noteDesign === 'misskey') ? import('@/components/MkNote.vue') :
@ -255,9 +254,6 @@ const moderationNote = ref(props.user.moderationNote);
const editModerationNote = ref(false); const editModerationNote = ref(false);
const noteview = ref<string | null>(null); const noteview = ref<string | null>(null);
// Sort pinned notes by date to match the other columns and ensure that MkDateSeparatedList does not break.
const pinnedNotes = computed(() => Array.from(user.value.pinnedNotes).sort((a, b) => b.id.localeCompare(a.id)));
const listenbrainzdata = ref(false); const listenbrainzdata = ref(false);
if (props.user.listenbrainz) { if (props.user.listenbrainz) {
(async function() { (async function() {
@ -827,4 +823,8 @@ onUnmounted(() => {
margin-left: 4px; margin-left: 4px;
color: var(--success); color: var(--success);
} }
.pinnedNote:not(:last-child) {
border-bottom: solid 0.5px var(--divider);
}
</style> </style>