Don't mark conversation as read any more on click

When joining a conversation, don't mark it as read any more.
The only moment will be when scrolling down to the bottom of a
conversation and when clearing the read marker, in which case we
immediately update the store.

Signed-off-by: Vincent Petry <vincent@nextcloud.com>
This commit is contained in:
Vincent Petry 2021-02-23 22:27:53 +01:00
Родитель c4e739c9a1
Коммит 6929de8b6c
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: E055D6A4D513575C
7 изменённых файлов: 3 добавлений и 8 удалений

Просмотреть файл

@ -427,7 +427,6 @@ export default {
// this.$store.dispatch('purgeConversationsStore')
this.$store.dispatch('addConversation', response.data.ocs.data)
this.$store.dispatch('markConversationRead', token)
/**
* Emits a global event that is used in App.vue to update the page title once the

Просмотреть файл

@ -264,7 +264,6 @@ export default {
const response = await fetchConversation(this.token)
this.$store.dispatch('addConversation', response.data.ocs.data)
this.$store.dispatch('markConversationRead', this.token)
},
/**

Просмотреть файл

@ -167,7 +167,6 @@ export default {
try {
const response = await fetchConversation(this.token)
this.$store.dispatch('addConversation', response.data.ocs.data)
this.$store.dispatch('markConversationRead', this.token)
// Although the current participant is automatically added to
// the participants store it must be explicitly set in the

Просмотреть файл

@ -203,7 +203,6 @@ export default {
try {
const response = await fetchConversation(this.token)
this.$store.dispatch('addConversation', response.data.ocs.data)
this.$store.dispatch('markConversationRead', this.token)
// Although the current participant is automatically added to
// the participants store it must be explicitly set in the

Просмотреть файл

@ -115,7 +115,6 @@ export default {
}
if (to.name === 'conversation') {
joinConversation(to.params.token)
this.$store.dispatch('markConversationRead', to.params.token)
}
},

Просмотреть файл

@ -442,9 +442,6 @@ export default {
this.$store.dispatch('purgeConversationsStore')
conversations.data.ocs.data.forEach(conversation => {
this.$store.dispatch('addConversation', conversation)
if (conversation.token === this.$store.getters.getToken()) {
this.$store.dispatch('markConversationRead', this.$store.getters.getToken())
}
})
/**
* Emits a global event that is used in App.vue to update the page title once the

Просмотреть файл

@ -332,6 +332,7 @@ const actions = {
}
// set the id to the last message
context.dispatch('updateLastReadMessage', { token, id: conversation.lastMessage.id })
context.dispatch('markConversationRead', token)
},
async updateLastReadMessage(context, { token, id = 0 }) {
@ -343,6 +344,8 @@ const actions = {
// optimistic early commit to avoid indicator flickering
context.commit('updateConversationLastReadMessage', { token, lastReadMessage: id })
await updateLastReadMessage(token, id)
// TODO: update unread counters if possible (otherwise user needs to wait for conversation list refresh)
},
}