summaryrefslogtreecommitdiff
path: root/src/client/app/desktop
diff options
context:
space:
mode:
authorsyuilo <syuilotan@yahoo.co.jp>2018-05-29 01:22:39 +0900
committersyuilo <syuilotan@yahoo.co.jp>2018-05-29 01:22:39 +0900
commitab16fb3a3fff96a4fa2bc1fc0e56a87c129a4625 (patch)
tree26de7290eede6b42a661f328adce965a889f9887 /src/client/app/desktop
parenttypo (diff)
downloadmisskey-ab16fb3a3fff96a4fa2bc1fc0e56a87c129a4625.tar.gz
misskey-ab16fb3a3fff96a4fa2bc1fc0e56a87c129a4625.tar.bz2
misskey-ab16fb3a3fff96a4fa2bc1fc0e56a87c129a4625.zip
#1634
Diffstat (limited to 'src/client/app/desktop')
-rw-r--r--src/client/app/desktop/views/components/ui.header.notifications.vue39
1 files changed, 5 insertions, 34 deletions
diff --git a/src/client/app/desktop/views/components/ui.header.notifications.vue b/src/client/app/desktop/views/components/ui.header.notifications.vue
index 9eaaa62c61..59a16df9ec 100644
--- a/src/client/app/desktop/views/components/ui.header.notifications.vue
+++ b/src/client/app/desktop/views/components/ui.header.notifications.vue
@@ -1,7 +1,7 @@
<template>
<div class="notifications">
<button :data-active="isOpen" @click="toggle" title="%i18n:@title%">
- %fa:R bell%<template v-if="hasUnreadNotifications">%fa:circle%</template>
+ %fa:R bell%<template v-if="hasUnreadNotification">%fa:circle%</template>
</button>
<div class="pop" v-if="isOpen">
<mk-notifications/>
@@ -16,44 +16,15 @@ import contains from '../../../common/scripts/contains';
export default Vue.extend({
data() {
return {
- isOpen: false,
- hasUnreadNotifications: false,
- connection: null,
- connectionId: null
+ isOpen: false
};
},
- mounted() {
- if (this.$store.getters.isSignedIn) {
- this.connection = (this as any).os.stream.getConnection();
- this.connectionId = (this as any).os.stream.use();
-
- this.connection.on('read_all_notifications', this.onReadAllNotifications);
- this.connection.on('unread_notification', this.onUnreadNotification);
-
- // Fetch count of unread notifications
- (this as any).api('notifications/get_unread_count').then(res => {
- if (res.count > 0) {
- this.hasUnreadNotifications = true;
- }
- });
- }
- },
- beforeDestroy() {
- if (this.$store.getters.isSignedIn) {
- this.connection.off('read_all_notifications', this.onReadAllNotifications);
- this.connection.off('unread_notification', this.onUnreadNotification);
- (this as any).os.stream.dispose(this.connectionId);
+ computed: {
+ hasUnreadNotification(): boolean {
+ return this.$store.getters.isSignedIn && this.$store.state.i.hasUnreadNotification;
}
},
methods: {
- onReadAllNotifications() {
- this.hasUnreadNotifications = false;
- },
-
- onUnreadNotification() {
- this.hasUnreadNotifications = true;
- },
-
toggle() {
this.isOpen ? this.close() : this.open();
},