mirror of
https://github.com/LaCasemate/fab-manager.git
synced 2025-01-29 18:52:22 +01:00
[bug] managers do not see the name of the user who reserved a slot
This commit is contained in:
parent
2b0eb47730
commit
98c63e8327
@ -1,6 +1,7 @@
|
||||
# Changelog Fab-manager
|
||||
|
||||
- Improved display of the icons alerting about an outdated version
|
||||
- Fix a bug: managers do not see the name of the user who reserved a slot
|
||||
- [TODO DEPLOY] `rails fablab:setup:env_to_db`
|
||||
|
||||
## v4.4.4 2020 May 25
|
||||
|
@ -6,7 +6,7 @@ class Availabilities::AvailabilitiesService
|
||||
def initialize(current_user, maximum_visibility = {})
|
||||
@current_user = current_user
|
||||
@maximum_visibility = maximum_visibility
|
||||
@service = Availabilities::StatusService.new(current_user.admin? ? 'admin' : 'user')
|
||||
@service = Availabilities::StatusService.new(current_user.role)
|
||||
end
|
||||
|
||||
# list all slots for the given machine, with reservations info, relatives to the given user
|
||||
|
@ -4,7 +4,7 @@
|
||||
class Availabilities::StatusService
|
||||
def initialize(current_user_role)
|
||||
@current_user_role = current_user_role
|
||||
@show_name = (@current_user_role == 'admin' || Setting.get('display_name_enable') == 'true')
|
||||
@show_name = (%w[admin manager].include?(@current_user_role) || Setting.get('display_name_enable') == 'true')
|
||||
end
|
||||
|
||||
# check that the provided machine slot is reserved or not and modify it accordingly
|
||||
@ -19,7 +19,7 @@ class Availabilities::StatusService
|
||||
slot.id = s.id
|
||||
slot.is_reserved = true
|
||||
slot.title = "#{slot.machine.name} - #{@show_name ? r.user&.profile&.full_name : I18n.t('availabilities.not_available')}"
|
||||
slot.can_modify = true if @current_user_role == 'admin'
|
||||
slot.can_modify = true if %w[admin manager].include?(@current_user_role)
|
||||
slot.reservations.push r
|
||||
|
||||
next unless r.statistic_profile_id == statistic_profile_id
|
||||
@ -41,7 +41,7 @@ class Availabilities::StatusService
|
||||
|
||||
next unless s.start_at == slot.start_at && s.canceled_at.nil?
|
||||
|
||||
slot.can_modify = true if @current_user_role == 'admin'
|
||||
slot.can_modify = true if %w[admin manager].include?(@current_user_role)
|
||||
slot.reservations.push r
|
||||
|
||||
next unless r.statistic_profile_id == statistic_profile_id
|
||||
|
Loading…
x
Reference in New Issue
Block a user