mirror of
https://github.com/Nheko-Reborn/nheko.git
synced 2024-10-30 17:40: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 "MatrixClient.h"
|
||||||
#include "TimelineModel.h"
|
#include "TimelineModel.h"
|
||||||
|
|
||||||
Permissions::Permissions(TimelineModel *parent)
|
Permissions::Permissions(QString roomId, QObject *parent)
|
||||||
: QObject(parent)
|
: QObject(parent)
|
||||||
, room(parent)
|
, roomId_(roomId)
|
||||||
{
|
{
|
||||||
invalidate();
|
invalidate();
|
||||||
}
|
}
|
||||||
|
@ -19,7 +19,7 @@ void
|
||||||
Permissions::invalidate()
|
Permissions::invalidate()
|
||||||
{
|
{
|
||||||
pl = cache::client()
|
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>{})
|
.value_or(mtx::events::StateEvent<mtx::events::state::PowerLevels>{})
|
||||||
.content;
|
.content;
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,7 +15,7 @@ class Permissions : public QObject
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Permissions(TimelineModel *parent);
|
Permissions(QString roomId, QObject *parent = nullptr);
|
||||||
|
|
||||||
Q_INVOKABLE bool canInvite();
|
Q_INVOKABLE bool canInvite();
|
||||||
Q_INVOKABLE bool canBan();
|
Q_INVOKABLE bool canBan();
|
||||||
|
@ -28,6 +28,6 @@ public:
|
||||||
void invalidate();
|
void invalidate();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
TimelineModel *room;
|
QString roomId_;
|
||||||
mtx::events::state::PowerLevels pl;
|
mtx::events::state::PowerLevels pl;
|
||||||
};
|
};
|
||||||
|
|
|
@ -318,6 +318,7 @@ TimelineModel::TimelineModel(TimelineViewManager *manager, QString room_id, QObj
|
||||||
, events(room_id.toStdString(), this)
|
, events(room_id.toStdString(), this)
|
||||||
, room_id_(room_id)
|
, room_id_(room_id)
|
||||||
, manager_(manager)
|
, manager_(manager)
|
||||||
|
, permissions_{room_id}
|
||||||
{
|
{
|
||||||
lastMessage_.timestamp = 0;
|
lastMessage_.timestamp = 0;
|
||||||
|
|
||||||
|
|
|
@ -396,7 +396,7 @@ private:
|
||||||
TimelineViewManager *manager_;
|
TimelineViewManager *manager_;
|
||||||
|
|
||||||
InputBar input_{this};
|
InputBar input_{this};
|
||||||
Permissions permissions_{this};
|
Permissions permissions_;
|
||||||
|
|
||||||
QTimer showEventTimer{this};
|
QTimer showEventTimer{this};
|
||||||
QString eventIdToShow;
|
QString eventIdToShow;
|
||||||
|
|
Loading…
Reference in a new issue