mattermost / mattermost-plugin-apps

Powers the Mattermost App Framework
https://developers.mattermost.com/integrate/apps/
Apache License 2.0
33 stars 29 forks source link

[MM-51931] Don't send channel_created event for DMs #472

Closed hanzei closed 1 year ago

hanzei commented 1 year ago

Summary

If a newly created channel is a DM, the ChannelHasBeenCreated hook gets called with an empty TeamID. This leads to an error down the stack. Now, ChannelHasBeenCreated gets ignored for DMs.

I did try adding a test, but the only symptom of the bug is a log message (https://github.com/mattermost/mattermost-plugin-apps/blob/22741daa176f919160193831d3bd2f113aa369c8/server/proxy/notify.go#L225-L229) which is hard to test for.

Ticket Link

https://mattermost.atlassian.net/browse/MM-51931

codecov-commenter commented 1 year ago

Codecov Report

Patch coverage has no change and project coverage change: -0.02 :warning:

Comparison is base (1383ba8) 20.15% compared to head (ba9a50b) 20.13%.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #472 +/- ## ========================================== - Coverage 20.15% 20.13% -0.02% ========================================== Files 80 80 Lines 6600 6605 +5 ========================================== Hits 1330 1330 - Misses 5138 5143 +5 Partials 132 132 ``` | [Impacted Files](https://app.codecov.io/gh/mattermost/mattermost-plugin-apps/pull/472?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=mattermost) | Coverage Δ | | |---|---|---| | [server/proxy/notify.go](https://app.codecov.io/gh/mattermost/mattermost-plugin-apps/pull/472?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=mattermost#diff-c2VydmVyL3Byb3h5L25vdGlmeS5nbw==) | `0.00% <0.00%> (ø)` | | | [server/store/subscriptions.go](https://app.codecov.io/gh/mattermost/mattermost-plugin-apps/pull/472?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=mattermost#diff-c2VydmVyL3N0b3JlL3N1YnNjcmlwdGlvbnMuZ28=) | `37.50% <0.00%> (ø)` | |

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.

hanzei commented 1 year ago

@DHaussermann I think the best way to test this PR is to check the logs for the error message linked in the ticket and confirm it does not longer show up