From 11249949eb83a4b14581a4877e01c3172e697b7e Mon Sep 17 00:00:00 2001 From: Jorge Manrubia Date: Tue, 2 Dec 2025 07:06:50 +0100 Subject: [PATCH] Fix: edit comment button disappears when morphing the page This also replaces the ad-hoc stimulus controller with the pure-css based solution we recently added. https://app.fizzy.do/5986089/cards/3243 --- app/assets/stylesheets/comments.css | 4 ---- app/helpers/messages_helper.rb | 6 +----- .../created_by_current_user_controller.js | 12 ------------ app/views/cards/comments/_comment.html.erb | 4 ++-- 4 files changed, 3 insertions(+), 23 deletions(-) delete mode 100644 app/javascript/controllers/created_by_current_user_controller.js diff --git a/app/assets/stylesheets/comments.css b/app/assets/stylesheets/comments.css index 6720fa258..78ec57467 100644 --- a/app/assets/stylesheets/comments.css +++ b/app/assets/stylesheets/comments.css @@ -82,10 +82,6 @@ .comment__edit { background-color: var(--color-ink-lightest); - - .comment:not(.comment--mine) & { - display: none; - } } .comment--mine { diff --git a/app/helpers/messages_helper.rb b/app/helpers/messages_helper.rb index 9dae7757c..f0e774882 100644 --- a/app/helpers/messages_helper.rb +++ b/app/helpers/messages_helper.rb @@ -3,10 +3,6 @@ module MessagesHelper turbo_frame_tag dom_id(card, :messages), class: "comments gap center", style: "--card-color: #{card.color}", - role: "group", aria: { label: "Messages" }, - data: { - controller: "created-by-current-user", - created_by_current_user_mine_class: "comment--mine" - }, & + role: "group", aria: { label: "Messages" }, & end end diff --git a/app/javascript/controllers/created_by_current_user_controller.js b/app/javascript/controllers/created_by_current_user_controller.js deleted file mode 100644 index 8941fc120..000000000 --- a/app/javascript/controllers/created_by_current_user_controller.js +++ /dev/null @@ -1,12 +0,0 @@ -import { Controller } from "@hotwired/stimulus" - -export default class extends Controller { - static targets = [ "creation" ] - static classes = [ "mine" ] - - creationTargetConnected(element) { - if (element.dataset.creatorId == Current.user.id) { - element.classList.add(this.mineClass) - } - } -} diff --git a/app/views/cards/comments/_comment.html.erb b/app/views/cards/comments/_comment.html.erb index 94bb5eec4..49ae74182 100644 --- a/app/views/cards/comments/_comment.html.erb +++ b/app/views/cards/comments/_comment.html.erb @@ -1,7 +1,7 @@ <% cache comment do %> <%= turbo_frame_tag comment, :container do %> <%# Bump for CSS changes: 2025-06-30 -%> -
" data-creator-id="<%= comment.creator_id %>" data-created-by-current-user-target="creation"> +
"> @@ -20,7 +20,7 @@ <%= link_to edit_card_comment_path(comment.card, comment), - class: "comment__edit btn btn--circle borderless translucent" do %> + class: "comment__edit btn btn--circle borderless translucent", data: { only_visible_to_you: true } do %> <%= icon_tag "menu-dots-horizontal" %> Edit this comment <% end %>