hide delete for everyone if there is no server hash for the message

This commit is contained in:
Ryan Zhao 2021-08-02 15:31:41 +10:00
parent 050a2ec534
commit 1450fd380b

View file

@ -67,8 +67,13 @@ extension ContextMenuVC {
static func deleteActions(for viewItem: ConversationViewItem, delegate: ContextMenuActionDelegate?) -> [Action] {
switch viewItem.interaction.interactionType() {
case .outgoingMessage: return [Action.deleteForEveryone(viewItem, delegate), Action.deleteLocally(viewItem, delegate)]
case .incomingMessage: return [Action.deleteLocally(viewItem, delegate)]
case .outgoingMessage:
if let message = viewItem.interaction as? TSMessage, let _ = message.serverHash {
return [Action.deleteForEveryone(viewItem, delegate), Action.deleteLocally(viewItem, delegate)]
}
return [Action.deleteLocally(viewItem, delegate)]
case .incomingMessage:
return [Action.deleteLocally(viewItem, delegate)]
default: return [] // Should never occur
}