Readonly Room

Add readonly property to a room and use it to decide whether to show chatbar, replies and edits

BUG: 479590
This commit is contained in:
James Graham
2024-01-12 01:59:09 +00:00
parent c1d122a717
commit ec4aa73e37
4 changed files with 18 additions and 2 deletions

View File

@@ -114,6 +114,7 @@ NeoChatRoom::NeoChatRoom(Connection *connection, QString roomId, JoinState joinS
Q_EMIT parentIdsChanged();
Q_EMIT canonicalParentChanged();
Q_EMIT joinRuleChanged();
Q_EMIT readOnlyChanged();
});
connect(connection, &Connection::capabilitiesLoaded, this, &NeoChatRoom::maxRoomVersionChanged);
connect(this, &Room::changed, this, [this]() {
@@ -662,6 +663,11 @@ bool NeoChatRoom::isInvite() const
return joinState() == JoinState::Invite;
}
bool NeoChatRoom::readOnly() const
{
return !canSendEvent("m.room.message"_ls);
}
bool NeoChatRoom::isUserBanned(const QString &user) const
{
auto roomMemberEvent = currentState().get<RoomMemberEvent>(user);