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
Refactor slack and teams notifications #1069
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Everything looks good to me code wise (minus one possible log message update in comment). The original functionality is working in testing for both notification types.
This is not in the original scope of this PR, but I did notice an existing bug where you can use a teams webhook for a slack notification and vice versa. If you think it's worth fixing in this PR I believe modifying the nested if
statements in the validate()
methods of following files should fix the issue:
Lines 125 to 130 in 07ca26e
if (webhookUri.getHost().toLowerCase().contains("slack")) { | |
if (!SLACK_PATTERN.matcher(webhookUrl()).find()) { | |
validation.addError(FIELD_WEBHOOK_URL, INVALID_SLACK_URL_ERROR_MESSAGE); | |
} | |
} else if (webhookUri.getHost().toLowerCase().contains("discord")) { | |
if (!DISCORD_PATTERN.matcher(webhookUrl()).find()) { |
Lines 97 to 98 in 07ca26e
if (webhookUri.getHost().toLowerCase().contains("office")) { | |
if (!TEAMS_PATTERN.matcher(webhookUrl()).find()) { |
src/main/java/org/graylog/integrations/notifications/types/SlackClient.java
Show resolved
Hide resolved
Fixed the log message and updated URL validation logic in latest commit @ryan-carroll-graylog |
...rg/graylog/integrations/notifications/types/microsoftteams/TeamsEventNotificationConfig.java
Outdated
Show resolved
Hide resolved
502e5b9
to
fccc9c0
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good.
Thank you @kingzacko1! |
Refactor MS Teams and Slack message objects to use AutoValue
…rations#1069) Refactor MS Teams and Slack message objects to use AutoValue
refactor of the Slack and Teams notification types code to more closely align with use of AutoValue across the project. There should be no functional difference in the two notifications.
Notes for Reviewers