mirror of
https://github.com/LaCasemate/fab-manager.git
synced 2025-01-29 18:52:22 +01:00
[bug] Corrective patch for users with invalid group_id
This commit is contained in:
parent
403e3a5562
commit
bf014c688d
@ -1,5 +1,8 @@
|
||||
# Changelog Fab Manager
|
||||
|
||||
- Fix a bug: some users may not appear in the admin's general listing
|
||||
- [TODO DEPLOY] `rake fablab:fix:users_group_ids`
|
||||
|
||||
## v3.1.1 2019 April 8
|
||||
|
||||
- Fix a bug: when paying a reservation with wallet, the invoice footprint is not correctly updated
|
||||
|
@ -125,5 +125,23 @@ namespace :fablab do
|
||||
p.save
|
||||
end
|
||||
end
|
||||
|
||||
desc '[release 3.1.2] fix users with invalid group_id'
|
||||
task users_group_ids: :environment do
|
||||
User.where.not(group_id: Group.all.map(&:id)).each do |u|
|
||||
u.update_columns(group_id: Group.first.id, updated_at: DateTime.now)
|
||||
|
||||
meta_data = { ex_group_name: 'invalid group' }
|
||||
|
||||
NotificationCenter.call type: :notify_admin_user_group_changed,
|
||||
receiver: User.admins,
|
||||
attached_object: u,
|
||||
meta_data: meta_data
|
||||
|
||||
NotificationCenter.call type: :notify_user_user_group_changed,
|
||||
receiver: u,
|
||||
attached_object: u
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
Loading…
x
Reference in New Issue
Block a user