Merge pull request #3868 from thelounge/xpaw/mentions-fixes

Some fixes in mentions window
This commit is contained in:
Pavel Djundik 2020-04-24 14:07:40 +03:00 committed by GitHub
commit 53bd9c2f68
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 38 additions and 20 deletions

View File

@ -3,7 +3,7 @@
v-if="isOpen" v-if="isOpen"
id="mentions-popup-container" id="mentions-popup-container"
@click="containerClick" @click="containerClick"
@contextmenu.prevent="containerClick" @contextmenu="containerClick"
> >
<div class="mentions-popup"> <div class="mentions-popup">
<div class="mentions-popup-title"> <div class="mentions-popup-title">
@ -15,6 +15,8 @@
</template> </template>
<template v-for="message in resolvedMessages" v-else> <template v-for="message in resolvedMessages" v-else>
<div :key="message.id" :class="['msg', message.type]"> <div :key="message.id" :class="['msg', message.type]">
<div class="mentions-info">
<div>
<span class="from"> <span class="from">
<Username :user="message.from" /> <Username :user="message.from" />
<template v-if="message.channel"> <template v-if="message.channel">
@ -25,14 +27,20 @@
in unknown channel in unknown channel
</template> </template>
</span> </span>
<span :title="message.time | localetime" class="time"> <span :title="message.localetime" class="time">
{{ messageTime(message.time) }} {{ messageTime(message.time) }}
</span> </span>
</div>
<div>
<span class="close-tooltip tooltipped tooltipped-w" aria-label="Close">
<button <button
class="msg-hide" class="msg-hide"
aria-label="Hide this mention" aria-label="Hide this mention"
@click="hideMention(message)" @click="hideMention(message)"
></button> ></button>
</span>
</div>
</div>
<div class="content" dir="auto"> <div class="content" dir="auto">
<ParsedMessage :network="null" :message="message" /> <ParsedMessage :network="null" :message="message" />
</div> </div>
@ -64,6 +72,11 @@
font-size: 20px; font-size: 20px;
} }
.mentions-popup .mentions-info {
display: flex;
justify-content: space-between;
}
.mentions-popup .msg { .mentions-popup .msg {
margin-bottom: 15px; margin-bottom: 15px;
user-select: text; user-select: text;
@ -89,6 +102,10 @@
content: "×"; content: "×";
} }
.mentions-popup .msg-hide:hover {
color: var(--link-color);
}
@media (max-width: 768px) { @media (max-width: 768px) {
.mentions-popup { .mentions-popup {
border-radius: 0; border-radius: 0;
@ -108,6 +125,7 @@
import Username from "./Username.vue"; import Username from "./Username.vue";
import ParsedMessage from "./ParsedMessage.vue"; import ParsedMessage from "./ParsedMessage.vue";
import socket from "../js/socket"; import socket from "../js/socket";
import localetime from "../js/helpers/localetime";
import dayjs from "dayjs"; import dayjs from "dayjs";
import relativeTime from "dayjs/plugin/relativeTime"; import relativeTime from "dayjs/plugin/relativeTime";
@ -130,6 +148,7 @@ export default {
const messages = this.$store.state.mentions.slice().reverse(); const messages = this.$store.state.mentions.slice().reverse();
for (const message of messages) { for (const message of messages) {
message.localetime = localetime(message.time);
message.channel = this.$store.getters.findChannel(message.chanId); message.channel = this.$store.getters.findChannel(message.chanId);
} }

View File

@ -546,7 +546,6 @@ function initializeClient(socket, client, token, lastMessage, openChannel) {
client.mentions.findIndex((m) => m.msgId === msgId), client.mentions.findIndex((m) => m.msgId === msgId),
1 1
); );
// TODO: emit to other clients?
}); });
if (!Helper.config.public) { if (!Helper.config.public) {