fix revision history broken bug

Fixes https://github.com/openSUSE/osem/issues/2334
This commit is contained in:
Rahul 2019-02-28 00:07:16 +05:30
parent 1544cdd23e
commit a776641668
2 changed files with 9 additions and 5 deletions

View file

@ -6,12 +6,15 @@ module Admin
load_and_authorize_resource class: PaperTrail::Version load_and_authorize_resource class: PaperTrail::Version
def index def index
if Conference.any?
@conferences_with_role = current_user.is_admin? ? Conference.pluck(:short_title) : Conference.with_role([:organizer, :cfp, :info_desk], current_user).pluck(:short_title) @conferences_with_role = current_user.is_admin? ? Conference.pluck(:short_title) : Conference.with_role([:organizer, :cfp, :info_desk], current_user).pluck(:short_title)
@conferences_with_role.uniq!
end
if current_user.has_cached_role? :organization_admin, :any if current_user.has_cached_role? :organization_admin, :any
@conferences_with_role = Organization.with_role('organization_admin', current_user).map { |org| org.conferences.pluck :short_title }.flatten @conferences_with_role = Organization.with_role('organization_admin', current_user).map { |org| org.conferences.pluck :short_title }.flatten
end
@conferences_with_role.uniq! @conferences_with_role.uniq!
end
return if @conference.blank? return if @conference.blank?

View file

@ -8,6 +8,7 @@
%span.caret %span.caret
%ul.dropdown-menu %ul.dropdown-menu
%li= link_to 'All Conferences & Users', admin_revision_history_path %li= link_to 'All Conferences & Users', admin_revision_history_path
- if !@conferences_with_role.nil?
- @conferences_with_role.each do |conference_short_title| - @conferences_with_role.each do |conference_short_title|
%li= link_to conference_short_title, admin_conference_revision_history_path(conference_id: conference_short_title) %li= link_to conference_short_title, admin_conference_revision_history_path(conference_id: conference_short_title)