From 0fda91c69080b50192b76d97ecc89f76d8142ae4 Mon Sep 17 00:00:00 2001 From: Eduardo Martinez Echevarria Date: Tue, 26 Nov 2024 18:59:23 +0100 Subject: [PATCH] Fix titles of attachments --- .../decidim_awesome/comments/create_comment_override.rb | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app/commands/concerns/decidim/decidim_awesome/comments/create_comment_override.rb b/app/commands/concerns/decidim/decidim_awesome/comments/create_comment_override.rb index f53bfe11..e5807a15 100644 --- a/app/commands/concerns/decidim/decidim_awesome/comments/create_comment_override.rb +++ b/app/commands/concerns/decidim/decidim_awesome/comments/create_comment_override.rb @@ -35,6 +35,12 @@ def add_attachments create_attachments end + def title_for(attachment) + return { I18n.locale => attachment[:title] } if attachment.is_a?(Hash) && attachment.has_key?(:title) + + { I18n.locale => attachment.original_filename } + end + def attachments_allowed? @attachments_allowed ||= begin root_commentable = root_commentable(form.commentable)