Skip to content

Commit

Permalink
(fix) ハイライトがない場合は直近のノートにフォールバック
Browse files Browse the repository at this point in the history
  • Loading branch information
kakkokari-gtyih authored and anatawa12 committed Nov 30, 2023
1 parent 355d468 commit 6181bdb
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 7 deletions.
10 changes: 6 additions & 4 deletions packages/frontend/src/components/MkNotes.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,12 @@ SPDX-License-Identifier: AGPL-3.0-only
<template>
<MkPagination ref="pagingComponent" :pagination="pagination" :disableAutoLoad="disableAutoLoad">
<template #empty>
<div class="_fullinfo">
<img :src="infoImageUrl" class="_ghost"/>
<div>{{ i18n.ts.noNotes }}</div>
</div>
<slot name="empty">
<div class="_fullinfo">
<img :src="infoImageUrl" class="_ghost"/>
<div>{{ i18n.ts.noNotes }}</div>
</div>
</slot>
</template>

<template #default="{ items: notes }">
Expand Down
22 changes: 19 additions & 3 deletions packages/frontend/src/pages/user/home.vue
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,11 @@ SPDX-License-Identifier: AGPL-3.0-only
</template>
<div v-if="!disableNotes">
<div style="margin-bottom: 8px;">{{ i18n.ts.featured }}</div>
<MkNotes :class="$style.tl" :noGap="true" :pagination="pagination"/>
<MkNotes :class="$style.tl" :noGap="true" :pagination="pagination">
<template #empty>
<MkNotes :class="$style.tl" :noGap="true" :pagination="fallbackPagination"></MkNotes>
</template>
</MkNotes>
</div>
</div>
</div>
Expand All @@ -148,6 +152,7 @@ SPDX-License-Identifier: AGPL-3.0-only
<script lang="ts" setup>
import { defineAsyncComponent, computed, onMounted, onUnmounted, nextTick, watch, provide } from 'vue';
import * as Misskey from 'misskey-js';
import type { Paging } from '@/components/MkPagination.vue';
import MkNote from '@/components/MkNote.vue';
import MkFollowButton from '@/components/MkFollowButton.vue';
import MkAccountMoved from '@/components/MkAccountMoved.vue';
Expand Down Expand Up @@ -217,15 +222,26 @@ watch($$(moderationNote), async () => {
await os.api('admin/update-user-note', { userId: props.user.id, text: moderationNote });
});

const pagination = {
endpoint: 'users/featured-notes' as const,
const pagination: Paging = {
endpoint: 'users/featured-notes',
limit: 10,
params: computed(() => ({
userId: props.user.id,
includeSensitiveChannel: $i != null,
})),
};

const fallbackPagination: Paging = {
endpoint: 'users/notes',
limit: 10,
params: computed(() => ({
userId: props.user.id,
withChannelNotes: true,
withRenotes: true,
withReplies: false,
})),
};

const style = $computed(() => {
if (props.user.bannerUrl == null) return {};
return {
Expand Down

0 comments on commit 6181bdb

Please sign in to comment.