diff --git a/app/models/concerns/expireable.rb b/app/models/concerns/expireable.rb index 15b911580..4d902abcb 100644 --- a/app/models/concerns/expireable.rb +++ b/app/models/concerns/expireable.rb @@ -30,7 +30,7 @@ module Expireable end def expires? - !expires_at.nil? && expires_at != ::Float::INFINITY + !expires_at.nil? end end end diff --git a/app/models/status.rb b/app/models/status.rb index dbd82de9d..81faca0b4 100644 --- a/app/models/status.rb +++ b/app/models/status.rb @@ -36,7 +36,6 @@ class Status < ApplicationRecord include Cacheable include StatusThreadingConcern include RateLimitable - include Expireable include Redisable rate_limit by: :account, family: :statuses @@ -102,7 +101,7 @@ class Status < ApplicationRecord scope :remote, -> { where(local: false).where.not(uri: nil) } scope :local, -> { where(local: true).or(where(uri: nil)) } - scope :not_expired, -> { where("COALESCE(statuses.expires_at,'infinity') >= CURRENT_TIMESTAMP") } + scope :not_expired, -> { where("statuses.expires_at >= CURRENT_TIMESTAMP") } scope :include_expired, -> { unscoped.recent.kept } scope :with_accounts, ->(ids) { where(id: ids).includes(:account) } scope :without_replies, -> { where('statuses.reply = FALSE OR statuses.in_reply_to_account_id = statuses.account_id') } @@ -257,6 +256,10 @@ class Status < ApplicationRecord media_attachments.any? end + def expires? + expires_at != ::Float::INFINITY + end + def non_sensitive_with_media? !sensitive? && with_media? end