Always use the creator name for the plain text form

You does not make sense for webhooks
This commit is contained in:
Jorge Manrubia
2025-11-06 14:16:01 +01:00
parent 92da76b1a9
commit 676c2a42fe
3 changed files with 8 additions and 8 deletions
+3 -3
View File
@@ -14,7 +14,7 @@ class Event::Description
end
def to_plain_text
to_sentence(creator_text, card.title)
to_sentence(creator_name, card.title)
end
private
@@ -37,8 +37,8 @@ class Event::Description
tag.span card.title, class: "txt-underline"
end
def creator_text
event.creator == user ? "You" : h(event.creator.name)
def creator_name
h(event.creator.name)
end
def card
+3 -3
View File
@@ -11,7 +11,7 @@ class Event::DescriptionTest < ActiveSupport::TestCase
test "generates plain text description for card published event" do
description = events(:logo_published).description_for(users(:david))
assert_includes description.to_plain_text, "You added"
assert_includes description.to_plain_text, "David added"
assert_includes description.to_plain_text, "logo"
end
@@ -21,10 +21,10 @@ class Event::DescriptionTest < ActiveSupport::TestCase
assert_includes description.to_plain_text, "David commented on"
end
test "uses 'You' when event creator is the current user" do
test "uses always the name even when the event creator is the current user" do
description = events(:logo_published).description_for(users(:david))
assert_includes description.to_plain_text, "You added"
assert_includes description.to_plain_text, "David added"
end
test "uses creator name when event creator is not the current user" do
+2 -2
View File
@@ -219,7 +219,7 @@ class Webhook::DeliveryTest < ActiveSupport::TestCase
assert_not Webhook::Delivery.exists?(stale_delivery.id)
end
test "renders 'You' when event creator is current user" do
test "renders the creator name when event creator is current user" do
webhook = Webhook.create!(
board: boards(:writebook),
name: "Basecamp",
@@ -231,7 +231,7 @@ class Webhook::DeliveryTest < ActiveSupport::TestCase
Current.session = sessions(:david)
request_stub = stub_request(:post, webhook.url)
.with { |request| CGI.parse(request.body)["content"].first.include?("You added") }
.with { |request| CGI.parse(request.body)["content"].first.include?("David added") }
.to_return(status: 200)
delivery.deliver