diff --git a/resources/qml/RoomList.qml b/resources/qml/RoomList.qml index 3b7fa84e..addbf571 100644 --- a/resources/qml/RoomList.qml +++ b/resources/qml/RoomList.qml @@ -144,7 +144,7 @@ Page { required property bool hasLoudNotification required property bool hasUnreadMessages required property bool isDirect - required property string directChatAvatarMxid + required property string directChatOtherUserId color: background height: avatarSize + 2 * Nheko.paddingMedium @@ -239,7 +239,7 @@ Page { width: avatarSize url: avatarUrl.replace("mxc://", "image://MxcImage/") displayName: roomName - userid: isDirect ? directChatAvatarMxid : undefined + userid: isDirect ? directChatOtherUserId : "" roomid: roomId Rectangle { diff --git a/resources/qml/TopBar.qml b/resources/qml/TopBar.qml index 78f81b7f..a8a53a24 100644 --- a/resources/qml/TopBar.qml +++ b/resources/qml/TopBar.qml @@ -66,7 +66,7 @@ Rectangle { height: Nheko.avatarSize url: avatarUrl.replace("mxc://", "image://MxcImage/") roomid: room.roomId - userid: room.isDirect ? room.directChatAvatarMxid : undefined + userid: room.isDirect ? room.directChatOtherUserId : "" displayName: roomName onClicked: { if (room) diff --git a/src/timeline/RoomlistModel.cpp b/src/timeline/RoomlistModel.cpp index d12fb426..094b0df6 100644 --- a/src/timeline/RoomlistModel.cpp +++ b/src/timeline/RoomlistModel.cpp @@ -77,7 +77,7 @@ RoomlistModel::roleNames() const {Tags, "tags"}, {ParentSpaces, "parentSpaces"}, {IsDirect, "isDirect"}, - {DirectChatAvatarMxid, "directChatAvatarMxid"}, + {DirectChatOtherUserId, "directChatOtherUserId"}, }; } @@ -133,8 +133,8 @@ RoomlistModel::data(const QModelIndex &index, int role) const } case Roles::IsDirect: return room->isDirect(); - case Roles::DirectChatAvatarMxid: - return room->directChatAvatarMxid(); + case Roles::DirectChatOtherUserId: + return room->directChatOtherUserId(); default: return {}; } diff --git a/src/timeline/RoomlistModel.h b/src/timeline/RoomlistModel.h index 57669087..c0a87aee 100644 --- a/src/timeline/RoomlistModel.h +++ b/src/timeline/RoomlistModel.h @@ -66,7 +66,7 @@ public: Tags, ParentSpaces, IsDirect, - DirectChatAvatarMxid, + DirectChatOtherUserId, }; RoomlistModel(TimelineViewManager *parent = nullptr); diff --git a/src/timeline/TimelineModel.cpp b/src/timeline/TimelineModel.cpp index d5c39bbe..ca303040 100644 --- a/src/timeline/TimelineModel.cpp +++ b/src/timeline/TimelineModel.cpp @@ -820,7 +820,7 @@ TimelineModel::syncState(const mtx::responses::State &s) if (roomMemberCount() <= 2) { emit isDirectChanged(); - emit directChatAvatarMxidChanged(); + emit directChatOtherUserIdChanged(); } } else if (std::holds_alternative>(e)) { this->isEncrypted_ = cache::isRoomEncrypted(room_id_.toStdString()); @@ -2080,7 +2080,7 @@ TimelineModel::roomMemberCount() const } QString -TimelineModel::directChatAvatarMxid() const +TimelineModel::directChatOtherUserId() const { if (roomMemberCount() < 3) { QString id; diff --git a/src/timeline/TimelineModel.h b/src/timeline/TimelineModel.h index 03e33066..582c6b28 100644 --- a/src/timeline/TimelineModel.h +++ b/src/timeline/TimelineModel.h @@ -178,7 +178,7 @@ class TimelineModel : public QAbstractListModel Q_PROPERTY(int trustlevel READ trustlevel NOTIFY trustlevelChanged) Q_PROPERTY(bool isDirect READ isDirect NOTIFY isDirectChanged) Q_PROPERTY( - QString directChatAvatarMxid READ directChatAvatarMxid NOTIFY directChatAvatarMxidChanged) + QString directChatOtherUserId READ directChatOtherUserId NOTIFY directChatOtherUserIdChanged) Q_PROPERTY(InputBar *input READ input CONSTANT) Q_PROPERTY(Permissions *permissions READ permissions NOTIFY permissionsChanged) @@ -296,7 +296,7 @@ public: crypto::Trust trustlevel() const; int roomMemberCount() const; bool isDirect() const { return roomMemberCount() <= 2; } // TODO: handle invites - QString directChatAvatarMxid() const; + QString directChatOtherUserId() const; std::optional eventById(const QString &id) { @@ -397,7 +397,7 @@ signals: void roomAvatarUrlChanged(); void roomMemberCountChanged(); void isDirectChanged(); - void directChatAvatarMxidChanged(); + void directChatOtherUserIdChanged(); void permissionsChanged(); void forwardToRoom(mtx::events::collections::TimelineEvents *e, QString roomId);