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): ハイライトするノートがない場合は直近のノートにフォールバックする #113

Merged
merged 3 commits into from
Nov 30, 2023
Merged
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 @@ -34,6 +34,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
Loading