tweak: fix clear all action for open group moderators

pull/638/head
Ryan Zhao 2 years ago
parent 36801e4876
commit 7ca48e9c7b

@ -3528,10 +3528,10 @@
FD17D79527F3E04600122BE0 /* _001_InitialSetupMigration.swift */,
FDF0B7412804EA4F004C14C5 /* _002_SetupStandardJobs.swift */,
FD17D79827F40AB800122BE0 /* _003_YDBToGRDBMigration.swift */,
FD09B7E4288670BB00ED0B66 /* _007_EmojiReacts.swift */,
FDF40CDD2897A1BC006A0CC4 /* _004_RemoveLegacyYDB.swift */,
FD37EA0C28AB2A45003AE748 /* _005_FixDeletedMessageReadState.swift */,
FD37EA0E28AB3330003AE748 /* _006_FixHiddenModAdminSupport.swift */,
FD09B7E4288670BB00ED0B66 /* _007_EmojiReacts.swift */,
);
path = Migrations;
sourceTree = "<group>";

@ -978,7 +978,12 @@ extension ConversationVC:
reactionListSheet.handleInteractionUpdates(
allMessages,
selectedReaction: selectedReaction,
initialLoad: true
initialLoad: true,
shouldShowClearAllButton: OpenGroupManager.isUserModeratorOrAdmin(
self.viewModel.threadData.currentUserPublicKey,
for: self.viewModel.threadData.openGroupRoomToken,
on: self.viewModel.threadData.openGroupServer
)
)
reactionListSheet.modalPresentationStyle = .overFullScreen
present(reactionListSheet, animated: true, completion: nil)
@ -1176,9 +1181,6 @@ extension ConversationVC:
in: thread
)
}
},
completion: { [weak self] _, _ in
self?.handleMessageSent()
}
)
}

@ -186,7 +186,8 @@ final class ReactionListSheet: BaseVC {
_ allMessages: [MessageViewModel],
selectedReaction: EmojiWithSkinTones? = nil,
updatedReactionIndex: Int? = nil,
initialLoad: Bool = false
initialLoad: Bool = false,
shouldShowClearAllButton: Bool = false
) {
guard let cellViewModel: MessageViewModel = allMessages.first(where: { $0.id == self.interactionId }) else {
return
@ -254,10 +255,8 @@ final class ReactionListSheet: BaseVC {
}
// Update the general UI
self.detailInfoLabel.text = updatedSummaries[safe: updatedSelectedReactionIndex]?.description
self.clearAllButton.isHidden = !cellViewModel.isSenderOpenGroupModerator
// Update general properties
self.messageViewModel = cellViewModel
self.lastSelectedReactionIndex = updatedSelectedReactionIndex
@ -271,6 +270,9 @@ final class ReactionListSheet: BaseVC {
.map { updatedReactionInfo.value(forKey: $0) }
.defaulting(to: [])
// Update clear all button visibility
self.clearAllButton.isHidden = !shouldShowClearAllButton
UIView.performWithoutAnimation {
self.reactionContainer.reloadData()
self.userListView.reloadData()

Loading…
Cancel
Save