mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-03 16:10:20 +00:00
Make the room power levels optional as they can be missing depending on what state events are requested
This commit is contained in:
committed by
Stefan Ceriu
parent
c7ff6c019d
commit
de723853e3
@@ -405,12 +405,13 @@ class TimelineViewModel: TimelineViewModelType, TimelineViewModelProtocol {
|
||||
private func updateRoomInfo(roomInfo: RoomInfoProxyProtocol) {
|
||||
state.pinnedEventIDs = roomInfo.pinnedEventIDs
|
||||
|
||||
state.canCurrentUserSendMessage = roomInfo.powerLevels.canOwnUser(sendMessage: .roomMessage)
|
||||
state.canCurrentUserRedactOthers = roomInfo.powerLevels.canOwnUserRedactOther()
|
||||
state.canCurrentUserRedactSelf = roomInfo.powerLevels.canOwnUserRedactOwn()
|
||||
state.canCurrentUserPin = roomInfo.powerLevels.canOwnUserPinOrUnpin()
|
||||
state.canCurrentUserKick = roomInfo.powerLevels.canOwnUserKick()
|
||||
state.canCurrentUserBan = roomInfo.powerLevels.canOwnUserBan()
|
||||
guard let powerLevels = roomInfo.powerLevels else { fatalError("Missing room power levels") }
|
||||
state.canCurrentUserSendMessage = powerLevels.canOwnUser(sendMessage: .roomMessage)
|
||||
state.canCurrentUserRedactOthers = powerLevels.canOwnUserRedactOther()
|
||||
state.canCurrentUserRedactSelf = powerLevels.canOwnUserRedactOwn()
|
||||
state.canCurrentUserPin = powerLevels.canOwnUserPinOrUnpin()
|
||||
state.canCurrentUserKick = powerLevels.canOwnUserKick()
|
||||
state.canCurrentUserBan = powerLevels.canOwnUserBan()
|
||||
}
|
||||
|
||||
private func setupSubscriptions() {
|
||||
|
||||
Reference in New Issue
Block a user