DEV: prevent initialized constant warning

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
```
This commit is contained in:
Régis Hanol 2020-07-31 18:05:12 +02:00 committed by GitHub
parent 8de635fe92
commit 3f59d0cffe
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 1 deletions

View File

@ -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,