mirror of
https://github.com/Nheko-Reborn/nheko.git
synced 2024-10-30 09:30:47 +03:00
Permissions only needs a roomid to function
This commit is contained in:
parent
59a2630be7
commit
60b3c34d78
4 changed files with 7 additions and 6 deletions
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
};
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -396,7 +396,7 @@ private:
|
|||
TimelineViewManager *manager_;
|
||||
|
||||
InputBar input_{this};
|
||||
Permissions permissions_{this};
|
||||
Permissions permissions_;
|
||||
|
||||
QTimer showEventTimer{this};
|
||||
QString eventIdToShow;
|
||||
|
|
Loading…
Reference in a new issue