mirror of
https://github.com/Nheko-Reborn/nheko.git
synced 2024-11-22 03:00:46 +03:00
Show verification status in memberlist
This commit is contained in:
parent
18ea01e198
commit
9bad584931
8 changed files with 59 additions and 16 deletions
|
@ -13,6 +13,7 @@ ApplicationWindow {
|
|||
id: roomMembersRoot
|
||||
|
||||
property MemberList members
|
||||
property Room room
|
||||
|
||||
title: qsTr("Members of %1").arg(members.roomName)
|
||||
height: 650
|
||||
|
@ -83,9 +84,14 @@ ApplicationWindow {
|
|||
}
|
||||
|
||||
delegate: RowLayout {
|
||||
id: del
|
||||
|
||||
width: ListView.view.width
|
||||
spacing: Nheko.paddingMedium
|
||||
|
||||
Avatar {
|
||||
id: avatar
|
||||
|
||||
width: Nheko.avatarSize
|
||||
height: Nheko.avatarSize
|
||||
userid: model.mxid
|
||||
|
@ -97,16 +103,18 @@ ApplicationWindow {
|
|||
ColumnLayout {
|
||||
spacing: Nheko.paddingSmall
|
||||
|
||||
Label {
|
||||
text: model.displayName
|
||||
ElidedLabel {
|
||||
fullText: model.displayName
|
||||
color: TimelineManager.userColor(model ? model.mxid : "", Nheko.colors.window)
|
||||
font.pointSize: fontMetrics.font.pointSize
|
||||
font.pixelSize: fontMetrics.font.pixelSize
|
||||
elideWidth: del.width - Nheko.paddingMedium * 2 - avatar.width - encryptInd.width
|
||||
}
|
||||
|
||||
Label {
|
||||
text: model.mxid
|
||||
ElidedLabel {
|
||||
fullText: model.mxid
|
||||
color: Nheko.colors.buttonText
|
||||
font.pointSize: fontMetrics.font.pointSize * 0.9
|
||||
font.pixelSize: Math.ceil(fontMetrics.font.pixelSize * 0.9)
|
||||
elideWidth: del.width - Nheko.paddingMedium * 2 - avatar.width - encryptInd.width
|
||||
}
|
||||
|
||||
Item {
|
||||
|
@ -116,6 +124,28 @@ ApplicationWindow {
|
|||
|
||||
}
|
||||
|
||||
EncryptionIndicator {
|
||||
id: encryptInd
|
||||
|
||||
Layout.alignment: Qt.AlignRight
|
||||
visible: room.isEncrypted
|
||||
encrypted: room.isEncrypted
|
||||
trust: encrypted ? model.trustlevel : Crypto.Unverified
|
||||
ToolTip.text: {
|
||||
if (!encrypted)
|
||||
return qsTr("This room is not encrypted!");
|
||||
|
||||
switch (trust) {
|
||||
case Crypto.Verified:
|
||||
return qsTr("This user is verified.");
|
||||
case Crypto.TOFU:
|
||||
return qsTr("This user isn't verified, but is still using the same master key from the first time you met.");
|
||||
default:
|
||||
return qsTr("This user has unverified devices!");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
footer: Item {
|
||||
|
|
|
@ -153,10 +153,10 @@ Page {
|
|||
packSet.show();
|
||||
}
|
||||
|
||||
function onOpenRoomMembersDialog(members) {
|
||||
function onOpenRoomMembersDialog(members, room) {
|
||||
var membersDialog = roomMembersComponent.createObject(timelineRoot, {
|
||||
"members": members,
|
||||
"roomName": Rooms.currentRoom.roomName
|
||||
"room": room
|
||||
});
|
||||
membersDialog.show();
|
||||
}
|
||||
|
|
|
@ -140,7 +140,7 @@ Rectangle {
|
|||
|
||||
Platform.MenuItem {
|
||||
text: qsTr("Members")
|
||||
onTriggered: TimelineManager.openRoomMembers(room.roomId)
|
||||
onTriggered: TimelineManager.openRoomMembers(room)
|
||||
}
|
||||
|
||||
Platform.MenuItem {
|
||||
|
|
|
@ -3584,8 +3584,6 @@ Cache::roomMembers(const std::string &room_id)
|
|||
crypto::Trust
|
||||
Cache::roomVerificationStatus(const std::string &room_id)
|
||||
{
|
||||
std::string_view keys;
|
||||
|
||||
crypto::Trust trust = crypto::Verified;
|
||||
|
||||
try {
|
||||
|
|
|
@ -53,6 +53,7 @@ MemberList::roleNames() const
|
|||
{Mxid, "mxid"},
|
||||
{DisplayName, "displayName"},
|
||||
{AvatarUrl, "avatarUrl"},
|
||||
{Trustlevel, "trustlevel"},
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -69,6 +70,17 @@ MemberList::data(const QModelIndex &index, int role) const
|
|||
return m_memberList[index.row()].first.display_name;
|
||||
case AvatarUrl:
|
||||
return m_memberList[index.row()].second;
|
||||
case Trustlevel: {
|
||||
auto stat =
|
||||
cache::verificationStatus(m_memberList[index.row()].first.user_id.toStdString());
|
||||
|
||||
if (!stat)
|
||||
return crypto::Unverified;
|
||||
if (stat->unverified_device_count)
|
||||
return crypto::Unverified;
|
||||
else
|
||||
return stat->user_verified;
|
||||
}
|
||||
default:
|
||||
return {};
|
||||
}
|
||||
|
|
|
@ -25,6 +25,7 @@ public:
|
|||
Mxid,
|
||||
DisplayName,
|
||||
AvatarUrl,
|
||||
Trustlevel,
|
||||
};
|
||||
MemberList(const QString &room_id, QObject *parent = nullptr);
|
||||
|
||||
|
|
|
@ -375,10 +375,12 @@ TimelineViewManager::TimelineViewManager(CallManager *callManager, ChatPage *par
|
|||
}
|
||||
|
||||
void
|
||||
TimelineViewManager::openRoomMembers(QString room_id)
|
||||
TimelineViewManager::openRoomMembers(TimelineModel *room)
|
||||
{
|
||||
MemberList *memberList = new MemberList(room_id, this);
|
||||
emit openRoomMembersDialog(memberList);
|
||||
if (!room)
|
||||
return;
|
||||
MemberList *memberList = new MemberList(room->roomId(), this);
|
||||
emit openRoomMembersDialog(memberList, room);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -66,7 +66,7 @@ public:
|
|||
Q_INVOKABLE QString userPresence(QString id) const;
|
||||
Q_INVOKABLE QString userStatus(QString id) const;
|
||||
|
||||
Q_INVOKABLE void openRoomMembers(QString room_id);
|
||||
Q_INVOKABLE void openRoomMembers(TimelineModel *room);
|
||||
Q_INVOKABLE void openRoomSettings(QString room_id);
|
||||
Q_INVOKABLE void openInviteUsers(QString roomId);
|
||||
Q_INVOKABLE void openGlobalUserProfile(QString userId);
|
||||
|
@ -92,7 +92,7 @@ signals:
|
|||
void focusChanged();
|
||||
void focusInput();
|
||||
void openImageOverlayInternalCb(QString eventId, QImage img);
|
||||
void openRoomMembersDialog(MemberList *members);
|
||||
void openRoomMembersDialog(MemberList *members, TimelineModel *room);
|
||||
void openRoomSettingsDialog(RoomSettings *settings);
|
||||
void openInviteUsersDialog(InviteesModel *invitees);
|
||||
void openProfile(UserProfile *profile);
|
||||
|
|
Loading…
Reference in a new issue