Skip to content

Commit

Permalink
MessageTemplate - Don't html-escape the subject
Browse files Browse the repository at this point in the history
  • Loading branch information
colemanw committed Jun 19, 2024
1 parent 6e64b13 commit 73ee3f0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 2 additions & 0 deletions CRM/Utils/API/HTMLInputCoder.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ public function getSkipFields() {
'html_message',
'body_html',
'msg_html',
// MessageTemplate subject might contain the < character in a smarty tag
'msg_subject',
'description',
'intro',
'thankyou_text',
Expand Down
6 changes: 4 additions & 2 deletions tests/phpunit/api/v4/Entity/MessageTemplateTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,8 @@ public function testMessageTemplateMasterID(): void {

MessageTemplate::update(FALSE)
->addWhere('workflow_name', '=', 'contribution_offline_receipt')
->addValue('msg_html', '<p>Some test {if 1 > 2} markup{/if}</p>')
->addValue('msg_subject', 'Subject test {if 1 > 2} smarty{/if}')
->addValue('msg_html', '<p>Body test {if 1 > 2} markup{/if}</p>')
->execute();

$originalTemplate = MessageTemplate::get()
Expand All @@ -161,7 +162,8 @@ public function testMessageTemplateMasterID(): void {
->execute()->first();
$messageTemplateIDReserved = $reservedTemplate['id'];

$this->assertEquals('<p>Some test {if 1 > 2} markup{/if}</p>', $originalTemplate['msg_html']);
$this->assertEquals('Subject test {if 1 > 2} smarty{/if}', $originalTemplate['msg_subject']);
$this->assertEquals('<p>Body test {if 1 > 2} markup{/if}</p>', $originalTemplate['msg_html']);
$this->assertNull($originalTemplate['master_id']);
$this->assertNull($originalTemplate['master_id.msg_subject']);

Expand Down

0 comments on commit 73ee3f0

Please sign in to comment.