about summary refs log tree commit diff
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-rw-r--r--app/services/post_status_service.rb5
1 files changed, 5 insertions, 0 deletions
diff --git a/app/services/post_status_service.rb b/app/services/post_status_service.rb
index e2da4b358..45d66831b 100644
--- a/app/services/post_status_service.rb
+++ b/app/services/post_status_service.rb
@@ -145,6 +145,10 @@ class PostStatusService < BaseService
     @text.gsub!("\ufdd6", "#")
   end
 
+  def protect_leading_spaces
+    @text.gsub!(/^ /, "\u200b ")
+  end
+
   def preprocess_attributes!
     if @text.blank? && @options[:spoiler_text].present?
      @text = '.'
@@ -153,6 +157,7 @@ class PostStatusService < BaseService
 
     set_footer_from_i_am
     extract_tags
+    protect_leading_spaces
     set_local_only
     set_initial_visibility
     limit_visibility_if_silenced