diff --git a/CHANGELOG.md b/CHANGELOG.md index 2147156cb..f30ef9d68 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,14 @@ # Changelog Fab-manager +## v6.2.0 2023 October 13 + +- Fix a bug: fix ReservationReminderWorker, was sending reservation reminder to users with a event reservation not validated by admin + adds tests for all scenarios +- Fix a bug: admin could not create new SupportingDocumentType (problem was on js side) +- Fix a bug: fix back button on space edit page +- Fix a bug: fix members tour (help), a selector was not valid anymore +- Fix a bug: unable to save OpenID extra_authorize_params as json +- Fix machine list bug : when there is no user logged in and access machines list with at least one machine associated to a space + ## v6.1.2 2023 October 2 - Fix a bug: minor pb (exception raised) when bot hit api/projects#search without beeing authenticated diff --git a/app/frontend/src/javascript/components/events/event-form.tsx b/app/frontend/src/javascript/components/events/event-form.tsx index e65570bb4..be1330378 100644 --- a/app/frontend/src/javascript/components/events/event-form.tsx +++ b/app/frontend/src/javascript/components/events/event-form.tsx @@ -218,7 +218,8 @@ export const EventForm: React.FC = ({ action, event, onError, on id="event_image_attributes" accept="image/*" defaultImage={output.event_image_attributes} - label={t('app.admin.event_form.matching_visual')} /> + label={t('app.admin.event_form.illustration')} + tooltip={t('app.admin.event_form.illustration_recommendation')} /> = FormComponent /** * This component allows to upload image, in forms managed by react-hook-form. */ -export const FormImageUpload = ({ id, label, register, control, defaultImage, className, rules, disabled, error, warning, formState, onFileChange, onFileRemove, accept, setValue, size, onFileIsMain, mainOption = false }: FormImageUploadProps) => { +export const FormImageUpload = ({ id, label, register, control, defaultImage, className, rules, disabled, error, warning, formState, onFileChange, onFileRemove, accept, setValue, size, onFileIsMain, mainOption = false, tooltip }: FormImageUploadProps) => { const { t } = useTranslation('shared'); const [file, setFile] = useState(defaultImage); @@ -125,7 +125,8 @@ export const FormImageUpload = + placeholder={placeholder()} + tooltip={tooltip} /> {hasImage() && } className="is-main" />} diff --git a/app/frontend/src/javascript/components/machines/machine-card.tsx b/app/frontend/src/javascript/components/machines/machine-card.tsx index dd7bb372d..7c0a2770a 100644 --- a/app/frontend/src/javascript/components/machines/machine-card.tsx +++ b/app/frontend/src/javascript/components/machines/machine-card.tsx @@ -58,7 +58,7 @@ const MachineCard: React.FC = ({ user, machine, onShowMachine, return (
{machinePicture()} - {machine.space && user.role === 'admin' && } + {machine.space && user && user.role === 'admin' && }
{machine.name}
diff --git a/app/frontend/src/javascript/components/machines/machine-form.tsx b/app/frontend/src/javascript/components/machines/machine-form.tsx index 886b1e5fa..f000232b3 100644 --- a/app/frontend/src/javascript/components/machines/machine-form.tsx +++ b/app/frontend/src/javascript/components/machines/machine-form.tsx @@ -123,7 +123,8 @@ export const MachineForm: React.FC = ({ action, machine, onErr id="machine_image_attributes" accept="image/*" defaultImage={output.machine_image_attributes} - label={t('app.admin.machine_form.illustration')} /> + label={t('app.admin.machine_form.illustration')} + tooltip={t('app.admin.machine_form.illustration_recommendation')} /> = ({ action, space, onError, on id="space_image_attributes" accept="image/*" defaultImage={output.space_image_attributes} - label={t('app.admin.space_form.illustration')} /> + label={t('app.admin.space_form.illustration')} + tooltip={t('app.admin.space_form.illustration_recommendation')} /> { + return (supportingDocumentType == null || supportingDocumentType?.document_type === 'User') && (groups.length > 0); + }; + return (
{t('app.admin.settings.account.supporting_documents_type_form.type_form_info')}
- {supportingDocumentType?.document_type === 'User' && + {displayGroupsSelect() &&
diff --git a/app/models/open_id_connect_provider.rb b/app/models/open_id_connect_provider.rb index 26989cc32..ba94049cf 100644 --- a/app/models/open_id_connect_provider.rb +++ b/app/models/open_id_connect_provider.rb @@ -16,4 +16,16 @@ class OpenIdConnectProvider < ApplicationRecord validates :display, inclusion: { in: %w[page popup touch wap], allow_nil: true } validates :prompt, inclusion: { in: %w[none login consent select_account], allow_nil: true } validates :client_auth_method, inclusion: { in: %w[basic jwks] } + store_accessor :extra_authorize_params + + def extra_authorize_params=(val) + return unless val.is_a?(String) + + begin + super JSON.parse(val) + rescue JSON::ParserError + errors[:extra_authorize_params].add('is not valid JSON') + super + end + end end diff --git a/app/views/api/auth_providers/show.json.jbuilder b/app/views/api/auth_providers/show.json.jbuilder index 44cebfa0b..2700aeed3 100644 --- a/app/views/api/auth_providers/show.json.jbuilder +++ b/app/views/api/auth_providers/show.json.jbuilder @@ -16,6 +16,6 @@ if @provider.providable_type == OpenIdConnectProvider.name :prompt, :send_scope_to_token_endpoint, :client__identifier, :client__secret, :client__authorization_endpoint, :client__token_endpoint, :client__userinfo_endpoint, :client__jwks_uri, :client__end_session_endpoint, :profile_url json.scope @provider.providable[:scope] - json.extra_authorize_params @provider.providable[:extra_authorize_params] + json.extra_authorize_params @provider.providable[:extra_authorize_params].to_json end end diff --git a/app/views/layouts/notifications_mailer.html.erb b/app/views/layouts/notifications_mailer.html.erb index 262c560af..7486928d6 100644 --- a/app/views/layouts/notifications_mailer.html.erb +++ b/app/views/layouts/notifications_mailer.html.erb @@ -26,13 +26,13 @@ <%=fablab_name%> + width="140" /> <% else %> <%=fablab_name%> + width="140" /> <% end %> diff --git a/app/workers/reservation_reminder_worker.rb b/app/workers/reservation_reminder_worker.rb index ca68ebbbc..7c8dacc47 100644 --- a/app/workers/reservation_reminder_worker.rb +++ b/app/workers/reservation_reminder_worker.rb @@ -17,6 +17,7 @@ class ReservationReminderWorker Reservation.joins(slots_reservations: :slot) .where('slots.start_at >= ? AND slots.start_at <= ? AND slots_reservations.canceled_at IS NULL', starting, ending) + .includes(:reservable, :slots_reservations) .each do |r| already_sent = Notification.where( attached_object_type: Reservation.name, @@ -24,6 +25,7 @@ class ReservationReminderWorker notification_type_id: NotificationType.find_by(name: 'notify_member_reservation_reminder') ).count next if already_sent.positive? + next if r.reservable.is_a?(Event) && r.reservable.pre_registration? && !r.slots_reservations.all?(&:is_valid?) NotificationCenter.call type: 'notify_member_reservation_reminder', receiver: r.user, diff --git a/config/locales/app.admin.de.yml b/config/locales/app.admin.de.yml index 14a9d3f76..398880b90 100644 --- a/config/locales/app.admin.de.yml +++ b/config/locales/app.admin.de.yml @@ -47,6 +47,7 @@ de: description: "Beschreibung" name: "Name" illustration: "Visual" + illustration_recommendation: "Maximum display size: 932 * 700 px (unconstrained ratio). The image may be cropped in list view. Only the description page displays the full image." technical_specifications: "Technical specifications" category: "Kategorie" attachments: "Anhänge" @@ -66,7 +67,8 @@ de: dont_forget_to_change_them_before_creating_slots_for_this_training: "Don't forget to change them before creating slots for this training." description: "Beschreibung" name: "Name" - illustration: "Illustration" + illustration: "Visual" + illustration_recommendation: "Maximum display size: 932 * 700 px (unconstrained ratio). The image may be cropped in list view. Only the description page displays the full image." add_a_new_training: "Add a new training" validate_your_training: "Validate your training" settings: "Einstellungen" @@ -98,7 +100,8 @@ de: watch_out_when_creating_a_new_space_its_prices_are_initialized_at_0_for_all_subscriptions: "Achtung! Beim Erstellen eines neuen Raums wird sein Preis für alle Abonnements mit 0 angelegt." consider_changing_its_prices_before_creating_any_reservation_slot: "Ändern Sie ggf. die Preise, bevor Sie Reservierungs-Slots erstellen." name: "Name" - illustration: "Abbildung" + illustration: "Visual" + illustration_recommendation: "Maximum display size: 932 * 700 px (unconstrained ratio). The image may be cropped in list view. Only the description page displays the full image." description: "Beschreibung" characteristics: "Eigenschaften" attachments: "Dateianhänge" @@ -118,7 +121,8 @@ de: event_form: ACTION_title: "{ACTION, select, create{Neue} other{Aktualisiere die}} Veranstaltung" title: "Titel" - matching_visual: "Matching visual" + illustration: "Visual" + illustration_recommendation: "Maximum display size: 932 * 700 px (unconstrained ratio). The image may be cropped in list view. Only the description page displays the full image." description: "Beschreibung" attachments: "Anhänge" attached_files_pdf: "Angehängte Dateien (pdf)" @@ -1664,6 +1668,7 @@ de: secondary_colour: "Sekundärfarbe:" secondary: "Sekundär" background_picture_of_the_profile_banner: "Hintergrundbild des Profil-Banners" + background_picture_recommendation: "Only .png file. Recommended size: 4/1 ratio, 1600*400 px." change_the_profile_banner: "Profil-Banner ändern" home_page: "Homepage" news_of_the_home_page: "Neuigkeiten der Homepage:" diff --git a/config/locales/app.admin.en.yml b/config/locales/app.admin.en.yml index 1c2bd6e66..aec354922 100644 --- a/config/locales/app.admin.en.yml +++ b/config/locales/app.admin.en.yml @@ -47,6 +47,7 @@ en: description: "Description" name: "Name" illustration: "Visual" + illustration_recommendation: "Maximum display size: 932 * 700 px (unconstrained ratio). The image may be cropped in list view. Only the description page displays the full image." technical_specifications: "Technical specifications" category: "Category" attachments: "Attachments" @@ -66,7 +67,8 @@ en: dont_forget_to_change_them_before_creating_slots_for_this_training: "Don't forget to change them before creating slots for this training." description: "Description" name: "Name" - illustration: "Illustration" + illustration: "Visual" + illustration_recommendation: "Maximum display size: 932 * 700 px (unconstrained ratio). The image may be cropped in list view. Only the description page displays the full image." add_a_new_training: "Add a new training" validate_your_training: "Validate your training" settings: "Settings" @@ -98,7 +100,8 @@ en: watch_out_when_creating_a_new_space_its_prices_are_initialized_at_0_for_all_subscriptions: "Watch out! When creating a new space, its prices are initialized at 0 for all subscriptions." consider_changing_its_prices_before_creating_any_reservation_slot: "Consider changing its prices before creating any reservation slot." name: "Name" - illustration: "Illustration" + illustration: "Visual" + illustration_recommendation: "Maximum display size: 932 * 700 px (unconstrained ratio). The image may be cropped in list view. Only the description page displays the full image." description: "Description" characteristics: "Characteristics" attachments: "Attachments" @@ -118,7 +121,8 @@ en: event_form: ACTION_title: "{ACTION, select, create{New} other{Update the}} event" title: "Title" - matching_visual: "Matching visual" + illustration: "Visual" + illustration_recommendation: "Maximum display size: 932 * 700 px (unconstrained ratio). The image may be cropped in list view. Only the description page displays the full image." description: "Description" attachments: "Attachments" attached_files_pdf: "Attached files (pdf)" @@ -1664,6 +1668,7 @@ en: secondary_colour: "Secondary colour:" secondary: "Secondary" background_picture_of_the_profile_banner: "Background picture of the profile banner" + background_picture_recommendation: "Only .png file. Recommended size: 4/1 ratio, 1600*400 px." change_the_profile_banner: "Change the profile banner" home_page: "Home page" news_of_the_home_page: "News of the home page:" diff --git a/config/locales/app.admin.es.yml b/config/locales/app.admin.es.yml index 10c103082..90d010311 100644 --- a/config/locales/app.admin.es.yml +++ b/config/locales/app.admin.es.yml @@ -47,6 +47,7 @@ es: description: "Descripción" name: "Nombre" illustration: "Ilustración" + illustration_recommendation: "Maximum display size: 932 * 700 px (unconstrained ratio). The image may be cropped in list view. Only the description page displays the full image." technical_specifications: "Especificaciones técnicas" category: "Categoría" attachments: "Adjuntos" @@ -66,7 +67,8 @@ es: dont_forget_to_change_them_before_creating_slots_for_this_training: "No olvide cambiarlos antes de crear franjas horarias para esta formación." description: "Descripción" name: "Nombre" - illustration: "Ilustración" + illustration: "Visual" + illustration_recommendation: "Maximum display size: 932 * 700 px (unconstrained ratio). The image may be cropped in list view. Only the description page displays the full image." add_a_new_training: "Añadir una nueva formación" validate_your_training: "Valide su formación" settings: "Configuración" @@ -98,7 +100,8 @@ es: watch_out_when_creating_a_new_space_its_prices_are_initialized_at_0_for_all_subscriptions: "¡Cuidado! Al crear un nuevo espacio, sus precios se inicializan a 0 para todas las suscripciones." consider_changing_its_prices_before_creating_any_reservation_slot: "Considere cambiar sus precios antes de crear cualquier espacio de reserva." name: "Nombre" - illustration: "Illustración" + illustration: "Visual" + illustration_recommendation: "Maximum display size: 932 * 700 px (unconstrained ratio). The image may be cropped in list view. Only the description page displays the full image." description: "Descripción" characteristics: "Características" attachments: "Adjuntos" @@ -118,7 +121,8 @@ es: event_form: ACTION_title: "{ACTION, select, create{Nuevo} other{Actualiza el}} evento" title: "Título" - matching_visual: "Coincidiendo visual" + illustration: "Visual" + illustration_recommendation: "Maximum display size: 932 * 700 px (unconstrained ratio). The image may be cropped in list view. Only the description page displays the full image." description: "Descripción" attachments: "Adjuntos" attached_files_pdf: "Archivos adjuntos (pdf)" @@ -1664,6 +1668,7 @@ es: secondary_colour: "Color secundario:" secondary: "Secundario" background_picture_of_the_profile_banner: "Imagen de fondo de la bandera del perfil" + background_picture_recommendation: "Only .png file. Recommended size: 4/1 ratio, 1600*400 px." change_the_profile_banner: "Cambiar la bandera del perfil" home_page: "Página de inicio" news_of_the_home_page: "Noticias de la página principal:" diff --git a/config/locales/app.admin.fr.yml b/config/locales/app.admin.fr.yml index 6c5c73d7d..a340b1efc 100644 --- a/config/locales/app.admin.fr.yml +++ b/config/locales/app.admin.fr.yml @@ -47,6 +47,7 @@ fr: description: "Description" name: "Nom" illustration: "Illustration" + illustration_recommendation: "Taille maximale d'affichage : 932 * 700 px (ratio non contraint). L'image peut être recadrée dans la vue en liste. Seule la page de description affiche l'image complète." technical_specifications: "Caractéristiques techniques" category: "Catégorie" attachments: "Pièces jointes" @@ -67,6 +68,7 @@ fr: description: "Description" name: "Nom" illustration: "Visuel" + illustration_recommendation: "Taille maximale d'affichage : 932 * 700 px (ratio non contraint). L'image peut être recadrée dans la vue en liste. Seule la page de description affiche l'image complète." add_a_new_training: "Ajouter une nouvelle formation" validate_your_training: "Valider votre formation" settings: "Paramètres" @@ -99,6 +101,7 @@ fr: consider_changing_its_prices_before_creating_any_reservation_slot: "Pensez à modifier ces prix avant de créer des créneaux pour cet espace." name: "Nom" illustration: "Visuel" + illustration_recommendation: "Taille maximale d'affichage : 932 * 700 px (ratio non contraint). L'image peut être recadrée dans la vue en liste. Seule la page de description affiche l'image complète." description: "Description" characteristics: "Caractéristiques" attachments: "Pièces jointes" @@ -118,7 +121,8 @@ fr: event_form: ACTION_title: "{ACTION, select, create{Nouvel } other{Mettre à jour l''}}événement" title: "Titre" - matching_visual: "Visuel associé" + illustration: "Visuel" + illustration_recommendation: "Taille maximale d'affichage : 932 * 700 px (ratio non contraint). L'image peut être recadrée dans la vue en liste. Seule la page de description affiche l'image complète." description: "Description" attachments: "Pièces jointes" attached_files_pdf: "Pièces jointes (pdf)" @@ -1664,6 +1668,7 @@ fr: secondary_colour: "Couleur secondaire :" secondary: "Secondaire" background_picture_of_the_profile_banner: "Image de fond du bandeau de profil" + background_picture_recommendation: "Seulement un fichier .png. Taille recommandée : ratio 4/1, 1600 * 400 px." change_the_profile_banner: "Changer le bandeau de profil" home_page: "Page d'accueil" news_of_the_home_page: "Brève de la page d'accueil :" diff --git a/config/locales/app.admin.it.yml b/config/locales/app.admin.it.yml index 29fe5ca80..b00d22a3a 100644 --- a/config/locales/app.admin.it.yml +++ b/config/locales/app.admin.it.yml @@ -47,6 +47,7 @@ it: description: "Descrizione" name: "Nome" illustration: "Illustrazione" + illustration_recommendation: "Maximum display size: 932 * 700 px (unconstrained ratio). The image may be cropped in list view. Only the description page displays the full image." technical_specifications: "Specifiche tecniche" category: "Categoria" attachments: "Allegati" @@ -66,7 +67,8 @@ it: dont_forget_to_change_them_before_creating_slots_for_this_training: "Non dimenticare di cambiarli prima di creare slot per questo addestramento." description: "Descrizione" name: "Nome" - illustration: "Illustrazione" + illustration: "Visual" + illustration_recommendation: "Maximum display size: 932 * 700 px (unconstrained ratio). The image may be cropped in list view. Only the description page displays the full image." add_a_new_training: "Aggiungi un nuovo addestramento" validate_your_training: "Convalida il tuo addestramento" settings: "Impostazioni" @@ -98,7 +100,8 @@ it: watch_out_when_creating_a_new_space_its_prices_are_initialized_at_0_for_all_subscriptions: "Attenzione! Quando si crea un nuovo spazio, i suoi prezzi sono inizializzati a 0 per tutti gli abbonamenti." consider_changing_its_prices_before_creating_any_reservation_slot: "Valuta se cambiare i suoi prezzi prima di creare qualsiasi slot di prenotazione." name: "Nome" - illustration: "Illustrazione" + illustration: "Visual" + illustration_recommendation: "Maximum display size: 932 * 700 px (unconstrained ratio). The image may be cropped in list view. Only the description page displays the full image." description: "Descrizione" characteristics: "Caratteristiche" attachments: "Allegati" @@ -118,7 +121,8 @@ it: event_form: ACTION_title: "{ACTION, select, create{Nuovo} other{Aggiorna}} evento" title: "Titolo" - matching_visual: "Corrispondenza illustazione" + illustration: "Visual" + illustration_recommendation: "Maximum display size: 932 * 700 px (unconstrained ratio). The image may be cropped in list view. Only the description page displays the full image." description: "Descrizione" attachments: "Allegati" attached_files_pdf: "File allegati (pdf)" @@ -1664,6 +1668,7 @@ it: secondary_colour: "Colore secondario:" secondary: "Secondario" background_picture_of_the_profile_banner: "Immagine di sfondo del banner del profilo" + background_picture_recommendation: "Only .png file. Recommended size: 4/1 ratio, 1600*400 px." change_the_profile_banner: "Cambia il banner del profilo" home_page: "Home page" news_of_the_home_page: "Notizie della home page:" diff --git a/config/locales/app.admin.no.yml b/config/locales/app.admin.no.yml index afcbcd97c..77eddb1b3 100644 --- a/config/locales/app.admin.no.yml +++ b/config/locales/app.admin.no.yml @@ -47,6 +47,7 @@ description: "Description" name: "Name" illustration: "Visual" + illustration_recommendation: "Maximum display size: 932 * 700 px (unconstrained ratio). The image may be cropped in list view. Only the description page displays the full image." technical_specifications: "Technical specifications" category: "Category" attachments: "Attachments" @@ -66,7 +67,8 @@ dont_forget_to_change_them_before_creating_slots_for_this_training: "Don't forget to change them before creating slots for this training." description: "Description" name: "Name" - illustration: "Illustration" + illustration: "Visual" + illustration_recommendation: "Maximum display size: 932 * 700 px (unconstrained ratio). The image may be cropped in list view. Only the description page displays the full image." add_a_new_training: "Add a new training" validate_your_training: "Validate your training" settings: "Settings" @@ -98,7 +100,8 @@ watch_out_when_creating_a_new_space_its_prices_are_initialized_at_0_for_all_subscriptions: "Watch out! When creating a new space, its prices are initialized at 0 for all subscriptions." consider_changing_its_prices_before_creating_any_reservation_slot: "Consider changing its prices before creating any reservation slot." name: "Name" - illustration: "Illustration" + illustration: "Visual" + illustration_recommendation: "Maximum display size: 932 * 700 px (unconstrained ratio). The image may be cropped in list view. Only the description page displays the full image." description: "Description" characteristics: "Characteristics" attachments: "Attachments" @@ -118,7 +121,8 @@ event_form: ACTION_title: "{ACTION, select, create{New} other{Update the}} event" title: "Title" - matching_visual: "Matching visual" + illustration: "Visual" + illustration_recommendation: "Maximum display size: 932 * 700 px (unconstrained ratio). The image may be cropped in list view. Only the description page displays the full image." description: "Description" attachments: "Attachments" attached_files_pdf: "Attached files (pdf)" @@ -1664,6 +1668,7 @@ secondary_colour: "Secondary colour:" secondary: "Secondary" background_picture_of_the_profile_banner: "Background picture of the profile banner" + background_picture_recommendation: "Only .png file. Recommended size: 4/1 ratio, 1600*400 px." change_the_profile_banner: "Change the profile banner" home_page: "Hjemmeside" news_of_the_home_page: "News of the home page:" diff --git a/config/locales/app.admin.pt.yml b/config/locales/app.admin.pt.yml index dde633bc6..faf5a71bc 100644 --- a/config/locales/app.admin.pt.yml +++ b/config/locales/app.admin.pt.yml @@ -47,6 +47,7 @@ pt: description: "Descrição" name: "Nome" illustration: "Visual" + illustration_recommendation: "Maximum display size: 932 * 700 px (unconstrained ratio). The image may be cropped in list view. Only the description page displays the full image." technical_specifications: "Especificações técnicas" category: "Categoria" attachments: "Anexos" @@ -66,7 +67,8 @@ pt: dont_forget_to_change_them_before_creating_slots_for_this_training: "Don't forget to change them before creating slots for this training." description: "Descrição" name: "Nome" - illustration: "Ilustração" + illustration: "Visual" + illustration_recommendation: "Maximum display size: 932 * 700 px (unconstrained ratio). The image may be cropped in list view. Only the description page displays the full image." add_a_new_training: "Adicionar um novo treinamento" validate_your_training: "Validar seu treinamento" settings: "Confirgurações" @@ -98,7 +100,8 @@ pt: watch_out_when_creating_a_new_space_its_prices_are_initialized_at_0_for_all_subscriptions: "Watch out! When creating a new space, its prices are initialized at 0 for all subscriptions." consider_changing_its_prices_before_creating_any_reservation_slot: "Consider changing its prices before creating any reservation slot." name: "Name" - illustration: "Illustration" + illustration: "Visual" + illustration_recommendation: "Maximum display size: 932 * 700 px (unconstrained ratio). The image may be cropped in list view. Only the description page displays the full image." description: "Description" characteristics: "Characteristics" attachments: "Attachments" @@ -118,7 +121,8 @@ pt: event_form: ACTION_title: "{ACTION, select, create{New} other{Update the}} event" title: "Title" - matching_visual: "Matching visual" + illustration: "Visual" + illustration_recommendation: "Maximum display size: 932 * 700 px (unconstrained ratio). The image may be cropped in list view. Only the description page displays the full image." description: "Description" attachments: "Attachments" attached_files_pdf: "Attached files (pdf)" @@ -1664,6 +1668,7 @@ pt: secondary_colour: "Cor secundária:" secondary: "Secundária" background_picture_of_the_profile_banner: "Imagem de plano de fundo do perfil" + background_picture_recommendation: "Only .png file. Recommended size: 4/1 ratio, 1600*400 px." change_the_profile_banner: "Alterar a capa do perfil" home_page: "Página inicial" news_of_the_home_page: "Notícias da página inicial:" diff --git a/config/locales/app.admin.zu.yml b/config/locales/app.admin.zu.yml index e4c09eb7b..b17bcb1eb 100644 --- a/config/locales/app.admin.zu.yml +++ b/config/locales/app.admin.zu.yml @@ -47,6 +47,7 @@ zu: description: "crwdns31665:0crwdne31665:0" name: "crwdns31659:0crwdne31659:0" illustration: "crwdns31661:0crwdne31661:0" + illustration_recommendation: "crwdns38114:0crwdne38114:0" technical_specifications: "crwdns31667:0crwdne31667:0" category: "crwdns36215:0crwdne36215:0" attachments: "crwdns36833:0crwdne36833:0" @@ -66,7 +67,8 @@ zu: dont_forget_to_change_them_before_creating_slots_for_this_training: "crwdns36843:0crwdne36843:0" description: "crwdns31767:0crwdne31767:0" name: "crwdns31763:0crwdne31763:0" - illustration: "crwdns31765:0crwdne31765:0" + illustration: "crwdns38116:0crwdne38116:0" + illustration_recommendation: "crwdns38118:0crwdne38118:0" add_a_new_training: "crwdns31769:0crwdne31769:0" validate_your_training: "crwdns31771:0crwdne31771:0" settings: "crwdns36845:0crwdne36845:0" @@ -98,7 +100,8 @@ zu: watch_out_when_creating_a_new_space_its_prices_are_initialized_at_0_for_all_subscriptions: "crwdns36877:0crwdne36877:0" consider_changing_its_prices_before_creating_any_reservation_slot: "crwdns36879:0crwdne36879:0" name: "crwdns31793:0crwdne31793:0" - illustration: "crwdns31795:0crwdne31795:0" + illustration: "crwdns38120:0crwdne38120:0" + illustration_recommendation: "crwdns38122:0crwdne38122:0" description: "crwdns31797:0crwdne31797:0" characteristics: "crwdns31799:0crwdne31799:0" attachments: "crwdns36881:0crwdne36881:0" @@ -118,7 +121,8 @@ zu: event_form: ACTION_title: "crwdns36887:0ACTION={ACTION}crwdne36887:0" title: "crwdns31817:0crwdne31817:0" - matching_visual: "crwdns31819:0crwdne31819:0" + illustration: "crwdns38124:0crwdne38124:0" + illustration_recommendation: "crwdns38126:0crwdne38126:0" description: "crwdns31821:0crwdne31821:0" attachments: "crwdns31823:0crwdne31823:0" attached_files_pdf: "crwdns36889:0crwdne36889:0" @@ -1664,6 +1668,7 @@ zu: secondary_colour: "crwdns26398:0crwdne26398:0" secondary: "crwdns26400:0crwdne26400:0" background_picture_of_the_profile_banner: "crwdns26402:0crwdne26402:0" + background_picture_recommendation: "crwdns38128:0crwdne38128:0" change_the_profile_banner: "crwdns26404:0crwdne26404:0" home_page: "crwdns26406:0crwdne26406:0" news_of_the_home_page: "crwdns26408:0crwdne26408:0" diff --git a/config/locales/app.shared.de.yml b/config/locales/app.shared.de.yml index 39f538ca8..311f28cf6 100644 --- a/config/locales/app.shared.de.yml +++ b/config/locales/app.shared.de.yml @@ -128,6 +128,7 @@ de: name: "Name" name_is_required: "Name ist erforderlich." illustration: "Ansicht" + illustration_recommendation: "Maximum display size: 932 * 700 px (unconstrained ratio)." add_an_illustration: "Illustration hinzufügen" CAD_file: "CAD-Datei" CAD_files: "CAD files" diff --git a/config/locales/app.shared.en.yml b/config/locales/app.shared.en.yml index f9ec42c3a..ac7f8b2b7 100644 --- a/config/locales/app.shared.en.yml +++ b/config/locales/app.shared.en.yml @@ -128,6 +128,7 @@ en: name: "Name" name_is_required: "Name is required." illustration: "Visual" + illustration_recommendation: "Maximum display size: 932 * 700 px (unconstrained ratio)." add_an_illustration: "Add an illustration" CAD_file: "CAD file" CAD_files: "CAD files" diff --git a/config/locales/app.shared.es.yml b/config/locales/app.shared.es.yml index 8f70072e6..40737946d 100644 --- a/config/locales/app.shared.es.yml +++ b/config/locales/app.shared.es.yml @@ -128,6 +128,7 @@ es: name: "Nombre" name_is_required: "Se requiere un nombre." illustration: "Ilustración" + illustration_recommendation: "Maximum display size: 932 * 700 px (unconstrained ratio)." add_an_illustration: "Añadir una ilustración" CAD_file: "Fichero CAD" CAD_files: "Archivos CAD" diff --git a/config/locales/app.shared.fr.yml b/config/locales/app.shared.fr.yml index 9def491c5..070d34835 100644 --- a/config/locales/app.shared.fr.yml +++ b/config/locales/app.shared.fr.yml @@ -128,6 +128,7 @@ fr: name: "Nom" name_is_required: "Le nom est requis." illustration: "Illustration" + illustration_recommendation: "Taille maximale d'affichage : 932 * 700 px (ratio non contraint)." add_an_illustration: "Ajouter un visuel" CAD_file: "Fichier CAO" CAD_files: "Fichiers CAD" diff --git a/config/locales/app.shared.it.yml b/config/locales/app.shared.it.yml index 9ff84215d..413cbabc0 100644 --- a/config/locales/app.shared.it.yml +++ b/config/locales/app.shared.it.yml @@ -128,6 +128,7 @@ it: name: "Nome" name_is_required: "Il nome è obbligatorio." illustration: "Illustrazione" + illustration_recommendation: "Maximum display size: 932 * 700 px (unconstrained ratio)." add_an_illustration: "Aggiungi un'illustrazione" CAD_file: "File CAD" CAD_files: "File CAD" diff --git a/config/locales/app.shared.no.yml b/config/locales/app.shared.no.yml index 11d5d4439..22dbf0a6b 100644 --- a/config/locales/app.shared.no.yml +++ b/config/locales/app.shared.no.yml @@ -128,6 +128,7 @@ name: "Navn" name_is_required: "Navn er påkrevd." illustration: "Bilde" + illustration_recommendation: "Maximum display size: 932 * 700 px (unconstrained ratio)." add_an_illustration: "Legg til en illustrasjon" CAD_file: "CAD-filer" CAD_files: "CAD files" diff --git a/config/locales/app.shared.pt.yml b/config/locales/app.shared.pt.yml index 811639901..ece98d821 100644 --- a/config/locales/app.shared.pt.yml +++ b/config/locales/app.shared.pt.yml @@ -128,6 +128,7 @@ pt: name: "Nome" name_is_required: "Nome é obrigatório." illustration: "Foto" + illustration_recommendation: "Maximum display size: 932 * 700 px (unconstrained ratio)." add_an_illustration: "Adicionar foto" CAD_file: "Arquivo CAD" CAD_files: "CAD files" diff --git a/config/locales/app.shared.zu.yml b/config/locales/app.shared.zu.yml index 66ca9aa48..c182dd57d 100644 --- a/config/locales/app.shared.zu.yml +++ b/config/locales/app.shared.zu.yml @@ -128,6 +128,7 @@ zu: name: "crwdns28724:0crwdne28724:0" name_is_required: "crwdns28726:0crwdne28726:0" illustration: "crwdns28728:0crwdne28728:0" + illustration_recommendation: "crwdns38130:0crwdne38130:0" add_an_illustration: "crwdns28730:0crwdne28730:0" CAD_file: "crwdns28732:0crwdne28732:0" CAD_files: "crwdns37647:0crwdne37647:0" diff --git a/package.json b/package.json index bd6b3a371..742f1f335 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "fab-manager", - "version": "6.1.2", + "version": "6.2.0", "description": "Fab-manager is the FabLab management solution. It provides a comprehensive, web-based, open-source tool to simplify your administrative tasks and your marker's projects.", "keywords": [ "fablab", diff --git a/test/workers/reservation_reminder_worker_test.rb b/test/workers/reservation_reminder_worker_test.rb new file mode 100644 index 000000000..f718559b1 --- /dev/null +++ b/test/workers/reservation_reminder_worker_test.rb @@ -0,0 +1,109 @@ +# frozen_string_literal: true + +require 'test_helper' +require 'minitest/autorun' + +class ReservationReminderWorkerTest < ActiveSupport::TestCase + include ActionMailer::TestHelper + + setup do + @worker = ReservationReminderWorker.new + + @training_slot = slots(:slot_1) + + @event = events(:event_1) + @event_slot = slots(:slot_129) + @event_reservation = Reservation.create!( + reservable: @event, + nb_reserve_places: 1, + statistic_profile_id: statistic_profiles(:pdurand).id, + slots_reservations_attributes: [slot_id: @event_slot.id] + ) + end + + test 'send a reminder 24 hours before by default and is idempotent' do + travel_to @training_slot.start_at - 24.hours + + assert_enqueued_emails 1 do + @worker.perform + end + + assert_enqueued_emails 0 do + @worker.perform + end + end + + test 'reminder_delay can be changed and is respected' do + Setting.set('reminder_delay', 15) + + travel_to @training_slot.start_at - 17.hours + + assert_enqueued_emails 0 do + @worker.perform + end + + travel_to @training_slot.start_at - 13.hours + + assert_enqueued_emails 0 do + @worker.perform + end + + travel_to @training_slot.start_at - 15.hours + + assert_enqueued_emails 1 do + @worker.perform + end + + assert_enqueued_emails 0 do + @worker.perform + end + end + + test 'do nothing if setting reminder_enable is false' do + Setting.set('reminder_enable', false) + + assert_enqueued_emails 0 do + assert_nil @worker.perform + end + end + + test 'do nothing if slots_reservations is canceled' do + travel_to @training_slot.start_at - 24.hours + + @training_slot.slots_reservations[0].update!(canceled_at: 1.day.ago) + + assert_enqueued_emails 0 do + @worker.perform + end + end + + test '[event] do nothing if event.pre_registration is true and slots_reservation is not valid' do + @event.update!(pre_registration: true) + @event_reservation.slots_reservations.update_all(is_valid: false) + + travel_to @event_slot.start_at - 24.hours + + assert_enqueued_emails 0 do + @worker.perform + end + end + + test '[event] do send the notification if event.pre_registration is true and slots_reservation is valid' do + @event.update!(pre_registration: true) + @event_reservation.slots_reservations.update_all(is_valid: true) + + travel_to @event_slot.start_at - 24.hours + + assert_enqueued_emails 1 do + @worker.perform + end + end + + test '[event] do send the notification if event.pre_registration is false' do + travel_to @event_slot.start_at - 24.hours + + assert_enqueued_emails 1 do + @worker.perform + end + end +end