MM-13934 - Plugin helper function EnsureBot doesn't compare bot details (#14103)

Этот коммит содержится в:
Harshil Sharma
2020-05-27 18:18:43 +05:30
коммит произвёл GitHub
родитель 14f7118dde
Коммит dea705969c
2 изменённых файлов: 72 добавлений и 1 удалений

Просмотреть файл

@@ -231,9 +231,21 @@ func (p *HelpersImpl) ensureBot(bot *model.Bot) (retBotID string, retErr error)
return "", errors.Wrap(kvGetErr, "failed to get bot")
}
// If the bot has already been created, there is nothing to do.
// If the bot has already been created, use it
if botIDBytes != nil {
botID := string(botIDBytes)
// ensure existing bot is synced with what is being created
botPatch := &model.BotPatch{
Username: &bot.Username,
DisplayName: &bot.DisplayName,
Description: &bot.Description,
}
if _, err := p.API.PatchBot(botID, botPatch); err != nil {
return "", errors.Wrap(err, "failed to patch bot")
}
return botID, nil
}