Skip to content
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions src/components/MessagesList/MessagesGroup/Message/Message.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -424,6 +424,7 @@ describe('Message.vue', () => {

test('displays unread message marker that marks the message seen when visible', () => {
messageProps.lastReadMessageId = 123
messageProps.nextMessageId = 333
const observeVisibility = jest.fn()

const wrapper = shallowMount(Message, {
Expand Down Expand Up @@ -453,6 +454,24 @@ describe('Message.vue', () => {
directiveValue.value(false)
expect(wrapper.vm.seen).toEqual(true)
})

test('does not display read marker on the very last message', () => {
messageProps.lastReadMessageId = 123
messageProps.nextMessageId = null // last message
const observeVisibility = jest.fn()

const wrapper = shallowMount(Message, {
localVue,
store,
directives: {
observeVisibility,
},
propsData: messageProps,
})

const marker = wrapper.find('.new-message-marker')
expect(marker.exists()).toBe(false)
})
})

describe('author rendering', () => {
Expand Down
4 changes: 4 additions & 0 deletions src/components/MessagesList/MessagesGroup/Message/Message.vue
Original file line number Diff line number Diff line change
Expand Up @@ -402,6 +402,10 @@ export default {

computed: {
isLastReadMessage() {
if (!this.nextMessageId) {
// never display indicator on the very last message
return false
}
// note: not reading lastReadMessage from the conversation as we want to define it externally
// to have closer control on marker's visibility behavior
return this.id === this.lastReadMessageId
Expand Down