Merge pull request #2041 from mlorb/ml-sci-3847

Fix missing icon on shared inventories in global search [SCI-3847]
This commit is contained in:
mlorb 2019-09-10 13:51:58 +02:00 committed by GitHub
commit e596afa595
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 4 additions and 9 deletions

View file

@ -129,14 +129,13 @@ class SearchController < ApplicationController
current_user.teams.includes(:repositories).each do |team|
team_results = {}
team_results[:team] = team
team_results[:count] = 0
team_results[:repositories] = {}
Repository.accessible_by_teams(team).each do |repository|
repository_results = {}
repository_results[:id] = repository.id
if (shared_repo = repository.team_repositories.where(team: team).take)
repository_results[:shared] = shared_repo[:permission_level]
end
repository_results[:repository] = repository
repository_results[:count] = 0
search_results.each do |result|
if repository.id == result.id

View file

@ -11,7 +11,7 @@ module InventoriesHelper
else
# The icon should be hiden if repo is not shared (we're updating it dinamically)
css_classes = ["repository-share-status"]
css_classes.push("hidden") unless inventory.i_shared?(current_team)
css_classes.push("hidden") unless inventory.i_shared?(team)
css_title = t('repositories.icon_title.i_shared')
content_tag :span, title: css_title, class: css_classes.join(" ") do

View file

@ -233,11 +233,7 @@
search_id: @search_id}.to_query %>">
<span class="badge pull-right"><%= values[:count] %></span>
<%= repository %>
<% if values[:shared] == 'write' %>
<%= draw_custom_icon('shared-edit') %>
<% elsif values[:shared] == 'read' %>
<%= draw_custom_icon('shared-read') %>
<% end %>
<%= inventory_shared_status_icon(values[:repository], results[:team]) %>
</a>
</li>
<% end %>