Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add unread message marker in the chat view #3825

Merged
merged 17 commits into from Mar 9, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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