about summary refs log tree commit diff
diff options
context:
space:
mode:
authorThibaut Girka <thib@sitedethib.com>2018-05-21 20:21:52 +0200
committerFire Demon <firedemon@creature.cafe>2020-08-30 05:44:01 -0500
commitb1249a6ef1c7ce479a646491805712b9573b8ce8 (patch)
tree0d81e96da7fba12e956a351194889feee09025a5
parentc752a46c457759149c14ae0e4d501d5ef2ce478a (diff)
[Privacy, Port: glitch-soc@71b1d4c] Backend changes to allow handling local-only toots not based on emoji
Co-authored-by: Fire Demon <firedemon@creature.cafe>
-rw-r--r--app/controllers/api/v1/statuses_controller.rb3
-rw-r--r--app/services/post_status_service.rb2
2 files changed, 5 insertions, 0 deletions
diff --git a/app/controllers/api/v1/statuses_controller.rb b/app/controllers/api/v1/statuses_controller.rb
index 1437496be..b64bf3fa0 100644
--- a/app/controllers/api/v1/statuses_controller.rb
+++ b/app/controllers/api/v1/statuses_controller.rb
@@ -42,6 +42,7 @@ class Api::V1::StatusesController < Api::BaseController
                                          sensitive: status_params[:sensitive],
                                          spoiler_text: status_params[:spoiler_text],
                                          visibility: status_params[:visibility],
+                                         local_only: status_params[:local_only],
                                          scheduled_at: status_params[:scheduled_at],
                                          application: doorkeeper_token.application,
                                          poll: status_params[:poll],
@@ -67,6 +68,7 @@ class Api::V1::StatusesController < Api::BaseController
                                          sensitive: status_params[:sensitive],
                                          spoiler_text: status_params[:spoiler_text],
                                          visibility: status_params[:visibility],
+                                         local_only: status_params[:local_only],
                                          scheduled_at: status_params[:scheduled_at],
                                          application: doorkeeper_token.application,
                                          poll: status_params[:poll],
@@ -115,6 +117,7 @@ class Api::V1::StatusesController < Api::BaseController
       :sensitive,
       :spoiler_text,
       :visibility,
+      :local_only,
       :scheduled_at,
       :content_type,
       tags: [],
diff --git a/app/services/post_status_service.rb b/app/services/post_status_service.rb
index 132e91907..eb60c1022 100644
--- a/app/services/post_status_service.rb
+++ b/app/services/post_status_service.rb
@@ -12,6 +12,7 @@ class PostStatusService < BaseService
   # @option [Status] :thread Optional status to reply to
   # @option [Boolean] :sensitive
   # @option [String] :visibility
+  # @option [Boolean] :local_only
   # @option [String] :spoiler_text
   # @option [String] :language
   # @option [String] :scheduled_at
@@ -199,6 +200,7 @@ class PostStatusService < BaseService
       sensitive: @sensitive,
       spoiler_text: @options[:spoiler_text] || '',
       visibility: @visibility,
+      local_only: @options[:local_only],
       language: language_from_option(@options[:language]) || @account.user&.setting_default_language&.presence || LanguageDetector.instance.detect(@text, @account),
       application: @options[:application],
       published: @options[:publish],