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 %>
|
<%= d 'message', false %>
|
||||||
|
|
||||||
<div class="footer">
|
<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>
|
</div>
|
|
@ -14,7 +14,7 @@ Neues Ticket (<%= d 'ticket.title' %>)
|
||||||
<p>
|
<p>
|
||||||
<%= t 'Information' %>:
|
<%= t 'Information' %>:
|
||||||
<blockquote type="cite">
|
<blockquote type="cite">
|
||||||
<%= d('article.body').text2html %>
|
<%= a 'article' %>
|
||||||
</blockquote>
|
</blockquote>
|
||||||
</p>
|
</p>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
|
@ -14,7 +14,7 @@ New Ticket (<%= d 'ticket.title' %>)
|
||||||
<p>
|
<p>
|
||||||
<%= t 'Information' %>:
|
<%= t 'Information' %>:
|
||||||
<blockquote type="cite">
|
<blockquote type="cite">
|
||||||
<%= d('article.body').text2html %>
|
<%= a 'article' %>
|
||||||
</blockquote>
|
</blockquote>
|
||||||
</p>
|
</p>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
|
@ -19,7 +19,7 @@ Ticket (<%= d 'ticket.title' %>) has been updated by "<b><%= d 'ticket.updated_b
|
||||||
<p>
|
<p>
|
||||||
<%= t 'Information' %>:
|
<%= t 'Information' %>:
|
||||||
<blockquote type="cite">
|
<blockquote type="cite">
|
||||||
<%= d('article.body').text2html %>
|
<%= a 'article' %>
|
||||||
</blockquote>
|
</blockquote>
|
||||||
</p>
|
</p>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
|
@ -297,7 +297,7 @@ module NotificationFactory
|
||||||
if content_type =~ /html/
|
if content_type =~ /html/
|
||||||
return d "#{article}.body", false
|
return d "#{article}.body", false
|
||||||
end
|
end
|
||||||
d("#{article}.content_type", false).text2html
|
d("#{article}.body", false).text2html
|
||||||
end
|
end
|
||||||
|
|
||||||
def h(key)
|
def h(key)
|
||||||
|
|
|
@ -356,8 +356,29 @@ next line, Group: Users',
|
||||||
assert_match('Notification<b>xxx</b>', result[:body])
|
assert_match('Notification<b>xxx</b>', result[:body])
|
||||||
assert_no_match('Dein', result[:body])
|
assert_no_match('Dein', result[:body])
|
||||||
|
|
||||||
ticket = Ticket.first
|
ticket = Ticket.create(
|
||||||
article = ticket.articles.first
|
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 = {}
|
changes = {}
|
||||||
result = NotificationFactory.template(
|
result = NotificationFactory.template(
|
||||||
template: 'ticket_create',
|
template: 'ticket_create',
|
||||||
|
@ -372,6 +393,7 @@ next line, Group: Users',
|
||||||
assert_match('New Ticket', result[:subject])
|
assert_match('New Ticket', result[:subject])
|
||||||
assert_match('Notification<b>xxx</b>', result[:body])
|
assert_match('Notification<b>xxx</b>', result[:body])
|
||||||
assert_match('has been created by', 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_match('Manage your notifications settings', result[:body])
|
||||||
assert_no_match('Dein', result[:body])
|
assert_no_match('Dein', result[:body])
|
||||||
|
|
||||||
|
@ -388,11 +410,22 @@ next line, Group: Users',
|
||||||
assert_match('Neues Ticket', result[:subject])
|
assert_match('Neues Ticket', result[:subject])
|
||||||
assert_match('Notification<b>xxx</b>', result[:body])
|
assert_match('Notification<b>xxx</b>', result[:body])
|
||||||
assert_match('es wurde ein neues Ticket', 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_match('Manage your notifications settings', result[:body])
|
||||||
assert_no_match('Your', result[:body])
|
assert_no_match('Your', result[:body])
|
||||||
|
|
||||||
ticket = Ticket.first
|
article = Ticket::Article.create(
|
||||||
article = ticket.articles.first
|
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 = {
|
changes = {
|
||||||
state: %w(aaa bbb),
|
state: %w(aaa bbb),
|
||||||
group: %w(xxx yyy),
|
group: %w(xxx yyy),
|
||||||
|
@ -410,6 +443,7 @@ next line, Group: Users',
|
||||||
assert_match('Updated Ticket', result[:subject])
|
assert_match('Updated Ticket', result[:subject])
|
||||||
assert_match('Notification<b>xxx</b>', result[:body])
|
assert_match('Notification<b>xxx</b>', result[:body])
|
||||||
assert_match('has been updated by', 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_match('Manage your notifications settings', result[:body])
|
||||||
assert_no_match('Dein', result[:body])
|
assert_no_match('Dein', result[:body])
|
||||||
|
|
||||||
|
@ -426,6 +460,7 @@ next line, Group: Users',
|
||||||
assert_match('Ticket aktualisiert', result[:subject])
|
assert_match('Ticket aktualisiert', result[:subject])
|
||||||
assert_match('Notification<b>xxx</b>', result[:body])
|
assert_match('Notification<b>xxx</b>', result[:body])
|
||||||
assert_match('wurde von', result[:body])
|
assert_match('wurde von', result[:body])
|
||||||
|
assert_match('<b>test123</b>', result[:body])
|
||||||
assert_match('Manage your notifications settings', result[:body])
|
assert_match('Manage your notifications settings', result[:body])
|
||||||
assert_no_match('Your', result[:body])
|
assert_no_match('Your', result[:body])
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue