about summary refs log tree commit diff
path: root/app/models/account.rb
diff options
context:
space:
mode:
authormultiple creatures <dev@multiple-creature.party>2019-04-17 00:15:10 -0500
committermultiple creatures <dev@multiple-creature.party>2019-05-21 03:16:22 -0500
commit3bfa72cbce8521676f931676089169b9e105daa4 (patch)
tree2945bb90b18a15490480cc5baa7401f216e1c136 /app/models/account.rb
parentcdacbb3c4c80c32b5845d3f1492c207ac3481375 (diff)
Dedicated `network` DB column for marking whether a roar is a part of the local network; rewrite posts from `FORCE_*` domains at create time instead of dynamically.
Diffstat (limited to 'app/models/account.rb')
-rw-r--r--app/models/account.rb6
1 files changed, 6 insertions, 0 deletions
diff --git a/app/models/account.rb b/app/models/account.rb
index 28a7aa500..ec49d9308 100644
--- a/app/models/account.rb
+++ b/app/models/account.rb
@@ -67,6 +67,8 @@ class Account < ApplicationRecord
   MAX_NOTE_LENGTH = (ENV['MAX_BIO_CHARS'] || 500).to_i
   MAX_FIELDS = (ENV['MAX_PROFILE_FIELDS'] || 4).to_i
 
+  LOCAL_DOMAINS = ENV.fetch('LOCAL_DOMAINS', '').chomp.split(/\.?\s+/).freeze
+
   enum protocol: [:ostatus, :activitypub]
 
   validates :username, presence: true
@@ -127,6 +129,10 @@ class Account < ApplicationRecord
     domain.nil?
   end
 
+  def network?
+    local? || domain.in?(LOCAL_DOMAINS)
+  end
+
   def moved?
     moved_to_account_id.present?
   end