From 9f3fd6deb0db639417acf942838d32a33205e91e Mon Sep 17 00:00:00 2001 From: ultraviolet Date: Wed, 24 Jun 2026 23:01:11 +0100 Subject: [PATCH] fix: disable link to devlog on devlog page Adds "clickable" parameter, when set to false will disable the click action. Defaults to true, so will not effect other areas of code --- app/components/posts/card_component.rb | 11 +++++++---- app/views/projects/devlogs/show.html.erb | 3 ++- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/app/components/posts/card_component.rb b/app/components/posts/card_component.rb index 6424a3652..f43cb7e20 100644 --- a/app/components/posts/card_component.rb +++ b/app/components/posts/card_component.rb @@ -4,9 +4,9 @@ module Posts class CardComponent < ViewComponent::Base delegate :inline_svg_tag, to: :helpers - attr_reader :post, :current_user, :theme, :compact, :show_likes, :show_comments, :show_reposts, :show_actions, :source, :position, :page, :feed_request_id, :track_engagement, :current_user_reposted_post_ids, :show_views + attr_reader :post, :current_user, :theme, :compact, :show_likes, :show_comments, :show_reposts, :show_actions, :source, :position, :page, :feed_request_id, :track_engagement, :current_user_reposted_post_ids, :show_views, :clickable - def initialize(post:, current_user: nil, theme: :feed, compact: false, show_likes: true, show_comments: true, show_reposts: true, show_actions: true, source: nil, position: nil, page: nil, feed_request_id: nil, track_engagement: true, current_user_reposted_post_ids: nil, show_views: nil) + def initialize(post:, current_user: nil, theme: :feed, compact: false, show_likes: true, show_comments: true, show_reposts: true, show_actions: true, source: nil, position: nil, page: nil, feed_request_id: nil, track_engagement: true, current_user_reposted_post_ids: nil, show_views: nil, clickable: true) @post = post @current_user = current_user @theme = theme @@ -22,6 +22,7 @@ def initialize(post:, current_user: nil, theme: :feed, compact: false, show_like @track_engagement = track_engagement @current_user_reposted_post_ids = current_user_reposted_post_ids @show_views = show_views + @clickable = clickable end def render? @@ -47,7 +48,7 @@ def quote_repost? def card_classes class_names( "feed-post-card", - "feed-post-card--linked": card_link_url.present?, + "feed-post-card--linked": card_link_url.present? && clickable, "feed-post-card--compact": compact, "feed-post-card--quote-repost": quote_repost?, "feed-post-card--#{theme}": theme.present? @@ -60,7 +61,9 @@ def card_data return data if url.blank? controllers = [ data[:controller], "card-link" ].compact.join(" ") - actions = [ data[:action], "click->card-link#navigate auxclick->card-link#navigate" ].compact.join(" ") + if clickable + actions = [ data[:action], "click->card-link#navigate auxclick->card-link#navigate" ].compact.join(" ") + end data.merge( controller: controllers, diff --git a/app/views/projects/devlogs/show.html.erb b/app/views/projects/devlogs/show.html.erb index 4bd2ab6a4..001061053 100644 --- a/app/views/projects/devlogs/show.html.erb +++ b/app/views/projects/devlogs/show.html.erb @@ -24,7 +24,8 @@ post: @post, current_user: current_user, show_comments: false, - show_actions: current_user.present? + show_actions: current_user.present?, + clickable: false ) %>