about summary refs log tree commit diff
path: root/app/models
diff options
context:
space:
mode:
Diffstat (limited to 'app/models')
-rw-r--r--app/models/report.rb9
-rw-r--r--app/models/status.rb2
-rw-r--r--app/models/stream_entry.rb2
3 files changed, 11 insertions, 2 deletions
diff --git a/app/models/report.rb b/app/models/report.rb
new file mode 100644
index 000000000..05dc8cff1
--- /dev/null
+++ b/app/models/report.rb
@@ -0,0 +1,9 @@
+# frozen_string_literal: true
+
+class Report < ApplicationRecord
+  belongs_to :account
+  belongs_to :target_account, class_name: 'Account'
+
+  scope :unresolved, -> { where(action_taken: false) }
+  scope :resolved,   -> { where(action_taken: true) }
+end
diff --git a/app/models/status.rb b/app/models/status.rb
index e440bbaca..46d92ea33 100644
--- a/app/models/status.rb
+++ b/app/models/status.rb
@@ -77,7 +77,7 @@ class Status < ApplicationRecord
 
   def permitted?(other_account = nil)
     if private_visibility?
-      (account.id == other_account&.id || other_account&.following?(account) || mentions.include?(other_account))
+      (account.id == other_account&.id || other_account&.following?(account) || mentions.where(account: other_account).exists?)
     else
       other_account.nil? || !account.blocking?(other_account)
     end
diff --git a/app/models/stream_entry.rb b/app/models/stream_entry.rb
index 8b41c8c39..ae7ae446e 100644
--- a/app/models/stream_entry.rb
+++ b/app/models/stream_entry.rb
@@ -55,7 +55,7 @@ class StreamEntry < ApplicationRecord
   end
 
   def activity
-    !new_record? ? send(activity_type.underscore) : super
+    !new_record? ? send(activity_type.underscore) || super : super
   end
 
   private