about summary refs log tree commit diff
path: root/app/models
diff options
context:
space:
mode:
authorErin <sylphofelectricity@gmail.com>2017-12-10 21:39:27 -0600
committerErin <sylphofelectricity@gmail.com>2017-12-10 21:39:27 -0600
commit288f1293ef6702fd55262ffa1a143e6a36d47d14 (patch)
tree5892722f5eaa985df4f69647b46878812afd169b /app/models
parent0c46058a43efe6f19fba33146842f7d8ecc8d064 (diff)
set local_only in a before_create callback instead of status service
Diffstat (limited to 'app/models')
-rw-r--r--app/models/status.rb8
1 files changed, 8 insertions, 0 deletions
diff --git a/app/models/status.rb b/app/models/status.rb
index 9ae753447..94b2a1aa9 100644
--- a/app/models/status.rb
+++ b/app/models/status.rb
@@ -141,6 +141,8 @@ class Status < ApplicationRecord
 
   around_create Mastodon::Snowflake::Callbacks
 
+  before_create :set_locality
+
   before_validation :prepare_contents, if: :local?
   before_validation :set_reblog
   before_validation :set_visibility
@@ -302,6 +304,12 @@ class Status < ApplicationRecord
     self.sensitive = sensitive || spoiler_text.present?
   end
 
+  def set_locality
+    if account.domain.nil?
+      self.local_only = marked_local_only?
+    end
+  end
+
   def set_conversation
     self.reply = !(in_reply_to_id.nil? && thread.nil?) unless reply