mirror of
https://github.com/thelounge/thelounge
synced 2024-11-26 22:10:22 +00:00
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
2 changed files with 16 additions and 1 deletions
|
@ -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 a new issue