From 994560c1b72f474cc2348a7ac78a528d948729d7 Mon Sep 17 00:00:00 2001 From: Jorge Manrubia Date: Thu, 3 Jul 2025 23:06:37 +0200 Subject: [PATCH 1/9] Move inside concerns or the override won't work --- app/models/tag/attachable.rb | 6 +++--- app/models/user/attachable.rb | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/app/models/tag/attachable.rb b/app/models/tag/attachable.rb index 7b0a960e2..37d95b2dd 100644 --- a/app/models/tag/attachable.rb +++ b/app/models/tag/attachable.rb @@ -3,9 +3,9 @@ module Tag::Attachable included do include ActionText::Attachable - end - def attachable_plain_text_representation(...) - "##{title}" + def attachable_plain_text_representation(...) + "##{title}" + end end end diff --git a/app/models/user/attachable.rb b/app/models/user/attachable.rb index c1505535e..2ffde99c3 100644 --- a/app/models/user/attachable.rb +++ b/app/models/user/attachable.rb @@ -3,9 +3,9 @@ module User::Attachable included do include ActionText::Attachable - end - def attachable_plain_text_representation(...) - "@#{first_name.downcase}" + def attachable_plain_text_representation(...) + "@#{first_name.downcase}" + end end end From c134df1bb87a17245ca21ef534dc77abc8f7f489 Mon Sep 17 00:00:00 2001 From: Jorge Manrubia Date: Thu, 3 Jul 2025 23:07:15 +0200 Subject: [PATCH 2/9] Parse commands where it's just a gid properly --- app/models/command/parser.rb | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/app/models/command/parser.rb b/app/models/command/parser.rb index d383a8e27..e374e24c2 100644 --- a/app/models/command/parser.rb +++ b/app/models/command/parser.rb @@ -37,9 +37,7 @@ class Command::Parser when /^#/ Command::FilterByTag.new(tag_title: tag_title_from(string), params: filter.as_params) when /^@/ - Command::GoToUser.new(user_id: context.find_user(command_name)&.id) - when "/user" - Command::GoToUser.new(user_id: context.find_user(combined_arguments)&.id) + Command::GoToUser.new(user_id: context.find_user(string)&.id) when "/assign", "/assignto" Command::Assign.new(assignee_ids: assignees_from(command_arguments).collect(&:id), card_ids: cards.ids) when "/clear" @@ -64,11 +62,23 @@ 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 /^gid:\/\// + parse_gid command_name else parse_free_string(string) end end + def parse_gid(command_name) + Rails.logger.info "COMMAND NAME = #{command_name}" + case record = GlobalID::Locator.locate(command_name) + when Tag + Command::FilterByTag.new(tag_title: record.title, params: filter.as_params) + when User + Command::GoToUser.new(user_id: record.id) + end + end + def assignees_from(strings) Array(strings).filter_map do |string| context.find_user(string) From 809d23245f806ab0117f57f01027b33ebdc84f03 Mon Sep 17 00:00:00 2001 From: Jorge Manrubia Date: Thu, 3 Jul 2025 23:29:36 +0200 Subject: [PATCH 3/9] The prompt confirmation system wasn't really working after moving to lexical The async value setting was biting us here --- app/javascript/controllers/terminal_controller.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/app/javascript/controllers/terminal_controller.js b/app/javascript/controllers/terminal_controller.js index aa857479b..35681f97c 100644 --- a/app/javascript/controllers/terminal_controller.js +++ b/app/javascript/controllers/terminal_controller.js @@ -162,13 +162,15 @@ export default class extends Controller { this.waitingForConfirmationValue = true } - #showConfirmationPrompt(confirmationPrompt) { + async #showConfirmationPrompt(confirmationPrompt) { if (isMultiLineString(confirmationPrompt)) { this.#showOutput(confirmationPrompt) this.inputTarget.value = `Apply these changes? [Y/n] ` } else { this.inputTarget.value = `${confirmationPrompt}? [Y/n] ` } + + await nextFrame() } #handleConfirmationKey(key) { @@ -180,16 +182,17 @@ export default class extends Controller { } } - #submitWithConfirmation() { + async #submitWithConfirmation() { this.inputTarget.value = this.originalInputValue this.confirmationTarget.value = "confirmed" this.#hideOutput() + + await nextFrame() this.#submitCommand() } #submitCommand() { this.formTarget.requestSubmit() - this.#reset() } #showOutput(markdown) { From 5c68dac4d5b697f8cb78a15048f82ffa20db35f0 Mon Sep 17 00:00:00 2001 From: Jorge Manrubia Date: Fri, 4 Jul 2025 00:05:39 +0200 Subject: [PATCH 4/9] Update action text --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index 8fad5375c..596dce396 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,6 +1,6 @@ GIT remote: https://github.com/basecamp/actiontext-lexical - revision: 38e8d4e5781667b7d1c17eaa5cca503bbc63ee67 + revision: 30ed20ed2939b14d92bad325dae4e75b5c4c2181 specs: actiontext-lexical (0.1.0) rails (>= 8.0.2) From 2cd8df4975ebcd62b3ed4a5b776935afab43873f Mon Sep 17 00:00:00 2001 From: Jorge Manrubia Date: Fri, 4 Jul 2025 00:05:47 +0200 Subject: [PATCH 5/9] restore the right command --- app/models/command/ai/parser.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/command/ai/parser.rb b/app/models/command/ai/parser.rb index 59014f900..c2e1db3b3 100644 --- a/app/models/command/ai/parser.rb +++ b/app/models/command/ai/parser.rb @@ -30,7 +30,7 @@ class Command::Ai::Parser commands.unshift Command::VisitUrl.new(user: user, url: query_context.url, context: resolved_context) end - Command::Composite.new(title: query, commands: commands, user: user, line: normalized_query, context: resolved_context) + Command::Composite.new(title: query, commands: commands, user: user, line: query, context: resolved_context) end def commands_from_query(normalized_query, context) From 3ed7c940d98fb8a30a1fd50254356cf24ed7c344 Mon Sep 17 00:00:00 2001 From: Jorge Manrubia Date: Fri, 4 Jul 2025 00:07:03 +0200 Subject: [PATCH 6/9] Remove trace --- app/models/command/parser.rb | 1 - 1 file changed, 1 deletion(-) diff --git a/app/models/command/parser.rb b/app/models/command/parser.rb index e374e24c2..075162964 100644 --- a/app/models/command/parser.rb +++ b/app/models/command/parser.rb @@ -70,7 +70,6 @@ class Command::Parser end def parse_gid(command_name) - Rails.logger.info "COMMAND NAME = #{command_name}" case record = GlobalID::Locator.locate(command_name) when Tag Command::FilterByTag.new(tag_title: record.title, params: filter.as_params) From 68277183e3d61d3b09bac2b2bd58d02d35385e5f Mon Sep 17 00:00:00 2001 From: Jorge Manrubia Date: Fri, 4 Jul 2025 00:08:47 +0200 Subject: [PATCH 7/9] Add assertion for composite command line --- test/models/command/ai/parser_test.rb | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/test/models/command/ai/parser_test.rb b/test/models/command/ai/parser_test.rb index 7416d6912..821edd965 100644 --- a/test/models/command/ai/parser_test.rb +++ b/test/models/command/ai/parser_test.rb @@ -4,10 +4,11 @@ class Command::Ai::ParserTest < ActionDispatch::IntegrationTest include CommandTestHelper, VcrTestHelper test "parse command strings into a composite command containing the individual commands" do - result = parse_command "assign @kevin and close" + command = parse_command "assign @kevin and close" - assert_instance_of Command::Composite, result - commands = result.commands + assert_equal "assign @kevin and close", command.line + assert_instance_of Command::Composite, command + commands = command.commands assert_instance_of Command::Assign, commands.first assert_instance_of Command::Close, commands.last From 93f9e93239d592d56b6000f5f6b7541a49220215 Mon Sep 17 00:00:00 2001 From: Mike Dalessio Date: Thu, 3 Jul 2025 18:35:25 -0400 Subject: [PATCH 8/9] dep: bump actiontext-lexical for previewable attachment fix ref: https://fizzy.37signals.com/5986089/collections/2/cards/1004 --- Gemfile.lock | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 596dce396..ae7553c8d 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,6 +1,6 @@ GIT remote: https://github.com/basecamp/actiontext-lexical - revision: 30ed20ed2939b14d92bad325dae4e75b5c4c2181 + revision: 70ba099446c8a033c06c2bde9c5e70b7f983e60b specs: actiontext-lexical (0.1.0) rails (>= 8.0.2) @@ -444,7 +444,7 @@ GEM rainbow (3.1.1) rake (13.3.0) rb_sys (0.9.106) - rdoc (6.14.1) + rdoc (6.14.2) erb psych (>= 4.0.0) redcarpet (3.6.1) From 05984845ca4581f6431f0eda209276f4fe0b40fd Mon Sep 17 00:00:00 2001 From: Mike Dalessio Date: Thu, 3 Jul 2025 19:01:03 -0400 Subject: [PATCH 9/9] Change Active Storage account slug extension to a to_prepare block because it was breaking in development after a reload. --- config/initializers/tenanting/active_storage.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/initializers/tenanting/active_storage.rb b/config/initializers/tenanting/active_storage.rb index 278b92de8..f57cdc304 100644 --- a/config/initializers/tenanting/active_storage.rb +++ b/config/initializers/tenanting/active_storage.rb @@ -14,6 +14,6 @@ module ActiveStorageControllerExtensions end end -Rails.application.config.after_initialize do +Rails.application.config.to_prepare do ActiveStorage::BaseController.include ActiveStorageControllerExtensions end