Don't render TOC in emailed note notifications

What does this MR do and why?

Fixes TOC (Table of Contents) tags should not be rend... (#581849).

Note email templates re-render Markdown from scratch using EmailPipeline, which (unlike NotePipeline) doesn't set no_header_anchors. This caused [[_TOC_]]-style tags to be rendered in the email notification, even though the note itself wouldn't expand them.

Fix by passing no_header_anchors: true in the note email partial. We don't want to modify EmailPipeline itself since it does actually need to render TOCs sometimes (e.g. for issue/MR descriptions in notifs).

How to set up and validate locally

  1. Check out the branch.
  2. Create a note on an issue or MR that looks like this:
    [[_TOC_]]
    
    # Hello, world!
    
    ## Olá, mundo!
    
    @someuser
    You should @mention a user who isn't the one you're logged in as, to trigger an email notification.
  3. Visit /rails/letter_opener. You should see something like this:
    image
    Why is it blocked? I dunno, our Letter Opener configuration seems to be a bit wonky. You can middle-click the email at left to open it in a new tab. It should look like this:
    image
    Note it says _TOC_ as a link. This is correct — it matches the actual render on the site:
    image
    An incorrect result would be an actual table of contents appearing in the email notif, which is the current behaviour.

MR acceptance checklist

Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Asherah Connor

Merge request reports

Loading