diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-04-08 03:09:11 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-04-08 03:09:11 +0300 |
commit | b89bcf56ec86e9b510ff0ae09887408e747e55f2 (patch) | |
tree | d0a9d51f4ecc4144e80f7e03ed947b7c36d7f4d3 /app/models/key.rb | |
parent | 9bc5f183df648e580c1d6682c2afc4ae96a28fe5 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/models/key.rb')
-rw-r--r-- | app/models/key.rb | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/app/models/key.rb b/app/models/key.rb index d9da700376a..131416d1bee 100644 --- a/app/models/key.rb +++ b/app/models/key.rb @@ -44,6 +44,7 @@ class Key < ApplicationRecord scope :for_user, -> (user) { where(user: user) } scope :order_last_used_at_desc, -> { reorder(::Gitlab::Database.nulls_last_order('last_used_at', 'DESC')) } scope :expired_today_and_not_notified, -> { where(["date(expires_at AT TIME ZONE 'UTC') = CURRENT_DATE AND expiry_notification_delivered_at IS NULL"]) } + scope :expiring_soon_and_not_notified, -> { where(["date(expires_at AT TIME ZONE 'UTC') > CURRENT_DATE AND date(expires_at AT TIME ZONE 'UTC') < ? AND before_expiry_notification_delivered_at IS NULL", DAYS_TO_EXPIRE.days.from_now.to_date]) } def self.regular_keys where(type: ['Key', nil]) |