displayTOC macro call from MailTemplate does not render correctly

When a notification email is sent, the macro displayTOC is called from the template bin/edit/XWiki/Notifications/MailTemplate. The TOC is rendered incorrectly, namely, the title of the page that was edited and the link to that page. The title is rendered as a non-expanded variable (i.e. $title) and the link is an hash link like #m_-6751499713143034006_924158579-1710829162000-oT0D49dY, but gets interpreted email clients (GMail and Outlook) as, for example, https://mail.google.com/mail/u/0/#m_-6751499713143034006_924158579-1710829162000-oT0D49dY. In the photo below, I would have expected the TOC to have the same text/link as the test page, which was the only page edited.

xwiki_notification_email

I assume this is a bug. I can get around it by commenting out the call to displayTOC, but it would be nice to have the TOC.

Hi,

could you report a bug for this on https://jira.xwiki.org? I started to fix a few bugs in the mail template but sounds like I missed that one.

Thanks

Created XWIKI-22006

@surli Templates like MailTemplate can be edited within XWiki by browsing to URLs like https://xwiki.example.com/bin/edit/XWiki/Notifications/MailTemplate?editor=object. Two questions:

1.) Is there anywhere in the XWiki interface where this link exists? Right now I go to the Pages Index, search for the template I want, click its link, which in this example would be https://xwiki.example.com/bin/view/XWiki/Notifications/MailTemplate and modify manually to be “edit” instead of “view” and also add the ?editor=object query string at the end.

2.) Templates like the MailTemplate rely on macros which exist in the /usr/local/tomcat/webapps/ROOT/templates directory. When XWiki is running in a Docker container, it is a pain to try to modify these files in the file system. Is there any way to modify these files in the XWiki interface like described in question #1?

So you don’t see the link for this page probably because you don’t display hidden pages. Also you probably don’t view the different edit mode of a page because you’re not an advanced user. You can change both values in your user profile see: https://extensions.xwiki.org/xwiki/bin/view/Extension/User%20Module/User%20Profile%20Application/#HEditPreferences
Note that even if you display hidden pages you’ll need to browse a lot in the navigation to find it as lots of technical pages will appear, so what you’re doing right now is probably easier :slight_smile:

So it’s not possible for sure to modify those files from the XWiki interface. Outside of docker it’s possible to modify the files with any text editor. Now I don’t know if it’s possible to customized those files in a docker setup, @vmassol might know better.