From 9d3c520c9e8a66446e697eb40076465a6792cdd9 Mon Sep 17 00:00:00 2001 From: Matthew Landauer Date: Thu, 21 Nov 2024 23:30:35 +0000 Subject: [PATCH] Add UTM tags to other share link --- app/helpers/comments_helper.rb | 6 +++--- app/views/applications/_thanks_for_commenting.html.erb | 10 +++++++--- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/app/helpers/comments_helper.rb b/app/helpers/comments_helper.rb index ce5030535..0042e9871 100644 --- a/app/helpers/comments_helper.rb +++ b/app/helpers/comments_helper.rb @@ -64,8 +64,8 @@ def comment_path(comment) application_path(comment.application, anchor: "comment#{comment.id}") end - sig { params(comment: Comment).returns(String) } - def comment_url(comment) - application_url(comment.application, anchor: "comment#{comment.id}") + sig { params(comment: Comment, params: T::Hash[Symbol, String]).returns(String) } + def comment_url(comment, params = {}) + application_url(comment.application, { anchor: "comment#{comment.id}" }.merge(params)) end end diff --git a/app/views/applications/_thanks_for_commenting.html.erb b/app/views/applications/_thanks_for_commenting.html.erb index 3d3f541c9..a6b5e1980 100644 --- a/app/views/applications/_thanks_for_commenting.html.erb +++ b/app/views/applications/_thanks_for_commenting.html.erb @@ -33,9 +33,13 @@

Thanks, your comment has been sent to <%= comment.comment_recipient_full_name %> and posted below!

- <%= render ShareButtonComponent.new(url: comment_url(comment), title: "My comment on #{page_title(comment.application)}", color: :lavender) do %> - Share your comment - <% end %> + <%# TODO: Make the share button component add the utm tags automatically %> + <%= c = "Share your comment" + render ShareButtonComponent.new( + url: comment_url(comment, utm_source: "share", utm_content: c), + title: "My comment on #{page_title(comment.application)}", + color: :lavender + ).with_content(c) %> <% end %> <%# Make the canvas (which is used to show the confetti) the same size as the alert %>