about summary refs log tree commit diff
path: root/app/services
diff options
context:
space:
mode:
authorblackle <isabelle@blackle-mori.com>2017-01-12 23:54:26 -0500
committerblackle <isabelle@blackle-mori.com>2017-01-23 21:07:40 -0500
commitbf0f6eb62d0f5bd1f0d8e4e2a6e9e8fd3b297b6c (patch)
treec06ebcba34c5971d564beb98aa81d5d9784ec2c7 /app/services
parent1761d3f9c33f3e2e98a09906fae1a03783b54b10 (diff)
Implement a click-to-view spoiler system
Diffstat (limited to 'app/services')
-rw-r--r--app/services/post_status_service.rb4
-rw-r--r--app/services/process_hashtags_service.rb1
2 files changed, 5 insertions, 0 deletions
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