Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Subject prefix #3422

Merged
merged 4 commits into from
Feb 5, 2024
Merged

Subject prefix #3422

merged 4 commits into from
Feb 5, 2024

Conversation

LaVibeX
Copy link
Contributor

@LaVibeX LaVibeX commented Jan 31, 2024

Description

  • Email Subject Prefix is Hardcoded rightnow .subject("[Dependency-Track] " + notification.getTitle()),
  • This is a solution to allow the User to modify the Subject Prefix to its will .subject(smtpPrefix + " " + notification.getTitle() )

This modification would be available in Administration>Configuration>Email
and "[Dependency-Track]" would be the first default value.

If the User change the Subject Prefix, it will need to press Update button in order to save the changes.
Subject Prefix is not a required field so leaving the input box in blank is also an option.

This new feature helps to distinguish between several instances of Dependency-Track, e.g. prod and qual systems.

Default value: [Dependency-Track]

image

Modified Value: [Dependency-Track TEST ®]

image

Modified Value: " "

image

This PR depends on its corresponding PR in the frontend repository
DependencyTrack/frontend#720

Addressed Issue

This fixes #1823

Additional Details

Check if smtpPrefix is null in order to clean the value to " "
smtpPrefix = smtpPrefix == null ? " " : smtpPrefix;

This PR is supervised by @lukas-braune.

Checklist

  • I have read and understand the contributing guidelines
  • This PR fixes a defect, and I have provided tests to verify that the fix is effective
  • This PR implements an enhancement, and I have provided tests to verify that it works as intended
  • This PR introduces changes to the database model, and I have added corresponding update logic
  • This PR introduces new or alters existing behavior, and I have updated the documentation accordingly

Signed-off-by: Andres Tito andres.tito@rohde-schwarz.com

Add Email Subject Prefix dynamic option to email sender,
it will take value from Subject prefix input box added
in Frontend.

Follows the same variable convention.
defaultPropertyValue will be [Dependency-Track]

Signed-off-by: Andres Tito <andres.tito@rohde-schwarz.com>
Add condition to clean value if User choose not to have a Subject Prefix

Signed-off-by: Andres Tito <andres.tito@rohde-schwarz.com>
The prefix is not really tied to the SMTP protocol.
If other email delivery methods are added in the future,
the prefix might still be valid to use, but should not be called
smtpPrefix.

Signed-off-by: Andres Tito <andres.tito@rohde-schwarz.com>
@nscuro nscuro added the enhancement New feature or request label Feb 4, 2024
@nscuro nscuro added this to the 4.11 milestone Feb 4, 2024
Copy link
Member

@nscuro nscuro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @LaVibeX!

@nscuro
Copy link
Member

nscuro commented Feb 5, 2024

Looks like this broke SendMailPublisherTest. Do you mind having a look @LaVibeX?

Remove space on SendMailPublisher.java and
add EMAIL_PREFIX Properties to SendMailPublisherTest.java

Signed-off-by: Andres Tito <andres.tito@rohde-schwarz.com>
@LaVibeX
Copy link
Contributor Author

LaVibeX commented Feb 5, 2024

Locally, I ran the tests after my commit and it finish without any errors.
Here in the CI, I notice that the error is related to ProjectResourceTest due to a Condition TimeOut.

Could it be possible to run the test again @nscuro ?
image

Looks like this broke SendMailPublisherTest. Do you mind having a look @LaVibeX?

@nscuro
Copy link
Member

nscuro commented Feb 5, 2024

Triggered another test run.

@nscuro nscuro merged commit 11eb35f into DependencyTrack:master Feb 5, 2024
9 checks passed
@girtsn
Copy link

girtsn commented Feb 6, 2024

it says that it implements #1823
from the ticket "add the notification subject configuration to the notification template and use same params as there exists for content"
is it possible to use variables now as in body of the notification (e.g. severity / others)? the description of this ticket seems to be about adding a static prefix only?

@nscuro
Copy link
Member

nscuro commented Feb 7, 2024

You are right @girtsn, I reopened the issue. Thanks for pointing that out, much appreciated!

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 9, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Notifications subjects - add additional information (e.g. Project/Component/Severity) into Subject string
4 participants