mirror of
https://gitlab.opencode.de/bwi/bundesmessenger/clients/bundesmessenger-ios.git
synced 2026-04-23 18:12:44 +02:00
MESSENGER-5951 disable slash commands in old editor
This commit is contained in:
+20
-17
@@ -163,26 +163,29 @@ class CompletionSuggestionService: CompletionSuggestionServiceProtocol {
|
||||
})
|
||||
}
|
||||
case .slash:
|
||||
commandProvider.fetchCommands { [weak self] commands in
|
||||
guard let self else { return }
|
||||
// bwi 5951 disable slash commands in old editor
|
||||
if BWIBuildSettings.shared.enableWYSIWYGCommands {
|
||||
commandProvider.fetchCommands { [weak self] commands in
|
||||
guard let self else { return }
|
||||
|
||||
self.suggestionItems = commands.filtered(isRoomAdmin: self.commandProvider.isRoomAdmin).map { command in
|
||||
CompletionSuggestionItem.command(value: CompletionSuggestionServiceCommandItem(
|
||||
name: command.name,
|
||||
parametersFormat: command.parametersFormat,
|
||||
description: command.description
|
||||
))
|
||||
}
|
||||
self.suggestionItems = commands.filtered(isRoomAdmin: self.commandProvider.isRoomAdmin).map { command in
|
||||
CompletionSuggestionItem.command(value: CompletionSuggestionServiceCommandItem(
|
||||
name: command.name,
|
||||
parametersFormat: command.parametersFormat,
|
||||
description: command.description
|
||||
))
|
||||
}
|
||||
|
||||
if textTrigger.text.isEmpty {
|
||||
// A single `/` will display all available commands.
|
||||
self.items.send(self.suggestionItems)
|
||||
} else {
|
||||
self.items.send(self.suggestionItems.filter { item in
|
||||
guard case let .command(commandSuggestion) = item else { return false }
|
||||
if textTrigger.text.isEmpty {
|
||||
// A single `/` will display all available commands.
|
||||
self.items.send(self.suggestionItems)
|
||||
} else {
|
||||
self.items.send(self.suggestionItems.filter { item in
|
||||
guard case let .command(commandSuggestion) = item else { return false }
|
||||
|
||||
return commandSuggestion.name.lowercased().contains(textTrigger.text.lowercased())
|
||||
})
|
||||
return commandSuggestion.name.lowercased().contains(textTrigger.text.lowercased())
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user