From 1c867dbbc292a6cc5624f0d8f4ae72603a105b3c Mon Sep 17 00:00:00 2001 From: Loren Burkholder Date: Sun, 23 Jul 2023 18:04:28 -0400 Subject: Show an indicator in the timeline for mods and admins --- src/timeline/TimelineModel.cpp | 9 +++++++++ src/timeline/TimelineModel.h | 1 + 2 files changed, 10 insertions(+) (limited to 'src') diff --git a/src/timeline/TimelineModel.cpp b/src/timeline/TimelineModel.cpp index 752aedb0..c09511f6 100644 --- a/src/timeline/TimelineModel.cpp +++ b/src/timeline/TimelineModel.cpp @@ -535,6 +535,7 @@ TimelineModel::roleNames() const {IsSender, "isSender"}, {UserId, "userId"}, {UserName, "userName"}, + {UserPowerlevel, "userPowerlevel"}, {Day, "day"}, {Timestamp, "timestamp"}, {Url, "url"}, @@ -597,6 +598,14 @@ TimelineModel::data(const mtx::events::collections::TimelineEvents &event, int r return QVariant(QString::fromStdString(acc::sender(event))); case UserName: return QVariant(displayName(QString::fromStdString(acc::sender(event)))); + case UserPowerlevel: { + return static_cast(mtx::events::state::PowerLevels{ + cache::client() + ->getStateEvent(room_id_.toStdString()) + .value_or(mtx::events::StateEvent{}) + .content} + .user_level(acc::sender(event))); + } case Day: { QDateTime prevDate = origin_server_ts(event); diff --git a/src/timeline/TimelineModel.h b/src/timeline/TimelineModel.h index fd1a4396..0901df29 100644 --- a/src/timeline/TimelineModel.h +++ b/src/timeline/TimelineModel.h @@ -241,6 +241,7 @@ public: IsSender, UserId, UserName, + UserPowerlevel, Day, Timestamp, Url, -- cgit 1.4.1