diff options
author | multiple creatures <dev@multiple-creature.party> | 2019-10-27 14:02:05 -0500 |
---|---|---|
committer | multiple creatures <dev@multiple-creature.party> | 2019-10-27 14:02:05 -0500 |
commit | af9b9777af9601bb2de857e6e4fea0b07d699108 (patch) | |
tree | 52d5135e5d8b2e00b64fa8b4db73d176714af251 /app/models/account.rb | |
parent | 50401161a55fc46cbfcc4e9bcb7834f5482c05a8 (diff) |
add profile option to (locally) block anonymous views of public posts
Diffstat (limited to 'app/models/account.rb')
-rw-r--r-- | app/models/account.rb | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/app/models/account.rb b/app/models/account.rb index 97b0e93e4..e09690893 100644 --- a/app/models/account.rb +++ b/app/models/account.rb @@ -52,6 +52,9 @@ # kobold :boolean default(FALSE), not null # froze :boolean # known :boolean default(FALSE), not null +# force_private :boolean default(FALSE), not null +# unboostable :boolean default(FALSE), not null +# block_anon :boolean default(FALSE), not null # class Account < ApplicationRecord @@ -229,6 +232,14 @@ class Account < ApplicationRecord end end + def force_private! + transaction do + update!(force_private: true) + scope = Status.where(account_id: id) + scope.where.not(visibility: [:direct, :limited, :private]).in_batches.update_all(visibility: :private) + end + end + def force_sensitive! transaction do update!(force_sensitive: true) @@ -236,10 +247,22 @@ class Account < ApplicationRecord end end + def unboostable! + update!(unboostable: true) + end + + def boostable! + update!(unboostable: false) + end + def allow_public! update!(force_unlisted: false) end + def allow_nonprivate! + update!(force_private: false) + end + def allow_nonsensitive! update!(force_sensitive: false) end |