diff --git a/NextcloudTalk/NCRoom.swift b/NextcloudTalk/NCRoom.swift index 98c3ccb79..36035b768 100644 --- a/NextcloudTalk/NCRoom.swift +++ b/NextcloudTalk/NCRoom.swift @@ -68,6 +68,22 @@ import Realm self.type != .changelog && self.type != .noteToSelf } + public var supportsMessageExpiration: Bool { + if self.type == .formerOneToOne || self.type == .changelog { + return false + } + + return self.isUserOwnerOrModerator && NCDatabaseManager.sharedInstance().serverHasTalkCapability(kCapabilityMessageExpiration) + } + + public var supportsBanning: Bool { + if self.type == .oneToOne || self.type == .formerOneToOne || self.type == .changelog || self.type == .noteToSelf { + return false + } + + return self.isUserOwnerOrModerator && NCDatabaseManager.sharedInstance().serverHasTalkCapability(kCapabilityBanV1) + } + public var isBreakoutRoom: Bool { return self.objectType == NCRoomObjectTypeRoom } diff --git a/NextcloudTalk/RoomInfoTableViewController.m b/NextcloudTalk/RoomInfoTableViewController.m index cb843e9e1..6d1addaa7 100644 --- a/NextcloudTalk/RoomInfoTableViewController.m +++ b/NextcloudTalk/RoomInfoTableViewController.m @@ -405,12 +405,12 @@ - (NSArray *)getConversationActions NSMutableArray *actions = [[NSMutableArray alloc] init]; // Message expiration action - if (_room.isUserOwnerOrModerator && [[NCDatabaseManager sharedInstance] serverHasTalkCapability:kCapabilityMessageExpiration]) { + if ([_room supportsMessageExpiration]) { [actions addObject:[NSNumber numberWithInt:kConversationActionMessageExpiration]]; } // Banning actors - if (_room.isUserOwnerOrModerator && [[NCDatabaseManager sharedInstance] serverHasTalkCapability:kCapabilityBanV1]) { + if ([_room supportsBanning]) { [actions addObject:[NSNumber numberWithInt:kConversationActionBannedActors]]; }