Fixed text/html article quoting in notifications.
This commit is contained in:
parent
742e117b0b
commit
497b659500
6 changed files with 44 additions and 9 deletions
|
@ -38,5 +38,5 @@
|
|||
<%= d 'message', false %>
|
||||
|
||||
<div class="footer">
|
||||
<a href="<%= c 'http_type' %>://<%= c 'fqdn' %>/#profile/notifications"><%= t 'Manage your notifications settings' %></a> | <%= c 'organization' %>
|
||||
<a href="<%= c 'http_type' %>://<%= c 'fqdn' %>/#profile/notifications"><%= t 'Manage your notifications settings' %></a> <% if !c('organization').empty? %>| <%= c 'organization' %><% end %>
|
||||
</div>
|
|
@ -14,7 +14,7 @@ Neues Ticket (<%= d 'ticket.title' %>)
|
|||
<p>
|
||||
<%= t 'Information' %>:
|
||||
<blockquote type="cite">
|
||||
<%= d('article.body').text2html %>
|
||||
<%= a 'article' %>
|
||||
</blockquote>
|
||||
</p>
|
||||
<% end %>
|
||||
|
|
|
@ -14,7 +14,7 @@ New Ticket (<%= d 'ticket.title' %>)
|
|||
<p>
|
||||
<%= t 'Information' %>:
|
||||
<blockquote type="cite">
|
||||
<%= d('article.body').text2html %>
|
||||
<%= a 'article' %>
|
||||
</blockquote>
|
||||
</p>
|
||||
<% end %>
|
||||
|
|
|
@ -19,7 +19,7 @@ Ticket (<%= d 'ticket.title' %>) has been updated by "<b><%= d 'ticket.updated_b
|
|||
<p>
|
||||
<%= t 'Information' %>:
|
||||
<blockquote type="cite">
|
||||
<%= d('article.body').text2html %>
|
||||
<%= a 'article' %>
|
||||
</blockquote>
|
||||
</p>
|
||||
<% end %>
|
||||
|
|
|
@ -297,7 +297,7 @@ module NotificationFactory
|
|||
if content_type =~ /html/
|
||||
return d "#{article}.body", false
|
||||
end
|
||||
d("#{article}.content_type", false).text2html
|
||||
d("#{article}.body", false).text2html
|
||||
end
|
||||
|
||||
def h(key)
|
||||
|
|
|
@ -356,8 +356,29 @@ next line, Group: Users',
|
|||
assert_match('Notification<b>xxx</b>', result[:body])
|
||||
assert_no_match('Dein', result[:body])
|
||||
|
||||
ticket = Ticket.first
|
||||
article = ticket.articles.first
|
||||
ticket = Ticket.create(
|
||||
group_id: Group.where( name: 'Users' ).first.id,
|
||||
customer_id: User.where( login: 'nicole.braun@zammad.org' ).first.id,
|
||||
owner_id: User.where( login: '-' ).first.id,
|
||||
title: 'Welcome to Zammad!',
|
||||
state_id: Ticket::State.where( name: 'new' ).first.id,
|
||||
priority_id: Ticket::Priority.where( name: '2 normal' ).first.id,
|
||||
updated_by_id: 1,
|
||||
created_by_id: 1,
|
||||
)
|
||||
article = Ticket::Article.create(
|
||||
ticket_id: ticket.id,
|
||||
type_id: Ticket::Article::Type.where(name: 'phone' ).first.id,
|
||||
sender_id: Ticket::Article::Sender.where(name: 'Customer' ).first.id,
|
||||
from: 'Zammad Feedback <feedback@zammad.org>',
|
||||
content_type: 'text/plain',
|
||||
body: 'Welcome!
|
||||
<b>test123</b>',
|
||||
internal: false,
|
||||
updated_by_id: 1,
|
||||
created_by_id: 1,
|
||||
)
|
||||
|
||||
changes = {}
|
||||
result = NotificationFactory.template(
|
||||
template: 'ticket_create',
|
||||
|
@ -372,6 +393,7 @@ next line, Group: Users',
|
|||
assert_match('New Ticket', result[:subject])
|
||||
assert_match('Notification<b>xxx</b>', result[:body])
|
||||
assert_match('has been created by', result[:body])
|
||||
assert_match('<b>test123</b>', result[:body])
|
||||
assert_match('Manage your notifications settings', result[:body])
|
||||
assert_no_match('Dein', result[:body])
|
||||
|
||||
|
@ -388,11 +410,22 @@ next line, Group: Users',
|
|||
assert_match('Neues Ticket', result[:subject])
|
||||
assert_match('Notification<b>xxx</b>', result[:body])
|
||||
assert_match('es wurde ein neues Ticket', result[:body])
|
||||
assert_match('<b>test123</b>', result[:body])
|
||||
assert_match('Manage your notifications settings', result[:body])
|
||||
assert_no_match('Your', result[:body])
|
||||
|
||||
ticket = Ticket.first
|
||||
article = ticket.articles.first
|
||||
article = Ticket::Article.create(
|
||||
ticket_id: ticket.id,
|
||||
type_id: Ticket::Article::Type.where(name: 'phone' ).first.id,
|
||||
sender_id: Ticket::Article::Sender.where(name: 'Customer' ).first.id,
|
||||
from: 'Zammad Feedback <feedback@zammad.org>',
|
||||
content_type: 'text/html',
|
||||
body: 'Welcome!
|
||||
<b>test123</b>',
|
||||
internal: false,
|
||||
updated_by_id: 1,
|
||||
created_by_id: 1,
|
||||
)
|
||||
changes = {
|
||||
state: %w(aaa bbb),
|
||||
group: %w(xxx yyy),
|
||||
|
@ -410,6 +443,7 @@ next line, Group: Users',
|
|||
assert_match('Updated Ticket', result[:subject])
|
||||
assert_match('Notification<b>xxx</b>', result[:body])
|
||||
assert_match('has been updated by', result[:body])
|
||||
assert_match('<b>test123</b>', result[:body])
|
||||
assert_match('Manage your notifications settings', result[:body])
|
||||
assert_no_match('Dein', result[:body])
|
||||
|
||||
|
@ -426,6 +460,7 @@ next line, Group: Users',
|
|||
assert_match('Ticket aktualisiert', result[:subject])
|
||||
assert_match('Notification<b>xxx</b>', result[:body])
|
||||
assert_match('wurde von', result[:body])
|
||||
assert_match('<b>test123</b>', result[:body])
|
||||
assert_match('Manage your notifications settings', result[:body])
|
||||
assert_no_match('Your', result[:body])
|
||||
|
||||
|
|
Loading…
Reference in a new issue