From bf0f6eb62d0f5bd1f0d8e4e2a6e9e8fd3b297b6c Mon Sep 17 00:00:00 2001 From: blackle Date: Thu, 12 Jan 2017 23:54:26 -0500 Subject: Implement a click-to-view spoiler system --- app/services/post_status_service.rb | 4 ++++ app/services/process_hashtags_service.rb | 1 + 2 files changed, 5 insertions(+) (limited to 'app/services') diff --git a/app/services/post_status_service.rb b/app/services/post_status_service.rb index 8765ef5e3..ef8aa4a91 100644 --- a/app/services/post_status_service.rb +++ b/app/services/post_status_service.rb @@ -8,6 +8,8 @@ class PostStatusService < BaseService # @param [Hash] options # @option [Boolean] :sensitive # @option [String] :visibility + # @option [Boolean] :spoiler + # @option [String] :spoiler_text # @option [Enumerable] :media_ids Optional array of media IDs to attach # @option [Doorkeeper::Application] :application # @return [Status] @@ -15,6 +17,8 @@ class PostStatusService < BaseService status = account.statuses.create!(text: text, thread: in_reply_to, sensitive: options[:sensitive], + spoiler: options[:spoiler], + spoiler_text: options[:spoiler_text], visibility: options[:visibility], application: options[:application]) diff --git a/app/services/process_hashtags_service.rb b/app/services/process_hashtags_service.rb index 617a38159..9da7ef74e 100644 --- a/app/services/process_hashtags_service.rb +++ b/app/services/process_hashtags_service.rb @@ -9,5 +9,6 @@ class ProcessHashtagsService < BaseService end status.update(sensitive: true) if tags.include?('nsfw') + status.update(spoiler: true) if tags.include?('spoiler') end end -- cgit