Merge pull request #1800 from nextcloud/simplify-capability-check

Simplify capability checking
This commit is contained in:
Ivan Sein 2024-09-13 16:30:06 +02:00 коммит произвёл GitHub
Родитель cd7cb2fd03 bcbf52fb03
Коммит 995395ea4c
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: B5690EEEBB952194
1 изменённых файлов: 7 добавлений и 17 удалений

Просмотреть файл

@ -506,28 +506,18 @@ NSString * const NCDatabaseManagerRoomCapabilitiesChangedNotification = @"NCData
- (BOOL)roomHasTalkCapability:(NSString *)capability forRoom:(NCRoom *)room
{
if (room.isFederated) {
FederatedCapabilities *federatedCapabilities = [self federatedCapabilitiesForAccountId:room.accountId remoteServer:room.remoteServer roomToken:room.token];
if (!room.isFederated) {
return [self serverHasTalkCapability:capability forAccountId:room.accountId];
}
if (federatedCapabilities) {
NSArray *talkFeatures = [federatedCapabilities.talkCapabilities valueForKey:@"self"];
if ([talkFeatures containsObject:capability]) {
return YES;
}
}
FederatedCapabilities *federatedCapabilities = [self federatedCapabilitiesForAccountId:room.accountId remoteServer:room.remoteServer roomToken:room.token];
if (!federatedCapabilities) {
return NO;
}
ServerCapabilities *serverCapabilities = [self serverCapabilitiesForAccountId:room.accountId];
if (serverCapabilities) {
NSArray *talkFeatures = [serverCapabilities.talkCapabilities valueForKey:@"self"];
if ([talkFeatures containsObject:capability]) {
return YES;
}
}
return NO;
NSArray *talkFeatures = [federatedCapabilities.talkCapabilities valueForKey:@"self"];
return [talkFeatures containsObject:capability];
}
- (TalkCapabilities * __nullable)roomTalkCapabilitiesForRoom:(NCRoom *)room