Merge pull request #3534 from thelounge/richrd/issue-659-previous-source
Add `previous-source` class to messages with same sender
This commit is contained in:
commit
bc6017aed7
@ -1,7 +1,10 @@
|
||||
<template>
|
||||
<div
|
||||
:id="'msg-' + message.id"
|
||||
:class="['msg', {self: message.self, highlight: message.highlight}]"
|
||||
:class="[
|
||||
'msg',
|
||||
{self: message.self, highlight: message.highlight, 'previous-source': isPreviousSource},
|
||||
]"
|
||||
:data-type="message.type"
|
||||
:data-from="message.from && message.from.nick"
|
||||
>
|
||||
@ -87,6 +90,7 @@ export default {
|
||||
channel: Object,
|
||||
network: Object,
|
||||
keepScrollPosition: Function,
|
||||
isPreviousSource: Boolean,
|
||||
},
|
||||
computed: {
|
||||
messageTime() {
|
||||
|
@ -46,6 +46,7 @@
|
||||
:network="network"
|
||||
:message="message"
|
||||
:keep-scroll-position="keepScrollPosition"
|
||||
:is-previous-source="isPreviousSource(message, id)"
|
||||
@linkPreviewToggle="onLinkPreviewToggle"
|
||||
/>
|
||||
</template>
|
||||
@ -212,6 +213,16 @@ export default {
|
||||
|
||||
return false;
|
||||
},
|
||||
isPreviousSource(currentMessage, id) {
|
||||
const previousMessage = this.condensedMessages[id - 1];
|
||||
return (
|
||||
previousMessage &&
|
||||
currentMessage.type === "message" &&
|
||||
previousMessage.type === "message" &&
|
||||
previousMessage.from &&
|
||||
currentMessage.from.nick === previousMessage.from.nick
|
||||
);
|
||||
},
|
||||
onCopy() {
|
||||
clipboard(this.$el);
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user