about summary refs log tree commit diff
path: root/app/controllers
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2016-11-30 21:32:11 +0100
committerEugen Rochko <eugen@zeonfederated.com>2016-11-30 21:34:59 +0100
commit14bd46946d25186044485aa101dd2da976b61181 (patch)
tree94b59b79d06165469a103b9391ddfaee537e0cab /app/controllers
parent1b447c190eb47117e99ff1e3c754f9cc461202f1 (diff)
Per-status control for unlisted mode, also federation for unlisted mode
Fix #233, fix #268
Diffstat (limited to 'app/controllers')
-rw-r--r--app/controllers/api/v1/statuses_controller.rb4
-rw-r--r--app/controllers/concerns/obfuscate_filename.rb17
-rw-r--r--app/controllers/settings/profiles_controller.rb2
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