diff options
author | multiple creatures <dev@multiple-creature.party> | 2020-02-17 02:26:52 -0600 |
---|---|---|
committer | multiple creatures <dev@multiple-creature.party> | 2020-02-17 02:26:52 -0600 |
commit | 2427cced78580da729a0ac6a1dc52b2d206aa11c (patch) | |
tree | e0b703674d3a1fb523b447eb512ff0b2ac6ddd65 /app/models/account.rb | |
parent | 8bf7e00362b4e5bf29e3841bd871590871b5257d (diff) |
add a `manual_only` (manual trust only) moderation option + handle more `reject_unknown`/graylist mode caveats
Diffstat (limited to 'app/models/account.rb')
-rw-r--r-- | app/models/account.rb | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/app/models/account.rb b/app/models/account.rb index a2fa60a83..b0b9e9191 100644 --- a/app/models/account.rb +++ b/app/models/account.rb @@ -56,6 +56,7 @@ # unboostable :boolean default(FALSE), not null # block_anon :boolean default(FALSE), not null # trust_level :integer +# manual_only :boolean default(FALSE), not null # class Account < ApplicationRecord @@ -192,7 +193,7 @@ class Account < ApplicationRecord end def froze? - local? ? (self&.user.nil? ? true : user.disabled?) : froze + local? ? (self&.user.nil? ? true : user.disabled?) : froze || !known end def bot? @@ -246,11 +247,17 @@ class Account < ApplicationRecord end def mark_unknown! - update!(known: false) + known = false + avatar = nil + header = nil + self[:avatar_remote_url] = '' + self[:header_remote_url] = '' + save! end def mark_known! - update!(known: true) + update!(known: true, last_webfingered_at: nil) + refresh! unless local? || !Setting.auto_mark_instance_actors_known || domain == username _instance_actor = Account.find_remote(domain, domain) @@ -260,6 +267,14 @@ class Account < ApplicationRecord end end + def manual_only! + update!(manual_only: true) + end + + def auto_trust! + update!(manual_only: false) + end + def force_unlisted! transaction do update!(force_unlisted: true) @@ -479,7 +494,7 @@ class Account < ApplicationRecord end def can_be_marked_known? - !known && (!service || (service? && Setting.auto_mark_services_known)) && Setting.auto_mark_known + !known && !manual_only && (!service || (service? && Setting.auto_mark_services_known)) && Setting.auto_mark_known end class Field < ActiveModelSerializers::Model |