From ec34ec63b195d94a1ee43ac584ff74d84822222f Mon Sep 17 00:00:00 2001 From: Matt Jankowski Date: Mon, 22 May 2017 13:36:21 -0400 Subject: Specs for cleanup workers (#3235) * Add spec files for feed and media cleanup workers * Add coverage for feed and media cleanup schedulers * Clean up feed and media cleanup workers --- app/models/user.rb | 2 ++ 1 file changed, 2 insertions(+) (limited to 'app/models/user.rb') 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 -- cgit