diff --git a/imports/Spectral/Panel/RoomDrawer.qml b/imports/Spectral/Panel/RoomDrawer.qml index 27714d779..fc7582336 100644 --- a/imports/Spectral/Panel/RoomDrawer.qml +++ b/imports/Spectral/Panel/RoomDrawer.qml @@ -240,26 +240,28 @@ Drawer { wrapMode: Text.NoWrap } - MaterialIcon { - Layout.preferredWidth: height - Layout.fillHeight: true + Label { + visible: perm != UserType.Member - enabled: perm != UserType.Member - - icon: { + text: { + if (perm == UserType.Owner) { + return "Owner" + } if (perm == UserType.Admin) { - return "\ue853" + return "Admin" } if (perm == UserType.Moderator) { - return "\ue8e8" + return "Mod" } if (perm == UserType.Muted) { - return "\ue92a" + return "Muted" } return "" } - - color: MPalette.lighter + color: perm == UserType.Muted ? MPalette.lighter : MPalette.accent + font.pixelSize: 12 + textFormat: Text.PlainText + wrapMode: Text.NoWrap } } diff --git a/src/userlistmodel.cpp b/src/userlistmodel.cpp index dffa64ac2..9a24f161a 100644 --- a/src/userlistmodel.cpp +++ b/src/userlistmodel.cpp @@ -84,11 +84,11 @@ QVariant UserListModel::data(const QModelIndex& index, int role) const { auto pl = m_currentRoom->getCurrentState(); auto userPl = pl->powerLevelForUser(user->id()); - if (userPl == pl->content().usersDefault) { + if (userPl == pl->content().usersDefault) { // Shortcut return UserType::Member; } - if (userPl < pl->content().usersDefault) { + if (userPl < pl->powerLevelForState("m.room.message")) { return UserType::Muted; } @@ -105,10 +105,18 @@ QVariant UserListModel::data(const QModelIndex& index, int role) const { } if (userPl == highestPl) { + return UserType::Owner; + } + + if (userPl >= pl->powerLevelForState("m.room.power_levels")) { return UserType::Admin; } - return UserType::Moderator; + if (userPl >= pl->ban() || userPl >= pl->kick() || userPl >= pl->redact()) { + return UserType::Moderator; + } + + return UserType::Member; } return {}; diff --git a/src/userlistmodel.h b/src/userlistmodel.h index b3d617e35..c223aed91 100644 --- a/src/userlistmodel.h +++ b/src/userlistmodel.h @@ -17,7 +17,8 @@ class UserType : public QObject { public: enum Types { - Admin = 1, + Owner = 1, + Admin, Moderator, Member, Muted,