Skip to content

Commit

Permalink
Merge branch 'dev' for release 6.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
nflorentin committed Oct 13, 2023
2 parents 5d42a73 + ad8d428 commit 60da6a8
Show file tree
Hide file tree
Showing 38 changed files with 242 additions and 41 deletions.
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
3 changes: 2 additions & 1 deletion app/frontend/src/javascript/components/events/event-form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,8 @@ export const EventForm: React.FC<EventFormProps> = ({ 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')} />
<FormRichText control={control}
id="description"
rules={{ required: true }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ type FormImageUploadProps<TFieldValues, TContext extends object> = FormComponent
/**
* This component allows to upload image, in forms managed by react-hook-form.
*/
export const FormImageUpload = <TFieldValues extends FieldValues, TContext extends object>({ id, label, register, control, defaultImage, className, rules, disabled, error, warning, formState, onFileChange, onFileRemove, accept, setValue, size, onFileIsMain, mainOption = false }: FormImageUploadProps<TFieldValues, TContext>) => {
export const FormImageUpload = <TFieldValues extends FieldValues, TContext extends object>({ id, label, register, control, defaultImage, className, rules, disabled, error, warning, formState, onFileChange, onFileRemove, accept, setValue, size, onFileIsMain, mainOption = false, tooltip }: FormImageUploadProps<TFieldValues, TContext>) => {
const { t } = useTranslation('shared');

const [file, setFile] = useState<ImageType>(defaultImage);
Expand Down Expand Up @@ -125,7 +125,8 @@ export const FormImageUpload = <TFieldValues extends FieldValues, TContext exten
warning={warning}
id={`${id}.attachment_files`}
onChange={onFileSelected}
placeholder={placeholder()}/>
placeholder={placeholder()}
tooltip={tooltip} />
{hasImage() && <FabButton onClick={onRemoveFile} icon={<Trash size={20} weight="fill" />} className="is-main" />}
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ const MachineCard: React.FC<MachineCardProps> = ({ user, machine, onShowMachine,
return (
<div className={`machine-card ${loading ? 'loading' : ''} ${machine.disabled ? 'disabled' : ''} ${!machine.reservable ? 'unreservable' : ''}`}>
{machinePicture()}
{machine.space && user.role === 'admin' && <FabBadge icon='pin-map' iconWidth='3rem' /> }
{machine.space && user && user.role === 'admin' && <FabBadge icon='pin-map' iconWidth='3rem' /> }
<div className="machine-name">
{machine.name}
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,8 @@ export const MachineForm: React.FC<MachineFormProps> = ({ 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')} />
<FormRichText control={control}
id="description"
rules={{ required: true }}
Expand Down
3 changes: 2 additions & 1 deletion app/frontend/src/javascript/components/spaces/space-form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,8 @@ export const SpaceForm: React.FC<SpaceFormProps> = ({ 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')} />
<FormInput register={register}
type="number"
id="default_places"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,20 @@ export const SupportingDocumentsTypeForm: React.FC<SupportingDocumentsTypeFormPr
onChange('name', value);
};

/**
* to know if select input for groups is display or not
*/
const displayGroupsSelect = (): boolean => {
return (supportingDocumentType == null || supportingDocumentType?.document_type === 'User') && (groups.length > 0);
};

return (
<div className="supporting-documents-type-form">
<div className="info-area">
{t('app.admin.settings.account.supporting_documents_type_form.type_form_info')}
</div>
<form name="supportingDocumentTypeForm">
{supportingDocumentType?.document_type === 'User' &&
{displayGroupsSelect() &&
<div className="field">
<Select defaultValue={groupsValues()}
placeholder={t('app.admin.settings.account.supporting_documents_type_form.select_group')}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,9 @@ const SupportingDocumentsTypesList: React.FC<SupportingDocumentsTypesListProps>
// get groups
useEffect(() => {
GroupAPI.index({ disabled: false }).then(data => {
setGroups(data);
if (documentType === 'User') {
setGroups(data);
}
SupportingDocumentTypeAPI.index({ document_type: documentType }).then(pData => {
setSupportingDocumentsTypes(pData);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,8 @@ export const TrainingForm: React.FC<TrainingFormProps> = ({ action, training, on
id="training_image_attributes"
accept="image/*"
defaultImage={output.training_image_attributes}
label={t('app.admin.training_form.illustration')} />
label={t('app.admin.training_form.illustration')}
tooltip={t('app.admin.training_form.illustration_recommendation')} />
<FormRichText control={control}
id="description"
rules={{ required: true }}
Expand Down
2 changes: 1 addition & 1 deletion app/frontend/src/javascript/controllers/admin/members.js
Original file line number Diff line number Diff line change
Expand Up @@ -511,7 +511,7 @@ Application.Controllers.controller('AdminMembersController', ['$scope', '$sce',
});
if ($scope.members.length > 0) {
uitour.createStep({
selector: '.members-management .members-list .buttons',
selector: '.members-management .members-list .member-actions',
stepId: 'actions',
order: 4,
title: _t('app.admin.tour.members.actions.title'),
Expand Down
6 changes: 6 additions & 0 deletions app/frontend/src/javascript/controllers/spaces.js.erb
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,12 @@ Application.Controllers.controller('EditSpaceController', ['$scope', '$state', '
return space;
}

/**
* Changes the current user's view, redirecting him to the spaces list
*/
$scope.cancel = function () { $state.go('app.public.spaces_list'); };


// Using the SpacesController
return new SpacesController($scope, $state);
}]);
Expand Down
3 changes: 1 addition & 2 deletions app/frontend/src/stylesheets/app.components.scss
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,6 @@
overflow: hidden;

img {
aspect-ratio: 16/9;
object-fit: cover;
object-position: center;
}
Expand All @@ -200,7 +199,7 @@
img {
display: block;
max-width: 100%;
height: auto;
max-height: 700px;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
}

.project-image {
@include imageRatio(50%);
@include imageRatio(56%);
background-size: cover;
background-position: center;
border-bottom: 1px solid var(--gray-soft-dark);
Expand Down
3 changes: 2 additions & 1 deletion app/frontend/templates/admin/settings/general.html
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,8 @@ <h3 class="m-l" translate>{{ 'app.admin.settings.background_picture_of_the_profi
</div>
</div>
</div>
</div>
</div>
<span class="block m-t-xs m-l text-gray text-sm" translate>{{ 'app.admin.settings.background_picture_recommendation' }}</span>
<button name="button" type="submit" class="btn btn-warning m-t m-l" ng-disabled="profileImageForm.$invalid" translate>{{ 'app.shared.buttons.save' }}</button>
</form>
</div>
Expand Down
1 change: 1 addition & 0 deletions app/frontend/templates/projects/_form.html
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
<div class="fileinput-preview fileinput-exists thumbnail" data-trigger="fileinput" style="max-width: 334px;">
<img ng-src="{{ project.project_image }}" alt="" />
</div>
<span class="help-block text-sm" translate>{{ 'app.shared.project.illustration_recommendation' }}</span>
<div>
<span class="btn btn-default btn-file"><span class="fileinput-new">{{ 'app.shared.project.add_an_illustration' | translate }} <i class="fa fa-upload fa-fw"></i></span><span class="fileinput-exists" translate>{{ 'app.shared.buttons.change' }}</span>
<input type="file"
Expand Down
2 changes: 1 addition & 1 deletion app/frontend/templates/spaces/edit.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<div class="row no-gutter">
<div class="col-md-1 hidden-xs">
<section class="heading-btn">
<a ng-click="backPrevLocation($event)"><i class="fas fa-long-arrow-alt-left "></i></a>
<a ng-click="cancel()"><i class="fas fa-long-arrow-alt-left "></i></a>
</section>
</div>
<div class="col-md-8 b-l b-r">
Expand Down
12 changes: 12 additions & 0 deletions app/models/open_id_connect_provider.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion app/views/api/auth_providers/show.json.jbuilder
Original file line number Diff line number Diff line change
Expand Up @@ -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
4 changes: 2 additions & 2 deletions app/views/layouts/notifications_mailer.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,13 @@
<a href="<%= root_url %>">
<img src="<%= File.join(root_url, CustomAsset.get_url('logo-file')) %>"
alt="<%=fablab_name%>"
width="140px;" />
width="140" />
</a>
<% else %>
<a href="<%= root_url %>">
<img src="<%= File.join(root_url, asset_pack_path('static/fabmanager-logo.png')) %>"
alt="<%=fablab_name%>"
width="140px;" />
width="140" />
</a>
<% end %>
</td>
Expand Down
2 changes: 2 additions & 0 deletions app/workers/reservation_reminder_worker.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,15 @@ def perform

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,
attached_object_id: r.id,
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,
Expand Down
11 changes: 8 additions & 3 deletions config/locales/app.admin.de.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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"
Expand Down Expand Up @@ -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"
Expand All @@ -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)"
Expand Down Expand Up @@ -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:"
Expand Down
11 changes: 8 additions & 3 deletions config/locales/app.admin.en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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"
Expand Down Expand Up @@ -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"
Expand All @@ -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)"
Expand Down Expand Up @@ -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:"
Expand Down
Loading

0 comments on commit 60da6a8

Please sign in to comment.