Skip to content

Commit

Permalink
Hide non-relevant conversation settings
Browse files Browse the repository at this point in the history
Signed-off-by: Marcel Müller <[email protected]>
  • Loading branch information
SystemKeeper committed Aug 2, 2024
1 parent 1eaa4e5 commit ac3525e
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
16 changes: 16 additions & 0 deletions NextcloudTalk/NCRoom.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
4 changes: 2 additions & 2 deletions NextcloudTalk/RoomInfoTableViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -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]];
}

Expand Down

0 comments on commit ac3525e

Please sign in to comment.