diff options
Diffstat (limited to 'app/models')
-rw-r--r-- | app/models/media_attachment.rb | 1 | ||||
-rw-r--r-- | app/models/user.rb | 2 |
2 files changed, 3 insertions, 0 deletions
diff --git a/app/models/media_attachment.rb b/app/models/media_attachment.rb index c29a66eb2..cf73c22b8 100644 --- a/app/models/media_attachment.rb +++ b/app/models/media_attachment.rb @@ -55,6 +55,7 @@ class MediaAttachment < ApplicationRecord validates :account, presence: true scope :attached, -> { where.not(status_id: nil) } + scope :unattached, -> { where(status_id: nil) } scope :local, -> { where(remote_url: '') } default_scope { order(id: :asc) } diff --git a/app/models/user.rb b/app/models/user.rb index 2ad68f9ae..d0732ed59 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -35,6 +35,7 @@ class User < ApplicationRecord include Settings::Extend + ACTIVE_DURATION = 14.days devise :registerable, :recoverable, :rememberable, :trackable, :validatable, :confirmable, @@ -51,6 +52,7 @@ class User < ApplicationRecord scope :recent, -> { order(id: :desc) } scope :admins, -> { where(admin: true) } scope :confirmed, -> { where.not(confirmed_at: nil) } + scope :inactive, -> { where(arel_table[:current_sign_in_at].lt(ACTIVE_DURATION.ago)) } before_validation :sanitize_languages |