Method: QuickActions::InterpretService#execute
- Defined in:
- app/services/quick_actions/interpret_service.rb
#execute(content, quick_action_target, only: nil) ⇒ Object
IMPORTANT: unsafe! Use execute_with_original_text instead as it handles cleanup of any residual quick actions left in the original description.
Takes a text and interprets the commands that are extracted from it. Returns the content without commands, a hash of changes to be applied to a record and a string containing the execution_message to show to the user.
42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'app/services/quick_actions/interpret_service.rb', line 42 def execute(content, quick_action_target, only: nil) return [content, {}, ''] unless current_user.can?(:use_quick_actions) @quick_action_target = quick_action_target @updates = {} @execution_message = {} @additional_properties = {} content, commands = extractor.extract_commands(content, only: only) extract_updates(commands) [content, @updates, (commands), command_names(commands)] end |