Fixes #3957 - S/MIME function buttons no longer working in tickets.
This commit is contained in:
parent
9f9df552e7
commit
84d2421c5c
3 changed files with 44 additions and 24 deletions
|
@ -305,34 +305,38 @@ class ArticleViewItem extends App.ControllerObserver
|
||||||
e.stopPropagation()
|
e.stopPropagation()
|
||||||
|
|
||||||
article_id = $(e.target).closest('.ticket-article-item').data('id')
|
article_id = $(e.target).closest('.ticket-article-item').data('id')
|
||||||
|
article = App.TicketArticle.find(article_id)
|
||||||
|
|
||||||
@ajax(
|
@ajax(
|
||||||
id: 'retrySecurityProcess'
|
id: 'retrySecurityProcess'
|
||||||
type: 'POST'
|
type: 'POST'
|
||||||
url: "#{@apiPath}/ticket_articles/#{article_id}/retry_security_process"
|
url: "#{@apiPath}/ticket_articles/#{article_id}/retry_security_process"
|
||||||
processData: true
|
processData: true
|
||||||
success: (data, status, xhr) =>
|
success: (encryption_data, status, xhr) =>
|
||||||
if data.sign.success
|
for data in encryption_data
|
||||||
@notify
|
continue if article.preferences.security.type isnt data.type
|
||||||
type: 'success'
|
|
||||||
msg: App.i18n.translateContent('The signature was successfully verified.')
|
|
||||||
else if data.sign.comment
|
|
||||||
comment = App.i18n.translateContent('Signature verification failed!') + ' ' + App.i18n.translateContent(data.sign.comment || '')
|
|
||||||
@notify
|
|
||||||
type: 'error'
|
|
||||||
msg: comment
|
|
||||||
timeout: 2000
|
|
||||||
|
|
||||||
if data.encryption.success
|
if data.sign.success
|
||||||
@notify
|
@notify
|
||||||
type: 'success'
|
type: 'success'
|
||||||
msg: App.i18n.translateContent('Decryption was successful.')
|
msg: App.i18n.translateContent('The signature was successfully verified.')
|
||||||
else if data.encryption.comment
|
else if data.sign.comment
|
||||||
comment = App.i18n.translateContent('Decryption failed!') + ' ' + App.i18n.translateContent(data.encryption.comment || '')
|
comment = App.i18n.translateContent('Signature verification failed!') + ' ' + App.i18n.translateContent(data.sign.comment || '')
|
||||||
@notify
|
@notify
|
||||||
type: 'error'
|
type: 'error'
|
||||||
msg: comment
|
msg: comment
|
||||||
timeout: 2000
|
timeout: 2000
|
||||||
|
|
||||||
|
if data.encryption.success
|
||||||
|
@notify
|
||||||
|
type: 'success'
|
||||||
|
msg: App.i18n.translateContent('Decryption was successful.')
|
||||||
|
else if data.encryption.comment
|
||||||
|
comment = App.i18n.translateContent('Decryption failed!') + ' ' + App.i18n.translateContent(data.encryption.comment || '')
|
||||||
|
@notify
|
||||||
|
type: 'error'
|
||||||
|
msg: comment
|
||||||
|
timeout: 2000
|
||||||
|
|
||||||
error: (xhr) =>
|
error: (xhr) =>
|
||||||
@notify
|
@notify
|
||||||
|
|
|
@ -10,9 +10,11 @@ class SecureMailing
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.retry(article)
|
def self.retry(article)
|
||||||
|
result = []
|
||||||
active_backends.each do |backend|
|
active_backends.each do |backend|
|
||||||
"#{backend}::Retry".constantize.process(article)
|
result << "#{backend}::Retry".constantize.process(article)
|
||||||
end
|
end
|
||||||
|
result
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.outgoing(mail, security)
|
def self.outgoing(mail, security)
|
||||||
|
|
|
@ -590,8 +590,7 @@ RSpec.describe 'Ticket zoom', type: :system do
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'certificate not present at time of arrival' do
|
context 'certificate not present at time of arrival' do
|
||||||
|
let(:mail) do
|
||||||
it 'retry' do
|
|
||||||
smime1 = create(:smime_certificate, :with_private, fixture: system_email_address)
|
smime1 = create(:smime_certificate, :with_private, fixture: system_email_address)
|
||||||
smime2 = create(:smime_certificate, :with_private, fixture: sender_email_address)
|
smime2 = create(:smime_certificate, :with_private, fixture: sender_email_address)
|
||||||
|
|
||||||
|
@ -614,6 +613,10 @@ RSpec.describe 'Ticket zoom', type: :system do
|
||||||
smime1.destroy
|
smime1.destroy
|
||||||
smime2.destroy
|
smime2.destroy
|
||||||
|
|
||||||
|
mail
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'does retry successfully' do
|
||||||
parsed_mail = Channel::EmailParser.new.parse(mail.to_s)
|
parsed_mail = Channel::EmailParser.new.parse(mail.to_s)
|
||||||
ticket, article, _user, _mail = Channel::EmailParser.new.process({ group_id: group.id }, parsed_mail['raw'])
|
ticket, article, _user, _mail = Channel::EmailParser.new.process({ group_id: group.id }, parsed_mail['raw'])
|
||||||
expect(Ticket::Article.find(article.id).body).to eq('no visible content')
|
expect(Ticket::Article.find(article.id).body).to eq('no visible content')
|
||||||
|
@ -626,6 +629,17 @@ RSpec.describe 'Ticket zoom', type: :system do
|
||||||
click '.js-securityRetryProcess'
|
click '.js-securityRetryProcess'
|
||||||
expect(page).to have_css('.article-content', text: 'somebody with some text')
|
expect(page).to have_css('.article-content', text: 'somebody with some text')
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it 'does fail on retry (S/MIME function buttons no longer working in tickets #3957)' do
|
||||||
|
parsed_mail = Channel::EmailParser.new.parse(mail.to_s)
|
||||||
|
ticket, article, _user, _mail = Channel::EmailParser.new.process({ group_id: group.id }, parsed_mail['raw'])
|
||||||
|
expect(Ticket::Article.find(article.id).body).to eq('no visible content')
|
||||||
|
|
||||||
|
visit "#ticket/zoom/#{ticket.id}"
|
||||||
|
expect(page).to have_no_css('.article-content', text: 'somebody with some text')
|
||||||
|
click '.js-securityRetryProcess'
|
||||||
|
expect(page).to have_css('#notify', text: 'Decryption failed! Private key for decryption could not be found.')
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue