about summary refs log tree commit diff
path: root/app/models/status.rb
diff options
context:
space:
mode:
authormultiple creatures <dev@multiple-creature.party>2019-05-05 23:04:23 -0500
committermultiple creatures <dev@multiple-creature.party>2019-05-21 03:16:22 -0500
commita47b1daaebea09ca07ca93079e530f26cfeef914 (patch)
tree04f08b28710732d1a9747c64537cd75162a651ca /app/models/status.rb
parent992218f05f76106857f2cb5a72c0bb4510aa4563 (diff)
Implement scoped tags; use `local:` and `self:` scopes for community and personal tags, respectively.
Diffstat (limited to 'app/models/status.rb')
-rw-r--r--app/models/status.rb29
1 files changed, 24 insertions, 5 deletions
diff --git a/app/models/status.rb b/app/models/status.rb
index 0baa5c98b..6c16046a5 100644
--- a/app/models/status.rb
+++ b/app/models/status.rb
@@ -379,8 +379,8 @@ class Status < ApplicationRecord
       apply_timeline_filters(query, account, local_only)
     end
 
-    def as_tag_timeline(tag, account = nil, local_only = false)
-      query = browsable_timeline_scope(local_only).tagged_with(tag)
+    def as_tag_timeline(tag, account = nil, local_only = false, priv = false)
+      query = tag_timeline_scope(account, local_only, priv).tagged_with(tag)
       apply_timeline_filters(query, account, local_only)
     end
 
@@ -465,9 +465,28 @@ class Status < ApplicationRecord
 
     def browsable_timeline_scope(local_only = false)
       starting_scope = local_only ? Status.network : Status
-      starting_scope
-        .public_browsable
-        .without_reblogs
+      starting_scope = starting_scope.public_browsable
+      if Setting.show_reblogs_in_public_timelines
+        starting_scope
+      else
+        starting_scope.without_reblogs
+      end
+    end
+
+    def tag_timeline_scope(account = nil, local_only = false, priv = false)
+      if priv
+        return Status.none if account.nil?
+        starting_scope = account.statuses
+      else
+        starting_scope = local_only ? Status.network : Status
+        starting_scope = scope.public_browsable
+      end
+
+      if Setting.show_reblogs_in_public_timelines
+        starting_scope
+      else
+        starting_scope.without_reblogs
+      end
     end
 
     def apply_timeline_filters(query, account, local_only)