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/concerns/obfuscate_filename.rb16
-rw-r--r--app/models/status.rb4
2 files changed, 4 insertions, 16 deletions
diff --git a/app/models/concerns/obfuscate_filename.rb b/app/models/concerns/obfuscate_filename.rb
deleted file mode 100644
index dc25cdbc2..000000000
--- a/app/models/concerns/obfuscate_filename.rb
+++ /dev/null
@@ -1,16 +0,0 @@
-module ObfuscateFilename
-  extend ActiveSupport::Concern
-
-  class_methods do
-    def obfuscate_filename(*args)
-      before_action { obfuscate_filename(*args) }
-    end
-  end
-
-  def obfuscate_filename(path)
-    file = params.dig(*path)
-    return if file.nil?
-
-    file.original_filename = "media" + File.extname(file.original_filename)
-  end
-end
diff --git a/app/models/status.rb b/app/models/status.rb
index 8f65a3ecc..87d8249b1 100644
--- a/app/models/status.rb
+++ b/app/models/status.rb
@@ -5,6 +5,8 @@ class Status < ApplicationRecord
   include Streamable
   include Cacheable
 
+  enum visibility: [:public, :unlisted], _suffix: :visibility
+
   belongs_to :account, inverse_of: :statuses
 
   belongs_to :thread, foreign_key: 'in_reply_to_id', class_name: 'Status', inverse_of: :replies
@@ -100,6 +102,7 @@ class Status < ApplicationRecord
 
     def as_public_timeline(account = nil)
       query = joins('LEFT OUTER JOIN accounts ON statuses.account_id = accounts.id')
+              .where(visibility: :public)
               .where('accounts.silenced = FALSE')
               .where('statuses.in_reply_to_id IS NULL')
               .where('statuses.reblog_of_id IS NULL')
@@ -110,6 +113,7 @@ class Status < ApplicationRecord
     def as_tag_timeline(tag, account = nil)
       query = tag.statuses
                  .joins('LEFT OUTER JOIN accounts ON statuses.account_id = accounts.id')
+                 .where(visibility: :public)
                  .where('accounts.silenced = FALSE')
                  .where('statuses.in_reply_to_id IS NULL')
                  .where('statuses.reblog_of_id IS NULL')