Skip to content

Commit

Permalink
DEV: prevent initialized constant warning
Browse files Browse the repository at this point in the history
Was tired of seeing the following warnings in the logs

```
/discourse/app/jobs/scheduled/old_keys_reminder.rb:7: warning: already initialized constant Jobs::OldKeysReminder::OLD_CREDENTIALS_PERIOD
/discourse/app/jobs/scheduled/old_keys_reminder.rb:7: warning: previous definition of OLD_CREDENTIALS_PERIOD was here
```
  • Loading branch information
ZogStriP committed Jul 31, 2020
1 parent 8de635f commit 3f59d0c
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion app/jobs/scheduled/old_keys_reminder.rb
Expand Up @@ -4,12 +4,13 @@ module Jobs
class OldKeysReminder < ::Jobs::Scheduled
every 1.month

OLD_CREDENTIALS_PERIOD = 2.years
OLD_CREDENTIALS_PERIOD ||= 2.years

def execute(_args)
return if SiteSetting.send_old_credential_reminder_days.to_i == 0
return if message_exists?
return if old_site_settings_keys.blank? && old_api_keys.blank?

PostCreator.create!(
Discourse.system_user,
title: title,
Expand Down

0 comments on commit 3f59d0c

Please sign in to comment.