From cf3ec71aa564c7fe47ec79f8dd5f14e3bce0b85c Mon Sep 17 00:00:00 2001 From: multiple creatures Date: Mon, 15 Jul 2019 13:34:05 -0500 Subject: local visibility scope, chat scope+tags, unlisted tags --- app/models/account.rb | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'app/models/account.rb') 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? -- cgit