mirror of
https://github.com/kokonect-link/cherrypick
synced 2024-12-18 08:38:45 +09:00
fix(frontend): 未読のお知らせの「わかった」をクリック・タップしてもその場で「わかった」が消えない問題を修正 (#11433)
* fix(frontend): 未読のお知らせの「わかった」をクリック・タップしてもその場で「わかった」が消えない問題を修正
* remove comment
* clean up
* ✌️
* add CHANGELOG
This commit is contained in:
parent
a52f63ec6a
commit
bdf390eb7e
@ -19,6 +19,7 @@
|
|||||||
|
|
||||||
### Client
|
### Client
|
||||||
- Fix: サーバー情報画面(`/instance-info/{domain}`)でブロックができないのを修正
|
- Fix: サーバー情報画面(`/instance-info/{domain}`)でブロックができないのを修正
|
||||||
|
- Fix: 未読のお知らせの「わかった」をクリック・タップしてもその場で「わかった」が消えない問題を修正
|
||||||
|
|
||||||
### Server
|
### Server
|
||||||
-
|
-
|
||||||
|
@ -7,15 +7,15 @@ SPDX-License-Identifier: AGPL-3.0-only
|
|||||||
<MkStickyContainer>
|
<MkStickyContainer>
|
||||||
<template #header><MkPageHeader :actions="headerActions" :tabs="headerTabs"/></template>
|
<template #header><MkPageHeader :actions="headerActions" :tabs="headerTabs"/></template>
|
||||||
<MkSpacer :contentMax="800">
|
<MkSpacer :contentMax="800">
|
||||||
<MkPagination v-slot="{items}" :pagination="pagination" class="ruryvtyk _gaps_m">
|
<MkPagination ref="paginationEl" v-slot="{items}" :pagination="pagination" class="ruryvtyk _gaps_m">
|
||||||
<section v-for="(announcement, i) in items" :key="announcement.id" class="announcement _panel">
|
<section v-for="announcement in items" :key="announcement.id" class="announcement _panel">
|
||||||
<div class="header"><span v-if="$i && !announcement.isRead">🆕 </span>{{ announcement.title }}</div>
|
<div class="header"><span v-if="$i && !announcement.isRead">🆕 </span>{{ announcement.title }}</div>
|
||||||
<div class="content">
|
<div class="content">
|
||||||
<Mfm :text="announcement.text"/>
|
<Mfm :text="announcement.text"/>
|
||||||
<img v-if="announcement.imageUrl" :src="announcement.imageUrl"/>
|
<img v-if="announcement.imageUrl" :src="announcement.imageUrl"/>
|
||||||
</div>
|
</div>
|
||||||
<div v-if="$i && !announcement.isRead" class="footer">
|
<div v-if="$i && !announcement.isRead" class="footer">
|
||||||
<MkButton primary @click="read(items, announcement, i)"><i class="ti ti-check"></i> {{ i18n.ts.gotIt }}</MkButton>
|
<MkButton primary @click="read(announcement.id)"><i class="ti ti-check"></i> {{ i18n.ts.gotIt }}</MkButton>
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
</MkPagination>
|
</MkPagination>
|
||||||
@ -24,7 +24,7 @@ SPDX-License-Identifier: AGPL-3.0-only
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { } from 'vue';
|
import { ref } from 'vue';
|
||||||
import MkPagination from '@/components/MkPagination.vue';
|
import MkPagination from '@/components/MkPagination.vue';
|
||||||
import MkButton from '@/components/MkButton.vue';
|
import MkButton from '@/components/MkButton.vue';
|
||||||
import * as os from '@/os';
|
import * as os from '@/os';
|
||||||
@ -37,13 +37,15 @@ const pagination = {
|
|||||||
limit: 10,
|
limit: 10,
|
||||||
};
|
};
|
||||||
|
|
||||||
// TODO: これは実質的に親コンポーネントから子コンポーネントのプロパティを変更してるのでなんとかしたい
|
const paginationEl = ref<InstanceType<typeof MkPagination>>();
|
||||||
function read(items, announcement, i) {
|
|
||||||
items[i] = {
|
function read(id: string) {
|
||||||
...announcement,
|
if (!paginationEl.value) return;
|
||||||
isRead: true,
|
paginationEl.value.updateItem(id, announcement => {
|
||||||
};
|
announcement.isRead = true;
|
||||||
os.api('i/read-announcement', { announcementId: announcement.id });
|
return announcement;
|
||||||
|
});
|
||||||
|
os.api('i/read-announcement', { announcementId: id });
|
||||||
}
|
}
|
||||||
|
|
||||||
const headerActions = $computed(() => []);
|
const headerActions = $computed(() => []);
|
||||||
|
Loading…
Reference in New Issue
Block a user