Add X-GitLab-ConfidentialIssue: header boolean
What does this MR do and why?
This MR will add a new email header to issue notifications, 'X-GitLab-ConfidentialIssue' which will contain a boolean (true/false) value depending on the issue's confidentiality. It will default to false if the issue's confidentiality is nil.
This can be used for filtering out emails when this header is set to true and a site's policy is to restrict emailing of confidential emails.
Screenshots or screen recordings
As a demonstration, from the rails console:
Make issue id 4 confidential (via the web interface) and then test it:
irb(main):043:0> foo = Issue.find(4)
=> #<Issue id:4 tasks#11466>
irb(main):038:1* unless foo.confidential?
irb(main):039:1* puts "not confidential"
irb(main):040:1* else
irb(main):041:1* puts "confidential"
irb(main):042:0> end
confidential
=> nil
Make issue id 4 not confidential (via the web interface) and then test it:
irb(main):043:0> foo = Issue.find(4)
=> #<Issue id:4 tasks#11466>
irb(main):044:1* unless foo.confidential?
irb(main):045:1* puts "not confidential"
irb(main):046:1* else
irb(main):047:1* puts "confidential"
irb(main):048:0> end
not confidential
=> nil
irb(main):049:0>
How to set up and validate locally
- Create or modify a confidential issue, the issue notification email should have
X-GitLab-ConfidentialIssue: true - Create or modify a non-confidential issue, the issue notification email should have
X-GitLab-ConfidentialIssue: false
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
TODO
Add tests Related to #222908