Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(frontend): ハイライトするノートがない場合は直近のノートにフォールバックする #12437

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
- Enhance: 絵文字の詳細ページに記載される情報を追加
- Fix: コードエディタが正しく表示されない問題を修正
- Fix: プロフィールの「ファイル」にセンシティブな画像がある際のデザインを修正
- Fix: ユーザーページでハイライトノートがない場合は直近のノートを表示するように修正
- Fix: 一度に大量の通知が入った際に通知音が音割れする問題を修正
- Fix: 共有機能をサポートしていないブラウザの場合は共有ボタンを非表示にする #11305
- Fix: 通知のグルーピング設定を変更してもリロードされるまで表示が変わらない問題を修正 #12470
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
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>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ここもよしなに変えないと不自然かも

<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 } 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 @@ -213,14 +218,25 @@ 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,
})),
};

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
Loading