UI Fixes and DeviceList changes

This commit is contained in:
N-Pex 2025-05-12 18:21:48 +02:00
parent d766f9a0e3
commit a1d729d812
5 changed files with 38 additions and 48 deletions

View file

@ -1,5 +1,5 @@
<template> <template>
<img v-if="imageSrc" :src="imageSrc" /> <img v-if="imageSrc" :src="imageSrc" style="width:100%;height:100%" />
</template> </template>
<script> <script>

View file

@ -16,9 +16,9 @@
<v-btn icon> <v-btn icon>
<v-icon <v-icon
:color=" :color="
device.isBlocked() device.isBlocked
? 'red' ? 'red'
: device.isVerified() : device.isVerified
? 'green' ? 'green'
: 'grey-lighten-1' : 'grey-lighten-1'
" "
@ -32,6 +32,8 @@
</template> </template>
<script> <script>
import { DeviceVerification } from 'matrix-js-sdk';
export default { export default {
name: "DeviceList", name: "DeviceList",
props: { props: {
@ -53,7 +55,7 @@ export default {
handler(member, ignoredOldVal) { handler(member, ignoredOldVal) {
this.updateDevices(); this.updateDevices();
if (member) { if (member) {
this.$matrix.matrixClient.downloadKeys([member.userId]).then(() => { this.$matrix.matrixClient.downloadKeysForUsers([member.userId]).then(() => {
this.updateDevices(); this.updateDevices();
}); });
} }
@ -66,23 +68,36 @@ export default {
this.devices = []; this.devices = [];
return; return;
} }
this.devices = this.$matrix.matrixClient.getStoredDevicesForUser( this.$matrix.matrixClient.getCrypto().getUserDeviceInfo(
this.member.userId [this.member.userId], true
); ).then(deviceMap => {
if (deviceMap && deviceMap.get(this.member.userId)) {
const userDevices = deviceMap.get(this.member.userId);
const devices = [...userDevices.keys()].map(k => {
return userDevices.get(k);
}).map(d => ({
deviceId: d.deviceId,
displayName: d.displayName,
isBlocked: d.verified == DeviceVerification.Blocked,
isVerified: d.verified == DeviceVerification.Verified
}));
this.devices = devices;
}
})
}, },
displayName(device) { displayName(device) {
var name = device.deviceId; var name = device.deviceId;
if (device.getDisplayName()) { if (device.displayName) {
name += " - " + device.getDisplayName(); name += " - " + device.displayName;
} }
return name; return name;
}, },
verificationStatus(device) { verificationStatus(device) {
if (device.isBlocked()) { if (device.isBlocked) {
return this.$t('device_list.blocked'); return this.$t('device_list.blocked');
} else if (device.isVerified()) { } else if (device.isVerified) {
return this.$t('device_list.verified'); return this.$t('device_list.verified');
} else { } else {
return this.$t('device_list.not_verified'); return this.$t('device_list.not_verified');

View file

@ -3,7 +3,6 @@
v-model="showDialog" v-model="showDialog"
class="ma-0 pa-0" class="ma-0 pa-0"
:width="$vuetify.display.smAndUp ? '688px' : '95%'" :width="$vuetify.display.smAndUp ? '688px' : '95%'"
v-if="showDialog"
> >
<div class="dialog-content text-center member-action-dialog"> <div class="dialog-content text-center member-action-dialog">
<div class="pt-4"> <div class="pt-4">
@ -64,22 +63,16 @@ import roomInfoMixin from "./roomInfoMixin";
import DeviceList from "../components/DeviceList"; import DeviceList from "../components/DeviceList";
import AuthedImage from "./AuthedImage.vue"; import AuthedImage from "./AuthedImage.vue";
import util from "../plugins/utils"; import util from "../plugins/utils";
import RoomDialogBase from "./RoomDialogBase.vue";
export default { export default {
name: "UserProfileDialog", name: "UserProfileDialog",
mixins: [roomInfoMixin], extends: RoomDialogBase,
components: { components: {
DeviceList, DeviceList,
AuthedImage AuthedImage
}, },
emits: ['update:modelValue'],
props: { props: {
modelValue: {
type: Boolean,
default: function () {
return false;
},
},
activeMember: { activeMember: {
type: Object, type: Object,
default: function () { default: function () {
@ -89,7 +82,6 @@ export default {
}, },
data() { data() {
return { return {
showDialog: false
}; };
}, },
computed: { computed: {
@ -140,26 +132,10 @@ export default {
}, []); }, []);
} }
}, },
watch: {
activeMember() {
this.showDialog = this.show && this.activeMember && this.room;
},
room() {
this.showDialog = this.show && this.activeMember && this.room;
},
show: {
handler(newVal, ignoredOldVal) {
this.showDialog = newVal && this.activeMember && this.room;
}
},
showDialog() {
if (!this.showDialog) {
this.$emit('update:modelValue', false);
}
},
},
methods: { methods: {
shouldShow() {
return this.modelValue && this.room && this.activeMember ? true : false;
},
startPrivateChat(userId) { startPrivateChat(userId) {
this.$matrix this.$matrix
.getOrCreatePrivateChat(userId) .getOrCreatePrivateChat(userId)

View file

@ -8,7 +8,7 @@
</div> </div>
</div> </div>
<v-avatar class="avatar" ref="avatar" size="32" color="#ededed" @click.stop="otherAvatarClicked($refs.avatar.$el)"> <v-avatar class="avatar" ref="avatar" size="32" color="#ededed" @click.stop="otherAvatarClicked($refs.avatar.$el)">
<img v-if="messageEventAvatar(event)" :src="messageEventAvatar(event)" onerror="this.style.display='none'" /> <AuthedImage v-if="messageEventAvatar(event)" :src="messageEventAvatar(event)" onerror="this.style.display='none'" />
<span v-else class="text-white headline">{{ <span v-else class="text-white headline">{{
eventSenderDisplayName(event).substring(0, 1).toUpperCase() eventSenderDisplayName(event).substring(0, 1).toUpperCase()
}}</span> }}</span>
@ -35,10 +35,11 @@ import messageMixin from "./messageMixin";
import util, { ROOM_TYPE_CHANNEL } from "../../plugins/utils"; import util, { ROOM_TYPE_CHANNEL } from "../../plugins/utils";
import QuickReactions from "./QuickReactions.vue"; import QuickReactions from "./QuickReactions.vue";
import QuickReactionsChannel from "./channel/QuickReactionsChannel.vue"; import QuickReactionsChannel from "./channel/QuickReactionsChannel.vue";
import AuthedImage from "../AuthedImage.vue";
export default { export default {
mixins: [messageMixin], mixins: [messageMixin],
components: { QuickReactions, QuickReactionsChannel, SeenBy }, components: { AuthedImage, QuickReactions, QuickReactionsChannel, SeenBy },
data() { data() {
return { ROOM_TYPE_CHANNEL: ROOM_TYPE_CHANNEL } return { ROOM_TYPE_CHANNEL: ROOM_TYPE_CHANNEL }
}, },

View file

@ -7,13 +7,12 @@
v-show="showAllReaction || index < REACTION_LIMIT" v-show="showAllReaction || index < REACTION_LIMIT"
> >
<v-tooltip top v-if="value.includes($matrix.currentUserId)"> <v-tooltip top v-if="value.includes($matrix.currentUserId)">
<template v-slot:activator="{ on, attrs }"> <template v-slot:activator="{ props }">
<v-chip <v-chip
class="pa-2 ma-1 ml-0" class="pa-2 ma-1 ml-0"
variant="outlined" variant="outlined"
size="small" size="small"
v-bind="attrs" v-bind="props"
v-on="on"
@click="onClickEmoji(name)" @click="onClickEmoji(name)"
> >
{{ name }} {{ value.length }} {{ name }} {{ value.length }}
@ -40,13 +39,12 @@
{{ otherReactionText }} {{ otherReactionText }}
</v-chip> </v-chip>
<v-tooltip top v-if="!!totalReaction"> <v-tooltip top v-if="!!totalReaction">
<template v-slot:activator="{ on, attrs }"> <template v-slot:activator="{ props }">
<v-chip <v-chip
variant="outlined" variant="outlined"
size="small" size="small"
class="pa-2 ma-1 ml-0" class="pa-2 ma-1 ml-0"
v-bind="attrs" v-bind="props"
v-on="on"
@click="more" @click="more"
> >
<v-icon size="small"> $vuetify.icons.addReaction </v-icon> <v-icon size="small"> $vuetify.icons.addReaction </v-icon>