Skip to content

Commit

Permalink
refactor: further simplified onChannelToggle
Browse files Browse the repository at this point in the history
  • Loading branch information
eemaanamir committed Jan 24, 2024
1 parent aeb8109 commit 36f7c93
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/notification-preferences/NotificationPreferenceApp.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,7 @@ const NotificationPreferenceApp = ({ appId }) => {

const onChannelToggle = useCallback((event) => {
const { id: notificationChannel } = event.target;
const isPreferenceNonEditable = (preference) => nonEditable?.[preference.id]?.includes(notificationChannel)
|| false;
const isPreferenceNonEditable = (preference) => nonEditable?.[preference.id]?.includes(notificationChannel);

Check warning on line 32 in src/notification-preferences/NotificationPreferenceApp.jsx

View check run for this annotation

Codecov / codecov/patch

src/notification-preferences/NotificationPreferenceApp.jsx#L31-L32

Added lines #L31 - L32 were not covered by tests

const activePreferences = appPreferences.filter(

Check warning on line 34 in src/notification-preferences/NotificationPreferenceApp.jsx

View check run for this annotation

Codecov / codecov/patch

src/notification-preferences/NotificationPreferenceApp.jsx#L34

Added line #L34 was not covered by tests
(preference) => preference[notificationChannel] && !isPreferenceNonEditable(preference),
Expand Down

0 comments on commit 36f7c93

Please sign in to comment.