Call fetchChannels after marking items as read

master
Peter Stuifzand 5 years ago
parent 63fc43fb27
commit f51f643bfa

@ -58,6 +58,8 @@
return this.$store.dispatch('markRead', {channel: channel, entry: item._id})
.then(() => {
item._is_read = true
}).then(() => {
this.$store.dispatch('fetchChannels')
})
},
handleScroll() {

@ -175,15 +175,20 @@ export default new Vuex.Store({
},
bottomReached() {
let count = 0
this.state.timeline.items.forEach((item) => {
let uids = []
let items = this.state.timeline.items
uids = _.map(_.filter(items, item => !item._is_read), item => item._id)
items.forEach((item) => {
if (item && !item._is_read) {
item._is_read = true
this.dispatch('markRead', {channel: this.state.channel.uid, entry: item._id})
count++;
}
})
if (count > 0) {
this.dispatch('fetchChannels')
this.dispatch('markRead', {channel: this.state.channel.uid, 'entry[]': uids})
.then(() => {
this.dispatch('fetchChannels')
})
}
},
startEventListening({commit}, url) {

Loading…
Cancel
Save