summaryrefslogtreecommitdiff
path: root/packages/client/src/components
diff options
context:
space:
mode:
authortamaina <tamaina@hotmail.co.jp>2022-05-01 15:08:25 +0900
committerGitHub <noreply@github.com>2022-05-01 15:08:25 +0900
commitc5048ee9935869e793bc941fda326d83d18ebbe8 (patch)
tree5c1df069741ecbd3548a702da683baf53d3bae5c /packages/client/src/components
parentressurect deepcopy (diff)
parentrefactor(client): refactor import-export to use Composition API (#8579) (diff)
downloadmisskey-c5048ee9935869e793bc941fda326d83d18ebbe8.tar.gz
misskey-c5048ee9935869e793bc941fda326d83d18ebbe8.tar.bz2
misskey-c5048ee9935869e793bc941fda326d83d18ebbe8.zip
Merge branch 'develop' into pizzax-indexeddb
Diffstat (limited to 'packages/client/src/components')
-rw-r--r--packages/client/src/components/notification.vue6
-rw-r--r--packages/client/src/components/notifications.vue25
-rw-r--r--packages/client/src/components/ui/pagination.vue1
3 files changed, 31 insertions, 1 deletions
diff --git a/packages/client/src/components/notification.vue b/packages/client/src/components/notification.vue
index 1a360f9905..3791c576ee 100644
--- a/packages/client/src/components/notification.vue
+++ b/packages/client/src/components/notification.vue
@@ -72,7 +72,7 @@
</template>
<script lang="ts">
-import { defineComponent, ref, onMounted, onUnmounted } from 'vue';
+import { defineComponent, ref, onMounted, onUnmounted, watch } from 'vue';
import * as misskey from 'misskey-js';
import { getNoteSummary } from '@/scripts/get-note-summary';
import XReactionIcon from './reaction-icon.vue';
@@ -126,6 +126,10 @@ export default defineComponent({
const connection = stream.useChannel('main');
connection.on('readAllNotifications', () => readObserver.disconnect());
+ watch(props.notification.isRead, () => {
+ readObserver.disconnect();
+ });
+
onUnmounted(() => {
readObserver.disconnect();
connection.dispose();
diff --git a/packages/client/src/components/notifications.vue b/packages/client/src/components/notifications.vue
index d522503a14..dc900a670d 100644
--- a/packages/client/src/components/notifications.vue
+++ b/packages/client/src/components/notifications.vue
@@ -64,6 +64,31 @@ const onNotification = (notification) => {
onMounted(() => {
const connection = stream.useChannel('main');
connection.on('notification', onNotification);
+ connection.on('readAllNotifications', () => {
+ if (pagingComponent.value) {
+ for (const item of pagingComponent.value.queue) {
+ item.isRead = true;
+ }
+ for (const item of pagingComponent.value.items) {
+ item.isRead = true;
+ }
+ }
+ });
+ connection.on('readNotifications', notificationIds => {
+ if (pagingComponent.value) {
+ for (let i = 0; i < pagingComponent.value.queue.length; i++) {
+ if (notificationIds.includes(pagingComponent.value.queue[i].id)) {
+ pagingComponent.value.queue[i].isRead = true;
+ }
+ }
+ for (let i = 0; i < (pagingComponent.value.items || []).length; i++) {
+ if (notificationIds.includes(pagingComponent.value.items[i].id)) {
+ pagingComponent.value.items[i].isRead = true;
+ }
+ }
+ }
+ });
+
onUnmounted(() => {
connection.dispose();
});
diff --git a/packages/client/src/components/ui/pagination.vue b/packages/client/src/components/ui/pagination.vue
index 13f3215671..ac6f59c332 100644
--- a/packages/client/src/components/ui/pagination.vue
+++ b/packages/client/src/components/ui/pagination.vue
@@ -270,6 +270,7 @@ onDeactivated(() => {
defineExpose({
items,
+ queue,
backed,
reload,
fetchMoreAhead,