1
0
mirror of https://github.com/LaCasemate/fab-manager.git synced 2025-01-18 07:52:23 +01:00

(bug) members can change/cancel their reservations

This commit is contained in:
Sylvain 2023-02-24 15:24:09 +01:00
parent ee2cbc332f
commit 4dd7b1345f
5 changed files with 7 additions and 6 deletions

View File

@ -2,6 +2,7 @@
- Fix a bug: unable to update recurrent events
- Fix a bug: invalid border color for slots
- Fix a bug: members can change/cancel their reservations
## v5.7.1 2023 February 20

View File

@ -1,8 +1,8 @@
# frozen_string_literal: true
json.slot_id slot.id
json.can_modify slot.modifiable?(operator_role, @user&.id, reservable)
json.title Slots::TitleService.new(operator_role, @user).call(slot, [reservable])
json.can_modify slot.modifiable?(operator_role, user&.id, reservable)
json.title Slots::TitleService.new(operator_role, user).call(slot, [reservable])
json.start slot.start_at.iso8601
json.end slot.end_at.iso8601
json.is_reserved slot.reserved?(reservable)
@ -10,7 +10,7 @@ json.is_completed slot.full?(reservable)
json.backgroundColor 'white'
json.availability_id slot.availability_id
json.slots_reservations_ids Slots::ReservationsService.user_reservations(slot, @user, reservable)[:reservations]
json.slots_reservations_ids Slots::ReservationsService.user_reservations(slot, user, reservable)[:reservations]
json.tag_ids slot.availability.tag_ids
json.tags slot.availability.tags do |t|

View File

@ -1,7 +1,7 @@
# frozen_string_literal: true
json.array!(@slots) do |slot|
json.partial! 'api/availabilities/slot', slot: slot, operator_role: @operator_role, reservable: @machine
json.partial! 'api/availabilities/slot', slot: slot, operator_role: @operator_role, reservable: @machine, user: @customer
json.borderColor machines_slot_border_color(slot, @machine, @customer)
json.machine do

View File

@ -1,7 +1,7 @@
# frozen_string_literal: true
json.array!(@slots) do |slot|
json.partial! 'api/availabilities/slot', slot: slot, operator_role: @operator_role, reservable: @space
json.partial! 'api/availabilities/slot', slot: slot, operator_role: @operator_role, reservable: @space, user: @customer
json.is_completed slot.full?
json.borderColor space_slot_border_color(slot)

View File

@ -1,7 +1,7 @@
# frozen_string_literal: true
json.array!(@slots) do |slot|
json.partial! 'api/availabilities/slot', slot: slot, operator_role: @operator_role, reservable: slot.availability.trainings.first
json.partial! 'api/availabilities/slot', slot: slot, operator_role: @operator_role, reservable: slot.availability.trainings.first, user: @customer
json.borderColor trainings_events_border_color(slot.availability)
json.is_completed slot.full?