TT#129653 Conversations - List filtering is corrupted after performing an action on single item

Change-Id: I52caee7d5f0a6b72c05fe556b6328c7405260c2c
mr10.0
Hans-Peter Herzog 4 years ago
parent 5a3093e837
commit 773edd1524

@ -14,6 +14,7 @@
:icon="tab.icon" :icon="tab.icon"
:label="tab.label" :label="tab.label"
:default="tab.value === selectedTab" :default="tab.value === selectedTab"
:disable="listLoading"
@click="selectTab(tab.value)" @click="selectTab(tab.value)"
/> />
</template> </template>
@ -24,8 +25,8 @@
id="csc-conversations-filter" id="csc-conversations-filter"
v-model="filter" v-model="filter"
class="q-pb-sm" class="q-pb-sm"
:loading="isNextPageRequesting" :loading="listLoading"
:disable="isNextPageRequesting" :disable="listLoading"
@input="filterTab(selectedTab)" @input="filterTab(selectedTab)"
/> />
</template> </template>
@ -37,13 +38,17 @@
<template <template
slot="loading" slot="loading"
> >
<csc-list-spinner <div />
class="q-pa-lg"
/>
</template> </template>
<div <div
class="row justify-center" class="row justify-center"
> >
<div
v-if="listLoading"
class="col-xs-12 col-md-8"
>
<csc-list-spinner />
</div>
<q-list <q-list
v-if="items.length > 0" v-if="items.length > 0"
class="col-xs-12 col-md-8" class="col-xs-12 col-md-8"
@ -68,11 +73,17 @@
/> />
</q-list> </q-list>
<div <div
v-else-if="!isNextPageRequesting && items.length === 0" v-else-if="!listLoading && items.length === 0"
class="q-pa-lg text-center" class="col-xs-12 col-md-8 q-pa-lg text-center"
> >
{{ noResultsMessage }} {{ noResultsMessage }}
</div> </div>
<div
v-if="listLoading && items.length > 0"
class="col-xs-12 col-md-8"
>
<csc-list-spinner />
</div>
<q-page-scroller <q-page-scroller
color="primary" color="primary"
/> />
@ -84,7 +95,7 @@
title-icon-color="negative" title-icon-color="negative"
:title="$t('Remove Voicemail')" :title="$t('Remove Voicemail')"
:message="$t('You are about to remove this Voicemail')" :message="$t('You are about to remove this Voicemail')"
@remove="deleteVoicemail({id:deletionId, tab: selectedTab})" @remove="deleteVoicemailConfirmed({id:deletionId, tab: selectedTab})"
@cancel="deletionId=null" @cancel="deletionId=null"
/> />
</csc-page-sticky-tabs> </csc-page-sticky-tabs>
@ -213,6 +224,9 @@ export default {
} else { } else {
return this.$t('Voicemails') return this.$t('Voicemails')
} }
},
listLoading () {
return this.$wait.is('csc-conversations')
} }
}, },
async mounted () { async mounted () {
@ -222,16 +236,22 @@ export default {
this.$refs.infiniteScroll.poll() this.$refs.infiniteScroll.poll()
}, },
methods: { methods: {
...mapActions('conversations', [
'deleteVoicemail'
]),
loadNextPage (index, done) { loadNextPage (index, done) {
let type = this.selectedTab let type = this.selectedTab
if (this.selectedTab === 'call-fax-voicemail') { if (this.selectedTab === 'call-fax-voicemail') {
type = null type = null
} }
this.startLoader()
this.$store.dispatch('conversations/nextPage', { this.$store.dispatch('conversations/nextPage', {
type: type, type: type,
index: index, index: index,
filter: this.filter, filter: this.filter,
done: done done: done
}).finally(() => {
this.$wait.end('csc-conversations')
}) })
}, },
selectTab (tabName) { selectTab (tabName) {
@ -241,6 +261,7 @@ export default {
}, },
forceTabReload (tabName) { forceTabReload (tabName) {
this.selectedTab = tabName this.selectedTab = tabName
this.startLoader()
this.$store.commit('conversations/resetList') this.$store.commit('conversations/resetList')
this.$refs.infiniteScroll.reset() this.$refs.infiniteScroll.reset()
if (this.reachedLastPage) { if (this.reachedLastPage) {
@ -250,15 +271,12 @@ export default {
this.$refs.infiniteScroll.poll() this.$refs.infiniteScroll.poll()
} }
}, },
forceReload () {
this.forceTabReload(this.selectedTab)
},
filterTab (tabName) { filterTab (tabName) {
this.forceTabReload(tabName) this.forceTabReload(tabName)
}, },
async reload () {
this.$store.commit('conversations/resetList')
},
...mapActions('conversations', [
'deleteVoicemail'
]),
startCall (number) { startCall (number) {
this.$store.commit('call/numberInputChanged', number) this.$store.commit('call/numberInputChanged', number)
this.$router.push('home') this.$router.push('home')
@ -276,15 +294,32 @@ export default {
}) })
}, },
toggleBlockIncoming (options) { toggleBlockIncoming (options) {
this.startLoader()
this.$store.commit('conversations/resetList')
this.$store.dispatch('conversations/toggleBlockIncoming', options).finally(() => { this.$store.dispatch('conversations/toggleBlockIncoming', options).finally(() => {
this.reload() this.forceReload()
}) })
}, },
toggleBlockOutgoing (options) { toggleBlockOutgoing (options) {
this.$store.dispatch('conversations/toggleBlockOutgoing', options) this.startLoader()
this.$store.commit('conversations/resetList')
this.$store.dispatch('conversations/toggleBlockOutgoing', options).finally(() => {
this.forceReload()
})
}, },
toggleBlockBoth (options) { toggleBlockBoth (options) {
this.$store.dispatch('conversations/toggleBlockBoth', options) this.startLoader()
this.$store.commit('conversations/resetList')
this.$store.dispatch('conversations/toggleBlockBoth', options).finally(() => {
this.forceReload()
})
},
deleteVoicemailConfirmed (payload) {
this.startLoader()
this.$store.commit('conversations/resetList')
this.deleteVoicemail(payload).finally(() => {
this.forceReload()
})
}, },
blockedIncoming (item) { blockedIncoming (item) {
if (item.direction === 'out') { if (item.direction === 'out') {
@ -299,6 +334,9 @@ export default {
} else { } else {
return this.isNumberOutgoingBlocked(item.caller) return this.isNumberOutgoingBlocked(item.caller)
} }
},
startLoader () {
this.$wait.start('csc-conversations')
} }
} }
} }

@ -194,9 +194,6 @@ export default {
}).then(() => { }).then(() => {
context.dispatch('getBlockedNumbersIncoming') context.dispatch('getBlockedNumbersIncoming')
context.dispatch('getBlockedNumbersOutgoing') context.dispatch('getBlockedNumbersOutgoing')
}).then(() => {
context.commit('resetList')
context.dispatch('nextPage', null)
}).catch((err) => { }).catch((err) => {
context.commit('toggleBlockedFailed', err.message, options.type) context.commit('toggleBlockedFailed', err.message, options.type)
}) })
@ -206,8 +203,6 @@ export default {
try { try {
await deleteVoicemail(options.id) await deleteVoicemail(options.id)
context.commit('deletionSucceeded') context.commit('deletionSucceeded')
context.commit('resetList')
await context.dispatch('nextPage', options.tab)
} catch (err) { } catch (err) {
context.commit('deletionFailed', err.message) context.commit('deletionFailed', err.message)
} }

Loading…
Cancel
Save