How to change the email notifications to remove content?

Chris Riley February 3, 2016

Does anyone have insight into editing email notification templates in /confluence/WEB-INF/atlassian-bundled-plugins/confluence-email-notifications-plugin-x.x.jar? I have been following the instructions here https://confluence.atlassian.com/doc/customising-the-email-templates-168001822.html on Confluence 5.5.2, and have searched other forum queries on this topic (one suggesting that “it doesn’t work”).

My goal is to remove the actual content portion of the appropriate SOY file so that when somebody has a watch on a page, they receive a change notification, but the actual content excerpt of the page is not included in the notification. I don’t want users to see what was edited, and I don’t want them to see the excerpt of the original content either. I want to remove that entire “content” box. While I want users to get a notification, for security reasons, I don’t want them to see the content outside the wiki. A user will have to navigate to the wiki page to see the actual content and changes made.

So far I’ve edited the following SOY files, but have not found the desired results:

  • templates/notification/content-added-1.0.0.soy
  • templates/content/content-excerpt-pattern-2.0.0.soy
  • templates/notification/status-updated-1.0.0.soy
  • templates/notification/page-edited-2.0.0.soy
  • templates/notification/page-edit-1.0.0.soy

Much thanks,

Chris

 

2 answers

0 votes
Chris Riley March 10, 2016

Hi Michal,

In confluence-email-notifications-plugin-6.1.21.jar, the file is located In templates/notification/page-edit-1.0.0.soy. The code in bold was added to put some user-friendly text in the blank spot, otherwise we got an error message appearing. Can’t remember what it was.

Hope this helps.

Disclaimer 1: I am not responsible for problems that may occur if you use my code alterations. Use this code at your own risk.

Disclaimer 2: Please read Atlassian’s red-box warning about editing this JAR file here: https://confluence.atlassian.com/doc/customising-the-email-templates-168001822.html. Ie. They do not support it. Please back up the JAR file before making edits to the SOY file.

Chris

Page-edit-1.0.0.soy

{namespace Confluence.Templates.Mail.Notifications}

/**

* @param avatarCid

* @param modifier

* @param contentType

* @param content

* @param actionLinks

* @param footerLinks

* @param? diffHtml

* @param? showDiffs

*/

{template .pageEdit}

    {natto(['soy-template-file-name' : 'page-edit-1.0.0.soy', 'deprecate-in-version' : '5.5', 'remove-in-version' : '6.0'])}

    {let $pageTitle}

        {call Confluence.Templates.Mail.Content.pageTitlePattern}

            {param contentType: $contentType/}

            {param titleText: $content.title/}

            {param contentUrl}

                {baseUrl()}{$content.urlPath}

            {/param}

        {/call}

    {/let}

    {let $contentExcerpt}

        {if $showDiffs}

            {if $diffHtml}

                {call Confluence.Templates.Mail.Content.contentExcerptPattern}

                    {param contentExcerpt: getText('renderer.site.relative.link.title')/}

                {/call}

            {else}

                {call Confluence.Templates.Mail.Content.contentExcerptPattern}

                    {param contentExcerpt: getText('diff.pages.error.diffing')/}

                {/call}

            {/if}

        {/if}

    {/let}

    {let $pageActions}

        {call Confluence.Templates.Mail.Content.actionsPattern}

            {param actions: $actionLinks/}

        {/call}

    {/let}

   {let $comment}

        {if $content.renderedVersionComment}

            {call Confluence.Templates.Mail.Content.notificationCommentPattern}

                {param comment: getText('confluence.mail.templates.edit.comment', $content.renderedVersionComment)/}

            {/call}

        {/if}

    {/let}

    {call Confluence.Templates.Mail.Chrome.mainTable}

        {param header}

            {call Confluence.Templates.Mail.Chrome.headerPattern}

                {param actionString: getText('confluence.mail.templates.edited.a.page')/}

                {param avatarImage: $avatarCid/}

                {param user: $modifier/}

            {/call}

        {/param}

        {param contentArea: $comment ? [$comment, ['class' : 'padding-top border-top', 'content' : $pageTitle], $contentExcerpt, ['class' : 'action-padding', 'content' : $pageActions]] : [$pageTitle, $contentExcerpt, ['class' : 'action-padding', 'content' : $pageActions]]/}

        {param footer}

            {call Confluence.Templates.Mail.Chrome.footerPattern}

                {param footerLinks: $footerLinks/}

            {/call}

        {/param}

    {/call}

{/template}

0 votes
Wiki Support March 9, 2016

Hello Chris,

did you find solution? If yes, could you share it with us?

Many thanks,

Michal

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events