Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added more specific reservation period collision error notification #328

Merged
merged 1 commit into from
May 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion app/i18n/messages/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,7 @@
"Notifications.cannotReserveDuringMaintenance": "Cannot make reservations during maintenance.",
"Notifications.continousFreeDaysError": "You can only select a continuous period of available days",
"Notifications.errorMessage": "Something went wrong. Please try again in a moment.",
"Notifications.error.period": "The resource is not reservable at your selected time. Please choose a new time from the calendar.",
"Notifications.loginErrorMessage": "Failed to login. Please try again in a moment.",
"Notifications.userFetchErrorMessage": "Failed to retrieve user info. Please try again in a moment.",
"Notifications.loginMessage": "Sign in to continue.",
Expand Down Expand Up @@ -554,4 +555,4 @@
"UserReservationsPage.regularEmptyMessage": "No standard reservations",
"UserReservationsPage.regularReservationsHeader": "Standard reservations",
"UserReservationsPage.title": "My reservations"
}
}
3 changes: 2 additions & 1 deletion app/i18n/messages/fi.json
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,7 @@
"Notifications.cannotReserveDuringMaintenance": "Huoltotyön aikana ei voi tehdä varauksia.",
"Notifications.continousFreeDaysError": "Voit valita vain yhtenäisen jakson vapaita päiviä",
"Notifications.errorMessage": "Jotain meni vikaan. Yritä hetken päästä uudelleen.",
"Notifications.error.period": "Kohde ei ole varattavissa valitsemallasi ajalle. Valitse kalenterista uusi aika.",
"Notifications.loginErrorMessage": "Kirjautuminen epäonnistui. Yritä hetken päästä uudelleen.",
"Notifications.userFetchErrorMessage": "Käyttäjätietojen hakeminen epäonnistui. Yritä hetken päästä uudelleen.",
"Notifications.loginMessage": "Kirjaudu sisään jatkaaksesi.",
Expand Down Expand Up @@ -554,4 +555,4 @@
"UserReservationsPage.regularEmptyMessage": "Ei tavallisia varauksia näytettäväksi.",
"UserReservationsPage.regularReservationsHeader": "Tavalliset varaukset",
"UserReservationsPage.title": "Omat varaukset"
}
}
3 changes: 2 additions & 1 deletion app/i18n/messages/sv.json
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,7 @@
"Notifications.cannotReserveDuringMaintenance": "Det går inte att göra reservationer under underhåll.",
"Notifications.continousFreeDaysError": "Du kan bara välja en sammanhängande period av lediga dagar",
"Notifications.errorMessage": "Ett fel uppstod. Försök på nytt om en liten stund.",
"Notifications.error.period": "Resursen är inte bokningsbar vid den valda tiden. Vänligen välj en ny tid från kalendern.",
"Notifications.loginErrorMessage": "Inloggning misslyckades. Försök igen om en liten stund.",
"Notifications.userFetchErrorMessage": "Användarinformations hämtning misslyckades. Försök igen om en liten stund.",
"Notifications.loginMessage": "Logga in för att fortsätta.",
Expand Down Expand Up @@ -556,4 +557,4 @@
"UserReservationsPage.regularEmptyMessage": "Det finns inga vanliga bokningar att visa.",
"UserReservationsPage.regularReservationsHeader": "Vanliga bokningar",
"UserReservationsPage.title": "Mina bokningar"
}
}
7 changes: 7 additions & 0 deletions app/state/reducers/notificationsReducer.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,13 @@ function getErrorNotification(error) {
};
}

if (error.response && error.response.period) {
return {
...defaults,
messageId: 'Notifications.error.period',
};
}

if (error.response && error.response.detail) {
return {
...defaults,
Expand Down
11 changes: 11 additions & 0 deletions app/state/reducers/notificationsReducer.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,17 @@ describe('state/reducers/notificationReducer', () => {
expect(actualNotifications[0].message).toEqual('some recurring error');
});

test('show period error when period is specified', () => {
const action = errorAction({
response: {
period: 'some period error'
},
});

const actualNotifications = notificationsReducer(initialState, action);
expect(actualNotifications[0].messageId).toEqual('Notifications.error.period');
});

test('show detail message when response is specified', () => {
const action = errorAction({
response: {
Expand Down
Loading