Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't require a room object to render messages #1815

Merged
merged 1 commit into from
Sep 23, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 8 additions & 7 deletions NextcloudTalk/BaseChatTableViewCell.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
Loading