From edc1a853aafc7ffeae4671be4571d4b975667744 Mon Sep 17 00:00:00 2001 From: riggraz Date: Wed, 5 Feb 2025 15:51:37 +0100 Subject: [PATCH] disable image upload for anonymous feedback --- app/controllers/posts_controller.rb | 2 +- app/javascript/components/Board/NewPostForm.tsx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/controllers/posts_controller.rb b/app/controllers/posts_controller.rb index 81fd1286..4747c0c0 100644 --- a/app/controllers/posts_controller.rb +++ b/app/controllers/posts_controller.rb @@ -58,7 +58,7 @@ class PostsController < ApplicationController @post.assign_attributes(post_create_params(is_anonymous: is_anonymous)) # handle attachments - if Current.tenant.tenant_setting.allow_attachment_upload && params[:post][:attachments].present? + if Current.tenant.tenant_setting.allow_attachment_upload && params[:post][:attachments].present? && !is_anonymous @post.attachments.attach(params[:post][:attachments]) end diff --git a/app/javascript/components/Board/NewPostForm.tsx b/app/javascript/components/Board/NewPostForm.tsx index 8258d788..a08ec385 100644 --- a/app/javascript/components/Board/NewPostForm.tsx +++ b/app/javascript/components/Board/NewPostForm.tsx @@ -112,7 +112,7 @@ const NewPostForm = ({ { /* Attachments */ } { - tenantSetting.allow_attachment_upload && + tenantSetting.allow_attachment_upload && !isSubmissionAnonymous &&