Show avatar for "me"

Make it a shortcut to profile view. Issue #83.
This commit is contained in:
N-Pex 2021-03-04 12:17:21 +01:00
parent b0aea0bd81
commit 999dad0909
6 changed files with 48 additions and 0 deletions

View file

@ -9,6 +9,10 @@
<audio controls :src="src">Audio file</audio>
<QuickReactions :event="event" :reactions="reactions" />
</div>
<v-avatar class="avatar" size="32" color="#ededed" @click.stop="ownAvatarClicked">
<img v-if="userAvatar" :src="userAvatar" />
<span v-else class="white--text headline">{{ userAvatarLetter }}</span>
</v-avatar>
<div class="senderAndTime">
<!-- <div class="sender">{{ "You" }}</div> -->
<div class="time">

View file

@ -9,6 +9,10 @@
<v-img :aspect-ratio="16 / 9" ref="image" :src="src" cover />
<QuickReactions :event="event" :reactions="reactions" />
</div>
<v-avatar class="avatar" size="32" color="#ededed" @click.stop="ownAvatarClicked">
<img v-if="userAvatar" :src="userAvatar" />
<span v-else class="white--text headline">{{ userAvatarLetter }}</span>
</v-avatar>
<div class="senderAndTime">
<!-- <div class="sender">{{ "You" }}</div> -->
<div class="time">

View file

@ -21,6 +21,10 @@
>
</div>
</div>
<v-avatar class="avatar" size="32" color="#ededed" @click.stop="ownAvatarClicked">
<img v-if="userAvatar" :src="userAvatar" />
<span v-else class="white--text headline">{{ userAvatarLetter }}</span>
</v-avatar>
<!-- <div class="sender">{{ "You" }}</div> -->
<div class="senderAndTime">
<div class="time">

View file

@ -124,9 +124,33 @@ export default {
messageClasses() {
return {'messageIn':true,'from-admin':this.senderIsAdminOrModerator(this.event)}
},
userAvatar() {
if (!this.$matrix.userAvatar) {
return null;
}
return this.$matrix.matrixClient.mxcUrlToHttp(
this.$matrix.userAvatar,
80,
80,
"scale",
true
);
},
userAvatarLetter() {
if (!this.$matrix.currentUser) {
return null;
}
return (this.$matrix.userDisplayName || this.$matrix.currentUser.userId.substring(1)).substring(0, 1).toUpperCase();
}
},
methods: {
ownAvatarClicked() {
this.$emit("own-avatar-clicked", {event: this.event});
},
showContextMenu(buttonRef) {
this.$emit("context-menu", {event: this.event,anchor: buttonRef});
},