Show member count for closed groups

pull/80/head
Niels Andriesse 5 years ago
parent f1a82fde2a
commit 51efb141c2

@ -160,12 +160,16 @@ final class ConversationTitleView : UIView {
dateFormatter.timeStyle = .medium dateFormatter.timeStyle = .medium
dateFormatter.dateStyle = .medium dateFormatter.dateStyle = .medium
subtitle.append(NSAttributedString(string: "Muted until " + dateFormatter.string(from: muteEndDate))) subtitle.append(NSAttributedString(string: "Muted until " + dateFormatter.string(from: muteEndDate)))
} else if self.thread.isGroupThread() && !(self.thread as! TSGroupThread).isRSSFeed { } else if let thread = self.thread as? TSGroupThread, !thread.isRSSFeed {
let storage = OWSPrimaryStorage.shared() let storage = OWSPrimaryStorage.shared()
var userCount: Int? var userCount: Int?
storage.dbReadConnection.readWrite { transaction in if thread.groupModel.groupType == .closedGroup {
if let publicChat = LokiDatabaseUtilities.getPublicChat(for: self.thread.uniqueId!, in: transaction) { userCount = thread.groupModel.groupMemberIds.count
userCount = storage.getUserCount(for: publicChat, in: transaction) } else if thread.groupModel.groupType == .openGroup {
storage.dbReadConnection.readWrite { transaction in
if let publicChat = LokiDatabaseUtilities.getPublicChat(for: self.thread.uniqueId!, in: transaction) {
userCount = storage.getUserCount(for: publicChat, in: transaction)
}
} }
} }
if let userCount = userCount { if let userCount = userCount {

Loading…
Cancel
Save