Fixes #2406 - Forwarding: Attachment of original content gets removed starting from the second forward without reloading per ticket
This commit is contained in:
parent
1772e9f1e4
commit
ceb9bf6e14
3 changed files with 54 additions and 2 deletions
|
@ -1005,9 +1005,12 @@ class App.TicketZoom extends App.Controller
|
||||||
# reset task state
|
# reset task state
|
||||||
taskReset: =>
|
taskReset: =>
|
||||||
@form_id = App.ControllerForm.formId()
|
@form_id = App.ControllerForm.formId()
|
||||||
|
|
||||||
@articleNew.form_id = @form_id
|
@articleNew.form_id = @form_id
|
||||||
@articleNew.render()
|
@articleNew.render()
|
||||||
|
|
||||||
|
@articleView.updateFormId(@form_id)
|
||||||
|
|
||||||
@localTaskData =
|
@localTaskData =
|
||||||
ticket: {}
|
ticket: {}
|
||||||
article: {}
|
article: {}
|
||||||
|
|
|
@ -60,6 +60,9 @@ class App.TicketZoomArticleView extends App.Controller
|
||||||
|
|
||||||
false
|
false
|
||||||
|
|
||||||
|
updateFormId: (newFormId) ->
|
||||||
|
for id, viewItem of @articleController
|
||||||
|
viewItem.updateFormId(newFormId)
|
||||||
|
|
||||||
class ArticleViewItem extends App.ObserverController
|
class ArticleViewItem extends App.ObserverController
|
||||||
model: 'TicketArticle'
|
model: 'TicketArticle'
|
||||||
|
@ -205,7 +208,7 @@ class ArticleViewItem extends App.ObserverController
|
||||||
size: 40
|
size: 40
|
||||||
)
|
)
|
||||||
|
|
||||||
new App.TicketZoomArticleActions(
|
@articleActions = new App.TicketZoomArticleActions(
|
||||||
el: @$('.js-article-actions')
|
el: @$('.js-article-actions')
|
||||||
ticket: @ticket
|
ticket: @ticket
|
||||||
article: article
|
article: article
|
||||||
|
@ -425,3 +428,6 @@ class ArticleViewItem extends App.ObserverController
|
||||||
e.preventDefault()
|
e.preventDefault()
|
||||||
e.stopPropagation()
|
e.stopPropagation()
|
||||||
new App.TicketZoomArticleImageView(image: $(e.target).get(0).outerHTML, parentElement: $(e.currentTarget))
|
new App.TicketZoomArticleImageView(image: $(e.target).get(0).outerHTML, parentElement: $(e.currentTarget))
|
||||||
|
|
||||||
|
updateFormId: (newFormId) ->
|
||||||
|
@articleActions?.form_id = newFormId
|
||||||
|
|
|
@ -126,7 +126,50 @@ RSpec.describe 'Ticket zoom', type: :system do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
context 'when ticket has an attachment' do
|
||||||
|
|
||||||
|
let(:group) { Group.find_by(name: 'Users') }
|
||||||
|
let(:ticket) { create(:ticket, group: group) }
|
||||||
|
let(:article) { create(:ticket_article, ticket: ticket) }
|
||||||
|
let(:attachment_name) { 'some_file.txt' }
|
||||||
|
|
||||||
|
before do
|
||||||
|
Store.add(
|
||||||
|
object: 'Ticket::Article',
|
||||||
|
o_id: article.id,
|
||||||
|
data: 'some content',
|
||||||
|
filename: attachment_name,
|
||||||
|
preferences: {
|
||||||
|
'Content-Type' => 'text/plain',
|
||||||
|
},
|
||||||
|
created_by_id: 1,
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
context 'article was already forwarded once' do
|
||||||
|
before do
|
||||||
|
visit "#ticket/zoom/#{ticket.id}"
|
||||||
|
|
||||||
|
within(:active_content) do
|
||||||
|
find('a[data-type=emailForward]').click
|
||||||
|
|
||||||
|
click('.js-reset')
|
||||||
|
have_no_css('.js-reset')
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'adds attachments when forwarding multiple times' do
|
||||||
|
|
||||||
|
within(:active_content) do
|
||||||
|
find('a[data-type=emailForward]').click
|
||||||
|
end
|
||||||
|
|
||||||
|
within('.js-writeArea') do
|
||||||
|
expect(page).to have_text attachment_name
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue