Skip to content
Permalink
Browse files

Fixes #2406 - Forwarding: Attachment of original content gets removed…

… starting from the second forward without reloading per ticket
  • Loading branch information
Mantas Masalskis
Mantas Masalskis committed Jan 10, 2020
1 parent 1772e9f commit ceb9bf6e14f17fafe852ff0f5d701ab78be13bd6
@@ -1005,9 +1005,12 @@ class App.TicketZoom extends App.Controller
# reset task state
taskReset: =>
@form_id = App.ControllerForm.formId()

@articleNew.form_id = @form_id
@articleNew.render()

@articleView.updateFormId(@form_id)

@localTaskData =
ticket: {}
article: {}
@@ -60,6 +60,9 @@ class App.TicketZoomArticleView extends App.Controller

false

updateFormId: (newFormId) ->
for id, viewItem of @articleController
viewItem.updateFormId(newFormId)

class ArticleViewItem extends App.ObserverController
model: 'TicketArticle'
@@ -205,7 +208,7 @@ class ArticleViewItem extends App.ObserverController
size: 40
)

new App.TicketZoomArticleActions(
@articleActions = new App.TicketZoomArticleActions(
el: @$('.js-article-actions')
ticket: @ticket
article: article
@@ -425,3 +428,6 @@ class ArticleViewItem extends App.ObserverController
e.preventDefault()
e.stopPropagation()
new App.TicketZoomArticleImageView(image: $(e.target).get(0).outerHTML, parentElement: $(e.currentTarget))

updateFormId: (newFormId) ->
@articleActions?.form_id = newFormId
@@ -126,7 +126,50 @@
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

0 comments on commit ceb9bf6

Please sign in to comment.
You can’t perform that action at this time.