Commit 849e8935 authored by peterhegman's avatar peterhegman Committed by Illya Klymov

Hide "Suggest wiki improvement" button on "Wiki" pages from Auditors

Auditors have read-only permissions so can't create issues. Button
returned a 404
parent 5eabe70d
......@@ -18,14 +18,14 @@
- elsif @project && can?(current_user, :read_issue, @project)
- issues_link = link_to s_('WikiEmptyIssueMessage|issue tracker'), project_issues_path(@project)
- new_issue_link = link_to s_('WikiEmpty|Suggest wiki improvement'), new_project_issue_path(@project), class: 'btn gl-button btn-confirm', title: s_('WikiEmptyIssueMessage|Suggest wiki improvement')
= render layout: layout_path, locals: { image_path: 'illustrations/wiki_logout_empty.svg' } do
%h4
= messages.dig(:issuable, :title)
%p.text-left
= messages.dig(:issuable, :body).html_safe % { issues_link: issues_link }
= new_issue_link
- if show_new_issue_link?(@project)
= link_to s_('WikiEmpty|Suggest wiki improvement'), new_project_issue_path(@project), class: 'btn gl-button btn-confirm', title: s_('WikiEmptyIssueMessage|Suggest wiki improvement')
- else
= render layout: layout_path, locals: { image_path: 'illustrations/wiki_logout_empty.svg' } do
......
---
title: Hide "Suggest wiki improvement" button from Auditors on project wiki page
merge_request: 56897
author:
type: fixed
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe 'Project > User views empty wiki' do
let_it_be(:auditor) { create(:user, auditor: true) }
let_it_be(:project) { create(:project, :private) }
let_it_be(:wiki) { create(:project_wiki, project: project) }
context 'when signed in user is an Auditor' do
before do
sign_in(auditor)
end
it 'shows empty state without "Suggest wiki improvement" button' do
visit wiki_path(wiki)
expect(page).to have_content('This project has no wiki pages')
expect(page).to have_content('You must be a project member in order to add wiki pages. If you have suggestions for how to improve the wiki for this project, consider opening an issue in the issue tracker.')
expect(page).not_to have_link('Suggest wiki improvement')
end
end
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment