Change to remove coalesce for null from conditional expression in statuses.expires_at
This commit is contained in:
parent
788289011f
commit
8029bd9afb
2 changed files with 6 additions and 3 deletions
|
@ -30,7 +30,7 @@ module Expireable
|
||||||
end
|
end
|
||||||
|
|
||||||
def expires?
|
def expires?
|
||||||
!expires_at.nil? && expires_at != ::Float::INFINITY
|
!expires_at.nil?
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -36,7 +36,6 @@ class Status < ApplicationRecord
|
||||||
include Cacheable
|
include Cacheable
|
||||||
include StatusThreadingConcern
|
include StatusThreadingConcern
|
||||||
include RateLimitable
|
include RateLimitable
|
||||||
include Expireable
|
|
||||||
include Redisable
|
include Redisable
|
||||||
|
|
||||||
rate_limit by: :account, family: :statuses
|
rate_limit by: :account, family: :statuses
|
||||||
|
@ -102,7 +101,7 @@ class Status < ApplicationRecord
|
||||||
scope :remote, -> { where(local: false).where.not(uri: nil) }
|
scope :remote, -> { where(local: false).where.not(uri: nil) }
|
||||||
scope :local, -> { where(local: true).or(where(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 :include_expired, -> { unscoped.recent.kept }
|
||||||
scope :with_accounts, ->(ids) { where(id: ids).includes(:account) }
|
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') }
|
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?
|
media_attachments.any?
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def expires?
|
||||||
|
expires_at != ::Float::INFINITY
|
||||||
|
end
|
||||||
|
|
||||||
def non_sensitive_with_media?
|
def non_sensitive_with_media?
|
||||||
!sensitive? && with_media?
|
!sensitive? && with_media?
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue