Fixes #3012 - Don't display "article type" selection for customers within UI.

This commit is contained in:
Dusan Vuckovic 2021-02-24 14:13:51 +00:00 committed by Mantas Masalskis
parent d9f4483075
commit 2a61be02be
2 changed files with 40 additions and 12 deletions

View file

@ -7,6 +7,7 @@
<div class="editControls">
<div class="js-avatar"></div>
<div class="editControls-item is-hidden pop-select">
<% if @articleTypes.length > 1: %>
<div class="editControls-iconHolder centered js-selectedArticleType">
<% for articleType in @articleTypes: %>
<div class="editControls-icon js-selectableTypes<%- ' hide' if articleType.icon != @article.icon %>" data-type="<%- articleType.name %>">
@ -21,6 +22,7 @@
</div>
<% end %>
</div>
<% end %>
</div>
<% if @internalSelector: %>
<div class="editControls-item is-hidden js-toggleVisibility js-selectInternalPublic">

View file

@ -1094,6 +1094,32 @@ RSpec.describe 'Ticket zoom', type: :system do
end
end
# https://github.com/zammad/zammad/issues/3012
describe 'article type selection' do
context 'when logged in as a customer', authenticated_as: :customer do
let(:customer) { create(:customer) }
let(:ticket) { create(:ticket, customer: customer) }
it 'hides button for single choice' do
visit "ticket/zoom/#{ticket.id}"
find('.articleNewEdit-body').send_keys('Some reply')
expect(page).to have_no_selector('.js-selectedArticleType')
end
end
context 'when logged in as an agent' do
let(:ticket) { create(:ticket, group: Group.find_by(name: 'Users')) }
it 'shows button for multiple choices' do
visit "ticket/zoom/#{ticket.id}"
find('.articleNewEdit-body').send_keys('Some reply')
expect(page).to have_selector('.js-selectedArticleType')
end
end
end
# https://github.com/zammad/zammad/issues/3260
describe 'next in overview macro changes URL', authenticated_as: :authenticate do
let(:next_ticket) { create(:ticket, title: 'next Ticket', group: Group.first) }