Add the ask command

This commit is contained in:
Stanko K.R.
2025-07-31 13:25:49 +02:00
parent 445ae632cc
commit 13eeb8574d
33 changed files with 969 additions and 3 deletions
+12
View File
@@ -0,0 +1,12 @@
class Command::Ask < Command
store_accessor :data, :question, :card_ids
def title
"Ask '#{question}'"
end
def execute
Current.user.resume_or_start_conversation(question)
Command::Result::ShowModal.new(turbo_frame: "conversation", url: conversation_path)
end
end
+2
View File
@@ -67,6 +67,8 @@ class Command::Parser
Command::VisitUrl.new(url: command_arguments.first)
when "/tag"
Command::Tag.new(tag_title: tag_title_from(combined_arguments), card_ids: cards.ids)
when "/ask"
Command::Ask.new(question: combined_arguments, card_ids: cards.ids)
when /^gid:\/\//
parse_gid command_name
else
+12
View File
@@ -0,0 +1,12 @@
class Command::Result::ShowModal
attr_reader :url, :turbo_frame
def initialize(url:, turbo_frame:)
@url = url
@turbo_frame = turbo_frame
end
def as_json
{ turbo_frame: turbo_frame, url: url }
end
end