Skip to content

Commit

Permalink
Merge pull request #1742 from nextcloud/hide-nonrelevant-conversation…
Browse files Browse the repository at this point in the history
…-settings

Hide non-relevant conversation settings
  • Loading branch information
SystemKeeper authored Aug 9, 2024
2 parents 6fae87c + 0d86c74 commit 18cd47e
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
14 changes: 14 additions & 0 deletions NextcloudTalk/NCRoom.swift
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,20 @@ import Realm
self.type != .changelog && self.type != .noteToSelf
}

public var supportsMessageExpirationModeration: Bool {
if self.type == .formerOneToOne || self.type == .changelog {
return false
}

return self.isUserOwnerOrModerator && NCDatabaseManager.sharedInstance().serverHasTalkCapability(kCapabilityMessageExpiration)
}

public var supportsBanningModeration: Bool {
let supportedType = self.type == .group || self.type == .public

return supportedType && self.canModerate && 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 supportsMessageExpirationModeration]) {
[actions addObject:[NSNumber numberWithInt:kConversationActionMessageExpiration]];
}

// Banning actors
if (_room.isUserOwnerOrModerator && [[NCDatabaseManager sharedInstance] serverHasTalkCapability:kCapabilityBanV1]) {
if ([_room supportsBanningModeration]) {
[actions addObject:[NSNumber numberWithInt:kConversationActionBannedActors]];
}

Expand Down

0 comments on commit 18cd47e

Please sign in to comment.