diff options
Diffstat (limited to 'app/controllers')
-rw-r--r-- | app/controllers/api/v1/statuses_controller.rb | 4 | ||||
-rw-r--r-- | app/controllers/concerns/obfuscate_filename.rb | 17 | ||||
-rw-r--r-- | app/controllers/settings/profiles_controller.rb | 2 |
3 files changed, 20 insertions, 3 deletions
diff --git a/app/controllers/api/v1/statuses_controller.rb b/app/controllers/api/v1/statuses_controller.rb index a0b15cfbc..8b7690850 100644 --- a/app/controllers/api/v1/statuses_controller.rb +++ b/app/controllers/api/v1/statuses_controller.rb @@ -52,7 +52,7 @@ class Api::V1::StatusesController < ApiController end def create - @status = PostStatusService.new.call(current_user.account, params[:status], params[:in_reply_to_id].blank? ? nil : Status.find(params[:in_reply_to_id]), media_ids: params[:media_ids], sensitive: params[:sensitive]) + @status = PostStatusService.new.call(current_user.account, params[:status], params[:in_reply_to_id].blank? ? nil : Status.find(params[:in_reply_to_id]), media_ids: params[:media_ids], sensitive: params[:sensitive], unlisted: params[:unlisted]) render action: :show end @@ -73,7 +73,7 @@ class Api::V1::StatusesController < ApiController @reblogged_map = { @status.id => false } RemovalWorker.perform_async(reblog.id) - + render action: :show end diff --git a/app/controllers/concerns/obfuscate_filename.rb b/app/controllers/concerns/obfuscate_filename.rb new file mode 100644 index 000000000..9f12cb7e9 --- /dev/null +++ b/app/controllers/concerns/obfuscate_filename.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true +module ObfuscateFilename + extend ActiveSupport::Concern + + class_methods do + def obfuscate_filename(*args) + before_action { obfuscate_filename(*args) } + end + end + + def obfuscate_filename(path) + file = params.dig(*path) + return if file.nil? + + file.original_filename = 'media' + File.extname(file.original_filename) + end +end diff --git a/app/controllers/settings/profiles_controller.rb b/app/controllers/settings/profiles_controller.rb index 21fbba2af..0276f5fed 100644 --- a/app/controllers/settings/profiles_controller.rb +++ b/app/controllers/settings/profiles_controller.rb @@ -24,7 +24,7 @@ class Settings::ProfilesController < ApplicationController private def account_params - params.require(:account).permit(:display_name, :note, :avatar, :header, :silenced) + params.require(:account).permit(:display_name, :note, :avatar, :header) end def set_account |