Skip to content

Commit

Permalink
[MM-51931] Don't send channel_created event for DMs (#472)
Browse files Browse the repository at this point in the history
  • Loading branch information
hanzei authored May 24, 2023
1 parent 1383ba8 commit a9564c8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
6 changes: 6 additions & 0 deletions server/proxy/notify.go
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,12 @@ func (p *Proxy) NotifyUserTeam(member *model.TeamMember, actor *model.User, join
// NotifyChannelCreated handles plugin's ChannelHasBeenCreated callback. It emits
// "channel_created" notifications to subscribed apps.
func (p *Proxy) NotifyChannelCreated(teamID, channelID string) {
// If the newly created channel is a DM, there is no teamID.
// Do not notify apps in this case.
if teamID == "" {
return
}

p.notifyAll(
apps.Event{
Subject: apps.SubjectChannelCreated,
Expand Down
2 changes: 1 addition & 1 deletion server/store/subscriptions.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ func subsKey(e apps.Event) (string, error) {
func (s subscriptionStore) Get(e apps.Event) ([]Subscription, error) {
key, err := subsKey(e)
if err != nil {
return nil, err
return nil, errors.Wrap(err, "failed to generate event key")
}

stored := &StoredSubscriptions{}
Expand Down

0 comments on commit a9564c8

Please sign in to comment.