Project

General

Profile

Defect #35090 ยป fix-35090.patch

Takenori TAKAKI, 2021-10-07 06:46

View differences:

app/views/issues/index.html.erb
13 13

  
14 14
    <%= link_to_if_authorized l(:label_settings),
15 15
              {:controller => 'projects', :action => 'settings', :id => @project, :tab => 'issues'},
16
              :class => 'icon icon-settings' if User.current.allowed_to?(:manage_categories, @project) %>
16
              :class => 'icon icon-settings' if User.current.allowed_to?(:edit_project, @project) %>
17 17
  <% end %>
18 18
</div>
19 19

  
test/functional/issues_controller_test.rb
2005 2005
    assert_select '#content a.new-issue[href="/issues/new"]', :text => 'New issue'
2006 2006
  end
2007 2007

  
2008
  def test_index_should_show_setting_link_with_edit_project_permission
2009
    role = Role.find(1)
2010
    role.add_permission! :edit_project
2011
    @request.session[:user_id] = 2
2012
    get(:index, :params => {:project_id => 1})
2013
    assert_select '#content a.icon-settings[href="/projects/ecookbook/settings/issues"]', 1
2014
  end
2015

  
2016
  def test_index_should_not_show_setting_link_without_edit_project_permission
2017
    role = Role.find(1)
2018
    role.remove_permission! :edit_project
2019
    @request.session[:user_id] = 2
2020
    get(:index, :params => {:project_id => 1})
2021
    assert_select '#content a.icon-settings[href="/projects/ecookbook/settings/issues"]', 0
2022
  end
2023

  
2008 2024
  def test_index_should_not_include_new_issue_tab_when_disabled
2009 2025
    with_settings :new_item_menu_tab => '0' do
2010 2026
      @request.session[:user_id] = 2
    (1-1/1)