diff options
author | multiple creatures <dev@multiple-creature.party> | 2019-07-15 13:34:05 -0500 |
---|---|---|
committer | multiple creatures <dev@multiple-creature.party> | 2019-07-15 14:12:24 -0500 |
commit | cf3ec71aa564c7fe47ec79f8dd5f14e3bce0b85c (patch) | |
tree | 49a3356c4177157b377aeca223a7d1c1e2e3dc17 /app/models/account.rb | |
parent | 0a5eba734e6aa6a6e7e8f64b022af8ea129c9f5d (diff) |
local visibility scope, chat scope+tags, unlisted tags
Diffstat (limited to 'app/models/account.rb')
-rw-r--r-- | app/models/account.rb | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/app/models/account.rb b/app/models/account.rb index 97ebd14d3..7040f138b 100644 --- a/app/models/account.rb +++ b/app/models/account.rb @@ -71,7 +71,8 @@ class Account < ApplicationRecord LOCAL_DOMAINS = ENV.fetch('LOCAL_DOMAINS', '').chomp.split(/\.?\s+/).freeze - enum protocol: [:ostatus, :activitypub] + has_many :chat_accounts, dependent: :destroy, inverse_of: :account + has_many :chat_tags, through: :chat_accounts, source: :tag validates :username, presence: true @@ -545,6 +546,7 @@ class Account < ApplicationRecord before_create :generate_keys before_create :set_domain_from_inbox_url + before_create :set_chat_support before_validation :prepare_contents, if: :local? before_validation :prepare_username, on: :create before_destroy :clean_feed_manager @@ -567,6 +569,11 @@ class Account < ApplicationRecord nil end + def set_chat_support + return unless local? + self.supports_chat = true + end + def generate_keys return unless local? && !Rails.env.test? |