diff options
author | Loren Burkholder <computersemiexpert@outlook.com> | 2021-06-12 13:17:31 -0400 |
---|---|---|
committer | Loren Burkholder <computersemiexpert@outlook.com> | 2021-07-20 21:47:32 -0400 |
commit | 60b3c34d78120d10114fc14600b2b142bbc80362 (patch) | |
tree | 21af79f302cc50a81b6a93d2083a42bd09ec5380 /src/timeline | |
parent | Simplify room details access (diff) | |
download | nheko-60b3c34d78120d10114fc14600b2b142bbc80362.tar.xz |
Permissions only needs a roomid to function
Diffstat (limited to 'src/timeline')
-rw-r--r-- | src/timeline/Permissions.cpp | 6 | ||||
-rw-r--r-- | src/timeline/Permissions.h | 4 | ||||
-rw-r--r-- | src/timeline/TimelineModel.cpp | 1 | ||||
-rw-r--r-- | src/timeline/TimelineModel.h | 2 |
4 files changed, 7 insertions, 6 deletions
diff --git a/src/timeline/Permissions.cpp b/src/timeline/Permissions.cpp index 1eaab468..e4957045 100644 --- a/src/timeline/Permissions.cpp +++ b/src/timeline/Permissions.cpp @@ -8,9 +8,9 @@ #include "MatrixClient.h" #include "TimelineModel.h" -Permissions::Permissions(TimelineModel *parent) +Permissions::Permissions(QString roomId, QObject *parent) : QObject(parent) - , room(parent) + , roomId_(roomId) { invalidate(); } @@ -19,7 +19,7 @@ void Permissions::invalidate() { pl = cache::client() - ->getStateEvent<mtx::events::state::PowerLevels>(room->roomId().toStdString()) + ->getStateEvent<mtx::events::state::PowerLevels>(roomId_.toStdString()) .value_or(mtx::events::StateEvent<mtx::events::state::PowerLevels>{}) .content; } diff --git a/src/timeline/Permissions.h b/src/timeline/Permissions.h index f7e6f389..7aab1ddb 100644 --- a/src/timeline/Permissions.h +++ b/src/timeline/Permissions.h @@ -15,7 +15,7 @@ class Permissions : public QObject Q_OBJECT public: - Permissions(TimelineModel *parent); + Permissions(QString roomId, QObject *parent = nullptr); Q_INVOKABLE bool canInvite(); Q_INVOKABLE bool canBan(); @@ -28,6 +28,6 @@ public: void invalidate(); private: - TimelineModel *room; + QString roomId_; mtx::events::state::PowerLevels pl; }; diff --git a/src/timeline/TimelineModel.cpp b/src/timeline/TimelineModel.cpp index ebbca6f4..516a499b 100644 --- a/src/timeline/TimelineModel.cpp +++ b/src/timeline/TimelineModel.cpp @@ -318,6 +318,7 @@ TimelineModel::TimelineModel(TimelineViewManager *manager, QString room_id, QObj , events(room_id.toStdString(), this) , room_id_(room_id) , manager_(manager) + , permissions_{room_id} { lastMessage_.timestamp = 0; diff --git a/src/timeline/TimelineModel.h b/src/timeline/TimelineModel.h index b5144308..ebf24bec 100644 --- a/src/timeline/TimelineModel.h +++ b/src/timeline/TimelineModel.h @@ -396,7 +396,7 @@ private: TimelineViewManager *manager_; InputBar input_{this}; - Permissions permissions_{this}; + Permissions permissions_; QTimer showEventTimer{this}; QString eventIdToShow; |