about summary refs log tree commit diff
path: root/app/models
diff options
context:
space:
mode:
authorThibaut Girka <thib@sitedethib.com>2018-08-22 20:56:32 +0200
committerThibaut Girka <thib@sitedethib.com>2018-08-22 20:56:32 +0200
commite70fc059a9511d43b42c2502514f6220b416cdd5 (patch)
treeabc0ea9862c55c2e114c855b20eb4a35f1141709 /app/models
parent628fca50e20bcf41f206877083fc5ee8789c1088 (diff)
parent56f882aed6fc81bbe4fb8821f11ba196795c99a8 (diff)
Merge branch 'master' into glitch-soc/merge-upstream
Diffstat (limited to 'app/models')
-rw-r--r--app/models/account.rb7
-rw-r--r--app/models/form/admin_suspension_confirmation.rb7
-rw-r--r--app/models/status.rb3
3 files changed, 16 insertions, 1 deletions
diff --git a/app/models/account.rb b/app/models/account.rb
index 9daf063a5..c84a7406d 100644
--- a/app/models/account.rb
+++ b/app/models/account.rb
@@ -196,6 +196,13 @@ class Account < ApplicationRecord
     ResolveAccountService.new.call(acct)
   end
 
+  def suspend!
+    transaction do
+      user&.disable! if local?
+      update!(suspended: true)
+    end
+  end
+
   def unsuspend!
     transaction do
       user&.enable! if local?
diff --git a/app/models/form/admin_suspension_confirmation.rb b/app/models/form/admin_suspension_confirmation.rb
new file mode 100644
index 000000000..c34b5b30e
--- /dev/null
+++ b/app/models/form/admin_suspension_confirmation.rb
@@ -0,0 +1,7 @@
+# frozen_string_literal: true
+
+class Form::AdminSuspensionConfirmation
+  include ActiveModel::Model
+
+  attr_accessor :acct, :report_id
+end
diff --git a/app/models/status.rb b/app/models/status.rb
index f38227b85..f9c0c68d9 100644
--- a/app/models/status.rb
+++ b/app/models/status.rb
@@ -395,7 +395,8 @@ class Status < ApplicationRecord
 
     def account_silencing_filter(account)
       if account.silenced?
-        including_silenced_accounts
+        including_myself = left_outer_joins(:account).where(account_id: account.id).references(:accounts)
+        excluding_silenced_accounts.or(including_myself)
       else
         excluding_silenced_accounts
       end