зеркало из https://github.com/nextcloud/talk-ios.git
Merge pull request #1706 from nextcloud/verify-existance-of-room-capabilities
Verify existance of room capabilities
This commit is contained in:
Коммит
75252344dd
|
@ -188,12 +188,14 @@ class BaseChatTableViewCell: UITableViewCell, ReactionsViewDelegate {
|
|||
|
||||
let activeAccount = NCDatabaseManager.sharedInstance().activeAccount()
|
||||
|
||||
guard let room = NCDatabaseManager.sharedInstance().room(withToken: message.token, forAccountId: activeAccount.accountId),
|
||||
let roomCapabilities = NCDatabaseManager.sharedInstance().roomTalkCapabilities(for: room)
|
||||
guard let room = NCDatabaseManager.sharedInstance().room(withToken: message.token, forAccountId: activeAccount.accountId)
|
||||
else { return }
|
||||
|
||||
let shouldShowDeliveryStatus = NCDatabaseManager.sharedInstance().roomHasTalkCapability(kCapabilityChatReadStatus, for: room)
|
||||
let shouldShowReadStatus = !roomCapabilities.readStatusPrivacy
|
||||
|
||||
// In case we are not able to retrieve the capabilities of the room, we fall back to readPrivacy = true -> hiding the read status
|
||||
let roomCapabilities = NCDatabaseManager.sharedInstance().roomTalkCapabilities(for: room)
|
||||
let shouldShowReadStatus = !(roomCapabilities?.readStatusPrivacy ?? true)
|
||||
|
||||
// This check is just a workaround to fix the issue with the deleted parents returned by the API.
|
||||
if let parent = message.parent {
|
||||
|
|
|
@ -3297,7 +3297,15 @@ NSInteger const kReceivedChatMessagesLimit = 100;
|
|||
NSPredicate *query = [NSPredicate predicateWithFormat:@"token = %@ AND accountId = %@", token, account.accountId];
|
||||
NCRoom *managedRoom = [NCRoom objectsWithPredicate:query].firstObject;
|
||||
|
||||
if (!managedRoom || [proxyHash isEqualToString:managedRoom.lastReceivedProxyHash]) {
|
||||
if (!managedRoom) {
|
||||
// The room is not known to us locally, don't try to fetch room capabilities
|
||||
return;
|
||||
}
|
||||
|
||||
FederatedCapabilities *federatedCapabilities = [[NCDatabaseManager sharedInstance] federatedCapabilitiesForAccountId:managedRoom.accountId remoteServer:managedRoom.remoteServer roomToken:managedRoom.token];
|
||||
|
||||
if ([proxyHash isEqualToString:managedRoom.lastReceivedProxyHash] && federatedCapabilities != nil) {
|
||||
// The proxy hash is equal to our last known proxy hash and we are also able to retrieve capabilities locally -> skip fetching capabilities
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче