From 9e6bbb48330369ab59b2a40316a1db6f6d768de9 Mon Sep 17 00:00:00 2001 From: Eliot Berriot <contact@eliotberriot.com> Date: Thu, 7 Mar 2019 11:03:45 +0100 Subject: [PATCH] Fix #729: Display new notifications immediatly on notifications page --- changes/changelog.d/729.bugfix | 1 + front/src/views/Notifications.vue | 17 ++++++++++------- 2 files changed, 11 insertions(+), 7 deletions(-) create mode 100644 changes/changelog.d/729.bugfix diff --git a/changes/changelog.d/729.bugfix b/changes/changelog.d/729.bugfix new file mode 100644 index 00000000..a0209cb9 --- /dev/null +++ b/changes/changelog.d/729.bugfix @@ -0,0 +1 @@ +Display new notifications immediatly on notifications page (#729) diff --git a/front/src/views/Notifications.vue b/front/src/views/Notifications.vue index 98e66694..2ba075b3 100644 --- a/front/src/views/Notifications.vue +++ b/front/src/views/Notifications.vue @@ -1,10 +1,7 @@ <template> <main class="main pusher" v-title="labels.title"> <section class="ui vertical aligned stripe segment"> - <div v-if="isLoading" :class="['ui', {'active': isLoading}, 'inverted', 'dimmer']"> - <div class="ui text loader"><translate>Loading notifications…</translate></div> - </div> - <div v-else class="ui container"> + <div class="ui container"> <h1 class="ui header"><translate>Your notifications</translate></h1> <div class="ui toggle checkbox"> <input v-model="filters.is_read" type="checkbox"> @@ -18,7 +15,12 @@ <translate>Mark all as read</translate> </div> <div class="ui hidden divider" /> - <table v-if="notifications.count > 0" class="ui table"> + + <div v-if="isLoading" :class="['ui', {'active': isLoading}, 'inverted', 'dimmer']"> + <div class="ui text loader"><translate>Loading notifications…</translate></div> + </div> + + <table v-else-if="notifications.count > 0" class="ui table"> <tbody> <notification-row :item="item" v-for="item in notifications.results" :key="item.id" /> </tbody> @@ -42,7 +44,7 @@ export default { data() { return { isLoading: false, - notifications: null, + notifications: {count: 0, results: []}, filters: { is_read: false } @@ -76,7 +78,8 @@ export default { } }, methods: { - handleNewNotification(event) { + handleNewNotification (event) { + this.notifications.count += 1 this.notifications.results.unshift(event.item) }, fetch(params) { -- GitLab