about summary refs log tree commit diff
path: root/app/policies
diff options
context:
space:
mode:
authorJenkins <jenkins@jenkins.ninjawedding.org>2018-04-03 19:17:20 +0000
committerJenkins <jenkins@jenkins.ninjawedding.org>2018-04-03 19:17:20 +0000
commit6611100480c86c07972c1223e7231c136966e11d (patch)
treed6ce7cf9568d13ba0dfc8ee32fd1335e0d053f43 /app/policies
parent1f5bdd8445f6ba192618288504b74c1df7c09ea6 (diff)
parentd8d42179590db772cc5b1873385cba7e5afe20df (diff)
Merge remote-tracking branch 'tootsuite/master' into glitchsoc/master
Diffstat (limited to 'app/policies')
-rw-r--r--app/policies/account_policy.rb4
-rw-r--r--app/policies/report_note_policy.rb17
2 files changed, 21 insertions, 0 deletions
diff --git a/app/policies/account_policy.rb b/app/policies/account_policy.rb
index 85e2c8419..efabe80d0 100644
--- a/app/policies/account_policy.rb
+++ b/app/policies/account_policy.rb
@@ -29,6 +29,10 @@ class AccountPolicy < ApplicationPolicy
     admin?
   end
 
+  def remove_avatar?
+    staff?
+  end
+
   def subscribe?
     admin?
   end
diff --git a/app/policies/report_note_policy.rb b/app/policies/report_note_policy.rb
new file mode 100644
index 000000000..694bc096b
--- /dev/null
+++ b/app/policies/report_note_policy.rb
@@ -0,0 +1,17 @@
+# frozen_string_literal: true
+
+class ReportNotePolicy < ApplicationPolicy
+  def create?
+    staff?
+  end
+
+  def destroy?
+    admin? || owner?
+  end
+
+  private
+
+  def owner?
+    record.account_id == current_account&.id
+  end
+end