Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[stable29] fix(Quote): add remote server and edited hints in quoted messages #13283

Merged
merged 1 commit into from
Sep 12, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 59 additions & 2 deletions src/components/Quote.vue
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,9 @@
:size="AVATAR.SIZE.EXTRA_SMALL"
disable-menu />
{{ getDisplayName }}
<div v-if="editMessage" class="quote__main__edit-hint">
<span v-if="isFederatedUser" class="quote__main__server">{{ getRemoteServer }}</span>
<span v-if="lastEditTimestamp" class="quote__main__edit">{{ getLastEditor }}</span>
<div v-if="editMessage" class="quote__main__editing-hint">
<PencilIcon :size="20" />
{{ t('spreed', '(editing)') }}
</div>
Expand All @@ -54,7 +56,7 @@
<!-- text -->
<blockquote v-if="!isFileShareWithoutCaption"
class="quote__main__text">
<p dir="auto">{{ shortenedQuoteMessage }}</p>

Check warning on line 59 in src/components/Quote.vue

View workflow job for this annotation

GitHub Actions / NPM lint

Expected 1 line break after opening tag (`<p>`), but no line breaks found

Check warning on line 59 in src/components/Quote.vue

View workflow job for this annotation

GitHub Actions / NPM lint

Expected 1 line break before closing tag (`</p>`), but no line breaks found
</blockquote>
</div>

Expand Down Expand Up @@ -142,6 +144,27 @@
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.
Expand Down Expand Up @@ -192,6 +215,32 @@
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()
Expand Down Expand Up @@ -351,7 +400,15 @@
text-align: start;
}
}
&__edit-hint {

&__edit,
&__server {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}

&__editing-hint {
display: flex;
align-items: center;
gap: 4px;
Expand Down