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>
|
<template>
|
||||||
<div
|
<div
|
||||||
:id="'msg-' + message.id"
|
: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-type="message.type"
|
||||||
:data-from="message.from && message.from.nick"
|
:data-from="message.from && message.from.nick"
|
||||||
>
|
>
|
||||||
@ -87,6 +90,7 @@ export default {
|
|||||||
channel: Object,
|
channel: Object,
|
||||||
network: Object,
|
network: Object,
|
||||||
keepScrollPosition: Function,
|
keepScrollPosition: Function,
|
||||||
|
isPreviousSource: Boolean,
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
messageTime() {
|
messageTime() {
|
||||||
|
@ -46,6 +46,7 @@
|
|||||||
:network="network"
|
:network="network"
|
||||||
:message="message"
|
:message="message"
|
||||||
:keep-scroll-position="keepScrollPosition"
|
:keep-scroll-position="keepScrollPosition"
|
||||||
|
:is-previous-source="isPreviousSource(message, id)"
|
||||||
@linkPreviewToggle="onLinkPreviewToggle"
|
@linkPreviewToggle="onLinkPreviewToggle"
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
@ -212,6 +213,16 @@ export default {
|
|||||||
|
|
||||||
return false;
|
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() {
|
onCopy() {
|
||||||
clipboard(this.$el);
|
clipboard(this.$el);
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user