Skip to content

Commit bd2962c

Browse files
committed
Run a membership sync immediately if the team has changed
1 parent 5ecb2d7 commit bd2962c

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

server/commandhandler.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,12 +155,20 @@ func (h *CommandHandler) executeRename(ctx context.Context, c *plugin.Context, a
155155
}
156156
}
157157

158+
oldName := ch.Name
158159
ch.Name = newName
159160
ch.DisplayName = newName
160161
if err := h.client.Channel.Update(ch); err != nil {
161162
return errResponsef("Renaming the channel failed: %v", err)
162163
}
163164

165+
// If we renamed across teams then we need to run a sync.
166+
if !strings.HasPrefix(oldName, foundTeam.Name) {
167+
if err := h.runSync(ctx, "channel-rename"); err != nil {
168+
return errResponsef("An error occurred syncing membership information: %v", err)
169+
}
170+
}
171+
164172
return &model.CommandResponse{}, nil
165173
}
166174

0 commit comments

Comments
 (0)