From 3981df7533b25a260948c18711bf42c69f6db95f Mon Sep 17 00:00:00 2001 From: DorraJaouad Date: Thu, 12 Sep 2024 09:42:49 +0200 Subject: [PATCH] fix(Quote): add remote server and edited hints in quoted messages Signed-off-by: DorraJaouad --- src/components/Quote.vue | 61 ++++++++++++++++++++++++++++++++++++++-- 1 file changed, 59 insertions(+), 2 deletions(-) diff --git a/src/components/Quote.vue b/src/components/Quote.vue index 0ebd9455a7f..622c5e28a67 100644 --- a/src/components/Quote.vue +++ b/src/components/Quote.vue @@ -42,7 +42,9 @@ components. :size="AVATAR.SIZE.EXTRA_SMALL" disable-menu /> {{ getDisplayName }} -
+ {{ getRemoteServer }} + {{ getLastEditor }} +
{{ t('spreed', '(editing)') }}
@@ -142,6 +144,27 @@ export default { type: String, default: '', }, + + lastEditActorId: { + type: String, + default: '', + }, + + lastEditActorType: { + type: String, + default: '', + }, + + lastEditActorDisplayName: { + type: String, + default: '', + }, + + lastEditTimestamp: { + type: Number, + default: 0, + }, + /** * If the quote component is used in the `NewMessage` component we display * the remove button. @@ -192,6 +215,32 @@ export default { return displayName }, + isFederatedUser() { + return this.actorType === ATTENDEE.ACTOR_TYPE.FEDERATED_USERS + }, + + getRemoteServer() { + return this.isFederatedUser ? '(' + this.actorId.split('@').pop() + ')' : '' + }, + + getLastEditor() { + if (!this.lastEditTimestamp) { + return '' + } else if (this.lastEditActorId === this.actorId + && this.lastEditActorType === this.actorType) { + // TRANSLATORS Edited by the author of the message themselves + return t('spreed', '(edited)') + } else if (this.lastEditActorId === this.$store.getters.getActorId() + && this.lastEditActorType === this.$store.getters.getActorType()) { + return t('spreed', '(edited by you)') + } else if (this.lastEditActorId === 'deleted_users' + && this.lastEditActorType === 'deleted_users') { + return t('spreed', '(edited by a deleted user)') + } else { + return t('spreed', '(edited by {moderator})', { moderator: this.lastEditActorDisplayName }) + } + }, + isOwnMessageQuoted() { return this.actorId === this.$store.getters.getActorId() && this.actorType === this.$store.getters.getActorType() @@ -351,7 +400,15 @@ export default { text-align: start; } } - &__edit-hint { + + &__edit, + &__server { + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; + } + + &__editing-hint { display: flex; align-items: center; gap: 4px;