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

Support for multiple channels #75

Merged
merged 3 commits into from
Sep 27, 2023

Conversation

limod
Copy link
Contributor

@limod limod commented Mar 28, 2023

Hi!

i added the feature to specify multiple channels. We have multiple environments and want to seperate your monitoring into different mattermost channels.

You can configure the field Channels to send notifications to include multiple channels separated by ; e.g. teamname,channelname;teamname-2,channelname-2

You can configure the target channel in the webhook URL, e.g. https://your-mattermost-url/plugins/com.mattermost.aws-sns?token=your-mattermost-token?channel=teamname,channelname

If you specify no channel query parameter, the first channel will be used. Therefore the change should be compatible with older version.

Added some tests: go test ./... -cover

Added the flag CGO_ENABLED=0 in the Makefile because i hat problems running the plugin in a dev mattermost setup (Image: mattermost/mattermost-team-edition:7.4.0): Plugin could not start becasue of error GLIBC_2.34 not found, with local development in the current mattermost-server project, everything worked without the flag. Any ideas why i hit this error?

@limod limod requested a review from mickmister as a code owner March 28, 2023 14:52
@mattermost-build
Copy link

Hello @limod,

Thanks for your pull request! A Core Committer will review your pull request soon. For code contributions, you can learn more about the review process here.

@codecov
Copy link

codecov bot commented Mar 28, 2023

Codecov Report

Attention: 73 lines in your changes are missing coverage. Please review.

Comparison is base (363b452) 0.00% compared to head (d22dc40) 17.03%.
Report is 2 commits behind head on master.

❗ Current head d22dc40 differs from pull request most recent head d57bf24. Consider uploading reports for the commit d57bf24 to get more accurate results

Additional details and impacted files
@@             Coverage Diff             @@
##           master      #75       +/-   ##
===========================================
+ Coverage        0   17.03%   +17.03%     
===========================================
  Files           0        4        +4     
  Lines           0      587      +587     
===========================================
+ Hits            0      100      +100     
- Misses          0      469      +469     
- Partials        0       18       +18     
Files Coverage Δ
server/command.go 23.07% <0.00%> (ø)
server/plugin.go 15.22% <41.66%> (ø)

... and 2 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@mickmister mickmister left a comment

Choose a reason for hiding this comment

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

Thanks for this great improvement @limod!

I have a few requests to avoid some possibly excessive logging, as well as a few other comments.

In general though LGTM 👍 Great work

plugin.json Outdated Show resolved Hide resolved
server/plugin_test.go Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
server/plugin.go Outdated Show resolved Hide resolved
server/plugin.go Outdated Show resolved Hide resolved
server/plugin.go Outdated Show resolved Hide resolved
server/plugin.go Outdated Show resolved Hide resolved
server/plugin.go Outdated Show resolved Hide resolved
@@ -48,19 +61,18 @@ func (p *Plugin) OnActivate() error {
return err
}

split := strings.Split(p.configuration.TeamChannel, ",")
if len(split) != 2 {
teamChannels, err := parseTeamChannelsNames(p.configuration.TeamChannel)
Copy link
Contributor

Choose a reason for hiding this comment

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

Unrelated to the changes in this PR:

It's concerning that this is all happening in OnActivate, and not also triggered by OnConfigurationChange, since I believe this means that you have to restart the plugin for any config changes to take effect.

Copy link
Contributor

Choose a reason for hiding this comment

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

Created a ticket for this #77

@limod
Copy link
Contributor Author

limod commented Mar 29, 2023

Accidentally removed @stylianosrigas, i am not able to readd him. @mickmister

@hanzei hanzei added 2: Dev Review Requires review by a core committer 3: QA Review Requires review by a QA tester labels Mar 29, 2023
Copy link

@stylianosrigas stylianosrigas left a comment

Choose a reason for hiding this comment

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

LGTM, thanks @limod 🚀

Copy link
Contributor

@mickmister mickmister left a comment

Choose a reason for hiding this comment

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

LGTM 👍 Thanks @limod!

@mickmister mickmister requested a review from DHaussermann March 29, 2023 16:31
@mickmister mickmister removed the 2: Dev Review Requires review by a core committer label Mar 29, 2023
@mattermost-build
Copy link

This PR has been automatically labelled "stale" because it hasn't had recent activity.
A core team member will check in on the status of the PR to help with questions.
Thank you for your contribution!

@limod
Copy link
Contributor Author

limod commented May 30, 2023

When will the review continue?

@mickmister
Copy link
Contributor

@mkdbns @DHaussermann @jasonblais Thoughts on handling QA review on community contributions like this?

@jasonblais
Copy link
Contributor

@mkdbns would this be an example contribution for your team to QA review & merge once your team has the proper GitHub access?

README.md Outdated Show resolved Hide resolved
@Kshitij-Katiyar
Copy link
Contributor

@limod @mickmister From our QA

Tested and Passed
The comment above is necessary for this PR to work and I have tested everything after making that change because without that the token will always be incorrect.

  1. Tested the plugin by updating the system console values to include multiple channels and notifications are coming successfully.

  2. Cases handled:-
    i) Invalid channelID in both the system console and in the URL.
    ii) URL without channelid also works fine.

@mickmister mickmister added 4: Reviews Complete All reviewers have approved the pull request and removed Lifecycle/1:stale 3: QA Review Requires review by a QA tester labels Sep 27, 2023
@mickmister
Copy link
Contributor

Thanks for the contribution @limod!

@mickmister mickmister merged commit fbf9fef into mattermost-community:master Sep 27, 2023
@avas27JTG avas27JTG added this to the v1.3.0 milestone Oct 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
4: Reviews Complete All reviewers have approved the pull request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants