mirror of
https://github.com/openSUSE/osem.git
synced 2026-08-13 19:54:02 +00:00
Fix NoMethodError in revision history
Roles get deleted with organization so to show them in revision history previous version of role model is required.That is done here. closes https://github.com/openSUSE/osem/issues/1937
This commit is contained in:
parent
137d997793
commit
1b226f1ac8
1 changed files with 5 additions and 4 deletions
|
|
@ -9,13 +9,14 @@
|
|||
|
||||
- when 'UsersRole'
|
||||
- users_role = current_or_last_object_state(version.item_type, version.item_id)
|
||||
- role = Role.find_by(id: users_role.role_id) if users_role
|
||||
- role = current_or_last_object_state('Role', users_role.role_id)
|
||||
- role_name = role.try(:name) || PaperTrail::Version.where(item_type: 'Role', item_id: users_role.role_id).last.changeset[:name].second
|
||||
role
|
||||
- if role.name == 'organization_admin'
|
||||
- if role_name == 'organization_admin'
|
||||
- if Organization.find_by(id: version.conference_id)
|
||||
-# organization_admin belongs to organization and not conferences
|
||||
- organization = Organization.find_by(id: version.conference_id)
|
||||
= link_if_alive version, role.name,
|
||||
= link_if_alive version, role_name,
|
||||
admins_admin_organization_path(organization), organization
|
||||
- else
|
||||
(Deleted Organization)
|
||||
|
|
@ -226,7 +227,7 @@
|
|||
= link_to_user(version.item_id)
|
||||
|
||||
- unless %w(Conference Subscription Registration User Organization).include?(version.item_type)
|
||||
- if (version.item_type == 'Role' && role_name == 'organization_admin') || (version.item_type == 'UsersRole' && role.name == 'organization_admin')
|
||||
- if (version.item_type == 'Role' && role_name == 'organization_admin') || (version.item_type == 'UsersRole' && role_name == 'organization_admin')
|
||||
in organization
|
||||
- if Organization.find_by(id: version.conference_id)
|
||||
-# organization_admin belongs to organization and not conferences
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue