Skip to content

Commit

Permalink
Merge pull request #3825 from nextcloud/feature/1788/unread-message-m…
Browse files Browse the repository at this point in the history
…arker

Add unread message marker in the chat view
  • Loading branch information
PVince81 committed Mar 9, 2021
2 parents 2a2a43a + c26d5e3 commit ec0d799
Show file tree
Hide file tree
Showing 16 changed files with 610 additions and 164 deletions.
1 change: 0 additions & 1 deletion src/App.vue
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion src/FilesSidebarTabApp.vue
Expand Up @@ -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)
},
/**
Expand Down
1 change: 0 additions & 1 deletion src/PublicShareAuthSidebar.vue
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion src/PublicShareSidebar.vue
Expand Up @@ -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
Expand Down
8 changes: 8 additions & 0 deletions src/components/ChatView.vue
Expand Up @@ -47,6 +47,7 @@
:aria-label="t('spreed', 'Conversation messages')"
:is-chat-scrolled-to-bottom="isChatScrolledToBottom"
:token="token"
:is-visible="isVisible"
@setChatScrolledToBottom="setScrollStatus" />
<NewMessageForm
role="region"
Expand All @@ -70,6 +71,13 @@ export default {
NewMessageForm,
},
props: {
isVisible: {
type: Boolean,
default: true,
},
},
data: function() {
return {
isDraggingOver: false,
Expand Down
9 changes: 9 additions & 0 deletions src/components/LeftSidebar/ConversationsList/Conversation.vue
Expand Up @@ -57,6 +57,11 @@
@click.stop.prevent="copyLinkToConversation">
{{ t('spreed', 'Copy link') }}
</ActionButton>
<ActionButton
:close-after-click="true"
@click.prevent.exact="markConversationAsRead">
{{ t('spreed', 'Mark as read') }}
</ActionButton>

<ActionSeparator />

Expand Down Expand Up @@ -313,6 +318,10 @@ export default {
}
},
markConversationAsRead() {
this.$store.dispatch('clearLastReadMessage', { token: this.item.token })
},
/**
* Deletes the conversation.
*/
Expand Down
Expand Up @@ -115,7 +115,6 @@ export default {
}
if (to.name === 'conversation') {
joinConversation(to.params.token)
this.$store.dispatch('markConversationRead', to.params.token)
}
},
Expand Down
3 changes: 0 additions & 3 deletions src/components/LeftSidebar/LeftSidebar.vue
Expand Up @@ -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
Expand Down

0 comments on commit ec0d799

Please sign in to comment.