Don't require a room object to render messages

Signed-off-by: Marcel Müller <marcel-mueller@gmx.de>
This commit is contained in:
Marcel Müller 2024-09-22 13:58:36 +02:00
Родитель b652394390
Коммит bf8ccf1426
1 изменённых файлов: 8 добавлений и 7 удалений

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

@ -167,15 +167,16 @@ class BaseChatTableViewCell: UITableViewCell, ReactionsViewDelegate {
self.titleLabel.attributedText = titleLabel
let activeAccount = NCDatabaseManager.sharedInstance().activeAccount()
var shouldShowDeliveryStatus = false
var shouldShowReadStatus = false
guard let room = NCDatabaseManager.sharedInstance().room(withToken: message.token, forAccountId: activeAccount.accountId)
else { return }
if let room = NCDatabaseManager.sharedInstance().room(withToken: message.token, forAccountId: activeAccount.accountId) {
shouldShowDeliveryStatus = NCDatabaseManager.sharedInstance().roomHasTalkCapability(kCapabilityChatReadStatus, for: room)
let shouldShowDeliveryStatus = NCDatabaseManager.sharedInstance().roomHasTalkCapability(kCapabilityChatReadStatus, for: room)
// 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)
if let roomCapabilities = NCDatabaseManager.sharedInstance().roomTalkCapabilities(for: room) {
shouldShowReadStatus = !(roomCapabilities.readStatusPrivacy)
}
}
// This check is just a workaround to fix the issue with the deleted parents returned by the API.
if let parent = message.parent {