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,20 +7,22 @@
<div class="editControls">
<div class="js-avatar"></div>
<div class="editControls-item is-hidden pop-select">
<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 %>">
<%- @Icon(articleType.icon) %>
<% 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 %>">
<%- @Icon(articleType.icon) %>
</div>
<% end %>
</div>
<% end %>
</div>
<div class="pop-selector is-hidden js-articleTypes">
<% for articleType in @articleTypes: %>
<div class="editControls-icon pop-selectable js-articleTypeItem" data-value="<%= articleType.name %>">
<%- @Icon(articleType.icon, 'pop-selectable-icon') %>
<div class="pop-selector is-hidden js-articleTypes">
<% for articleType in @articleTypes: %>
<div class="editControls-icon pop-selectable js-articleTypeItem" data-value="<%= articleType.name %>">
<%- @Icon(articleType.icon, 'pop-selectable-icon') %>
</div>
<% end %>
</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) }