mirror of
https://github.com/LaCasemate/fab-manager.git
synced 2025-02-19 13:54:25 +01:00
[bug] in public calendar, availabilities are not shown to visitors
This commit is contained in:
parent
a822481d39
commit
f5e2a44dcf
@ -13,6 +13,7 @@
|
||||
- Fix a bug: invalid notification when sending monetary coupon to users
|
||||
- Fix a bug: unable to delete group "standard"
|
||||
- Fix a bug: recursive events crossing Daylight Saving Time period changes are shifted by 1 hour
|
||||
- Fix a bug: unable to see availabilities in the public calendar when browsing as a visitor (non-connected)
|
||||
- Updated puma for compatibility with openSSL > 1.0
|
||||
- Documented installation on ArchLinux
|
||||
- [TODO DEPLOY] `rake db:seed` then `rake fablab:fix:migrate_admins_group`
|
||||
|
@ -92,7 +92,7 @@ class API::AvailabilitiesController < API::ApiController
|
||||
if a.available_type == 'training' or a.available_type == 'event'
|
||||
a = verify_training_event_is_reserved(a, @reservations, current_user)
|
||||
elsif a.available_type == 'space'
|
||||
a.is_reserved = is_reserved_availability(a, current_user.id)
|
||||
a.is_reserved = is_reserved_availability(a, current_user)
|
||||
end
|
||||
end
|
||||
end
|
||||
@ -307,14 +307,18 @@ class API::AvailabilitiesController < API::ApiController
|
||||
params.require(:lock)
|
||||
end
|
||||
|
||||
def is_reserved_availability(availability, user_id)
|
||||
reserved_slots = []
|
||||
availability.slots.each do |s|
|
||||
if s.canceled_at.nil?
|
||||
reserved_slots << s
|
||||
def is_reserved_availability(availability, user)
|
||||
if user
|
||||
reserved_slots = []
|
||||
availability.slots.each do |s|
|
||||
if s.canceled_at.nil?
|
||||
reserved_slots << s
|
||||
end
|
||||
end
|
||||
reserved_slots.map(&:reservations).flatten.map(&:user_id).include? user.id
|
||||
else
|
||||
false
|
||||
end
|
||||
reserved_slots.map(&:reservations).flatten.map(&:user_id).include? user_id
|
||||
end
|
||||
|
||||
def is_reserved(start_at, reservations)
|
||||
|
Loading…
x
Reference in New Issue
Block a user