Merge branch 'main' into lexical

* main:
  Don't choke when rendering commands where the card was deleted
  Update tests
  Rework system events
  test: add missing assertions
  dep: bump active_record-tenanted to fix URI support
  Remove hyphen from "Un-do"
  Prevent default when handling keyboard shortcuts
  dep: update AR::Tenanted to support database URIs
  Detect platform and label the correct hotkey shortcut
  Things got too tight
  Don't require TLS for Beamer at the moment
  dep: update dependencies

# Conflicts:
#	Gemfile
#	Gemfile.lock
#	app/assets/stylesheets/comments.css
This commit is contained in:
Jorge Manrubia
2025-05-29 12:44:14 +02:00
19 changed files with 140 additions and 111 deletions
@@ -7,7 +7,7 @@ class Card::Eventable::SystemCommenterTest < ActiveSupport::TestCase
end
test "card_assigned" do
assert_system_comment "Assigned to Kevin" do
assert_system_comment "David assigned this to Kevin." do
@card.toggle_assignment users(:kevin)
end
end
@@ -16,7 +16,7 @@ class Card::Eventable::SystemCommenterTest < ActiveSupport::TestCase
@card.toggle_assignment users(:kevin)
@card.comments.destroy_all # To skip deduplication logic
assert_system_comment "Unassigned from Kevin" do
assert_system_comment "David unassigned from Kevin" do
@card.toggle_assignment users(:kevin)
end
end
@@ -28,35 +28,17 @@ class Card::Eventable::SystemCommenterTest < ActiveSupport::TestCase
end
test "card_closed" do
assert_system_comment "Closed by David" do
assert_system_comment "Closed as “Done” by David" do
@card.close
end
end
test "card_title_changed" do
assert_system_comment "David changed title from 'The text is too small' to 'Make text larger'" do
assert_system_comment "David changed the title from 'The text is too small' to 'Make text larger'." do
@card.update! title: "Make text larger"
end
end
test "don't duplicate comments for the same kind of events" do
@card.change_stage_to workflow_stages(:qa_in_progress)
assert_no_difference -> { @card.comments.count } do
@card.reload.change_stage_to workflow_stages(:qa_on_hold)
assert_match /David moved this to 'On hold'/i, @card.comments.last.body.to_plain_text
end
end
test "don't duplicate comments for related events" do
@card.toggle_assignment users(:kevin)
assert_no_difference -> { @card.comments.count } do
@card.reload.toggle_assignment users(:kevin)
assert_match /Unassigned from Kevin/i, @card.comments.last.body.to_plain_text
end
end
test "don't notify on system comments" do
@card.watch_by(users(:david))
+3 -3
View File
@@ -32,7 +32,7 @@ class Command::CloseTest < ActionDispatch::IntegrationTest
execute_command "/close", context_url: collection_cards_url(@card.collection)
cards.each { it.reload.closed? }
assert cards.map(&:reload).all?(&:closed?)
end
test "undo close" do
@@ -42,10 +42,10 @@ class Command::CloseTest < ActionDispatch::IntegrationTest
command = parse_command "/close", context_url: collection_cards_url(@card.collection)
command.execute
cards.each { it.reload.closed? }
assert cards.map(&:reload).all?(&:closed?)
command.undo
cards.each { it.reload.open? }
assert cards.map(&:reload).all?(&:open?)
end
end