Blob embeds respect show_diff_preview_in_email

What does this MR do and why?

Part of #300855 (closed). Closes #618244 (closed).

Evaluate the setting both for the embed context and target, i.e. turning it off for a given project disables that project's mailings having any embeds sent out, as well as that project's code being embedded elsewhere.

This is erring on the side of caution; you could argue it'd be enough to check the target only, but we can change it later if a customer voices desire.

We disable expanding blob embeds in Service Desk emails entirely. Again, can be changed later, but these go to external users and currently never have diffs/instance source code attached, so keep it that way.

How to set up and validate locally

  1. Check this branch out and enable the blob_permalink_embed FF.
  2. Include a blob permalink in a project comment to another user on your GDK. Here's my example:
    image
  3. Check letter_opener (mine's at http://gdk.test:3000/rails/letter_opener/). You should see something like this:
    image
    Not the world's prettiest email; to be iterated on in a follow-up. :)
  4. In the project you're working out of, go to SettingsGeneralVisibility, project features, permissionsEmail notifications and uncheck the checkbox Include diff previews, then scroll down and click Save changes.
  5. Repeat your comment.
  6. Re-check letter_opener. You should see something like this:
    image

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.

Merge request reports

Loading
Loading