Skip to content

Commit

Permalink
Bug fix: reminder service not using config (#8369)
Browse files Browse the repository at this point in the history
* fix ID reminders config

* Turn on reminder property for tests
  • Loading branch information
mehansen authored Dec 26, 2024
1 parent c26128d commit 2ccf672
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
import java.util.TimeZone;
import lombok.extern.slf4j.Slf4j;
import net.javacrumbs.shedlock.spring.annotation.SchedulerLock;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
Expand All @@ -28,6 +28,9 @@ public class ReminderService {
private final OrganizationQueueRepository _orgQueueRepo;
private final EmailService _emailService;

@Value("${simple-report.id-verification-reminders.enabled}")
private boolean remindersEnabled;

public ReminderService(OrganizationQueueRepository orgQueueRepo, EmailService emailService) {
_orgQueueRepo = orgQueueRepo;
_emailService = emailService;
Expand All @@ -42,9 +45,12 @@ public ReminderService(OrganizationQueueRepository orgQueueRepo, EmailService em
name = "ReminderService_sendAccountReminderEmails",
lockAtLeastFor = "PT30S",
lockAtMostFor = "PT30M")
@ConditionalOnProperty("simple-report.id-verification-reminders.enabled")
public void scheduledSendAccountReminderEmails() {
sendAccountReminderEmails();
if (remindersEnabled) {
sendAccountReminderEmails();
} else {
log.info("Skipping sending ID verification reminder emails");
}
}

/*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,10 @@
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.mock.mockito.MockBean;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.test.context.TestPropertySource;
import org.springframework.transaction.annotation.Transactional;

@TestPropertySource(properties = {"simple-report.id-verification-reminders.enabled=true"})
class ReminderServiceTest extends BaseServiceTest<ReminderService> {

@Autowired private JdbcTemplate _jdbc;
Expand Down

0 comments on commit 2ccf672

Please sign in to comment.