diff --git a/app/src/main/java/org/thoughtcrime/securesms/notifications/profiles/NotificationProfiles.kt b/app/src/main/java/org/thoughtcrime/securesms/notifications/profiles/NotificationProfiles.kt index eddd472772..01404ce6d9 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/notifications/profiles/NotificationProfiles.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/notifications/profiles/NotificationProfiles.kt @@ -49,11 +49,7 @@ object NotificationProfiles { return manualProfile ?: scheduledProfile } - return if (manualProfile == scheduledProfile) { - manualProfile - } else { - scheduledProfile - } + return manualProfile } private fun shouldClearManualOverride(manualProfile: NotificationProfile?, scheduledProfile: NotificationProfile?): Boolean { diff --git a/app/src/test/java/org/thoughtcrime/securesms/notifications/profiles/NotificationProfilesTest.kt b/app/src/test/java/org/thoughtcrime/securesms/notifications/profiles/NotificationProfilesTest.kt index 7d510e5cd7..6da6152490 100644 --- a/app/src/test/java/org/thoughtcrime/securesms/notifications/profiles/NotificationProfilesTest.kt +++ b/app/src/test/java/org/thoughtcrime/securesms/notifications/profiles/NotificationProfilesTest.kt @@ -111,7 +111,7 @@ class NotificationProfilesTest { } @Test - fun `when first is scheduled and second is manually enabled forever before first's schedule start then return first`() { + fun `when first is scheduled and second is manually enabled forever before first's schedule start then return second`() { every { notificationProfileValues.manuallyEnabledProfile } returns second.id every { notificationProfileValues.manuallyEnabledUntil } returns Long.MAX_VALUE every { notificationProfileValues.manuallyDisabledAt } returns sunday830am.toMillis(ZoneOffset.UTC) @@ -119,7 +119,7 @@ class NotificationProfilesTest { val schedule = NotificationProfileSchedule(id = 3L, true, start = 900, daysEnabled = setOf(DayOfWeek.SUNDAY)) val profiles = listOf(first.copy(schedule = schedule), second) - assertThat(NotificationProfiles.getActiveProfile(profiles, sunday930am.toMillis(ZoneOffset.UTC), utc), "active profile is first").isEqualTo(profiles[0]) + assertThat(NotificationProfiles.getActiveProfile(profiles, sunday930am.toMillis(ZoneOffset.UTC), utc), "active profile is second").isEqualTo(profiles[1]) } @Test