Fix counter on task inventory and failing test (#2043)

This commit is contained in:
aignatov-bio 2019-09-10 13:51:37 +02:00 committed by GitHub
parent 33d495956e
commit 1f12a63a25
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 4 deletions

View file

@ -30,7 +30,7 @@
<% if enable_counters %> <% if enable_counters %>
<% cache [repository, @my_module] do %> <% cache [repository, @my_module] do %>
<%= truncate(repository.name) %> <%= truncate(repository.name) %>
<span class="assigned-items-counter"><%= "(#{@my_module.repository_rows_count()})" %></span> <span class="assigned-items-counter"><%= "(#{@my_module.repository_rows_count(repository)})" %></span>
<% end %> <% end %>
<% else %> <% else %>
<%= truncate(repository.name) %> <%= truncate(repository.name) %>

View file

@ -122,7 +122,7 @@
<li data-hook="secondary-navigation-tabs"></li> <li data-hook="secondary-navigation-tabs"></li>
<% if can_read_team?(@my_module.experiment.project.team) && <% if can_read_team?(@my_module.experiment.project.team) &&
@my_module.experiment.project.team.repositories.exists? %> Repository.accessible_by_teams(current_team).exists? %>
<li id="repositories-nav-tab" <li id="repositories-nav-tab"
class="<%= "active" if module_repository_page? %> dropdown repositories-dropdown" class="<%= "active" if module_repository_page? %> dropdown repositories-dropdown"
data-url="<%= module_repository_page? ? repositories_dropdown_repository_tab_my_module_path(repository: @repository) : repositories_dropdown_my_module_path %>"> data-url="<%= module_repository_page? ? repositories_dropdown_repository_tab_my_module_path(repository: @repository) : repositories_dropdown_my_module_path %>">

View file

@ -1,8 +1,11 @@
# frozen_string_literal: true
require 'rails_helper' require 'rails_helper'
describe SmartAnnotations::PermissionEval do describe SmartAnnotations::PermissionEval do
let(:subject) { described_class } let(:subject) { described_class }
let(:user) { create :user } let(:user) { create :user }
let(:another_user) { create :user }
let(:team) { create :team } let(:team) { create :team }
let(:another_team) { create :team } let(:another_team) { create :team }
let!(:user_team) { create :user_team, user: user, team: team, role: :admin } let!(:user_team) { create :user_team, user: user, team: team, role: :admin }
@ -75,8 +78,8 @@ describe SmartAnnotations::PermissionEval do
expect(value).to be_in([true, false]) expect(value).to be_in([true, false])
end end
it 'returns false on wrong team' do it 'returns false on wrong user' do
value = subject.__send__(:validate_rep_item_permissions, user, another_team, repository_item) value = subject.__send__(:validate_rep_item_permissions, another_user, another_team, repository_item)
expect(value).to be false expect(value).to be false
end end