Skip to content

Commit

Permalink
fix(frontend): ハイライトするノートがない場合は直近のノートにフォールバックする (misskey-dev#12437) (#…
Browse files Browse the repository at this point in the history
…113)

* (fix) ハイライトがない場合は直近のノートにフォールバック

* Update Changelog

* chore: 使われていないincludeSensitiveChannel指定を削除

---------

Co-authored-by: kakkokari-gtyih <[email protected]>
  • Loading branch information
anatawa12 and kakkokari-gtyih authored Nov 30, 2023
1 parent 0b3571e commit 001d244
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 8 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
- リアクションの横幅を150pxに制限するかどうかユーザーが選べるように
- Fix: ハードミュートにノート引っかかるとエラーが発生しTLが更新されないことがある問題
- Fix: 絵文字入力時のサジェストがおかしい
- Fix: ユーザーページでハイライトノートがない場合は直近のノートを表示するように修正

### Server

Expand Down
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
23 changes: 19 additions & 4 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,12 +222,22 @@ 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,
})),
};

Expand Down

0 comments on commit 001d244

Please sign in to comment.