Updated permanentDelete to receive user context as the first argument (#26884)

Co-authored-by: Ezekiel <ezekielchow94@gmail.com>
Этот коммит содержится в:
Ben Schumacher
2024-04-29 10:44:55 +02:00
коммит произвёл GitHub
родитель a6aa92d149
Коммит 5746bb8df3
21 изменённых файлов: 245 добавлений и 248 удалений

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

@@ -124,7 +124,7 @@ func (a *App) CreateBot(rctx request.CTX, bot *model.Bot) (*model.Bot, *model.Ap
savedBot, nErr := a.Srv().Store().Bot().Save(bot)
if nErr != nil {
a.Srv().Store().User().PermanentDelete(bot.UserId)
a.Srv().Store().User().PermanentDelete(rctx, bot.UserId)
var appErr *model.AppError
switch {
case errors.As(nErr, &appErr): // in case we haven't converted to plain error.
@@ -227,7 +227,7 @@ func (a *App) getOrCreateBot(rctx request.CTX, botDef *model.Bot) (*model.Bot, *
//save the bot
savedBot, nErr := a.Srv().Store().Bot().Save(botDef)
if nErr != nil {
a.Srv().Store().User().PermanentDelete(savedBot.UserId)
a.Srv().Store().User().PermanentDelete(rctx, savedBot.UserId)
var nAppErr *model.AppError
switch {
case errors.As(nErr, &nAppErr): // in case we haven't converted to plain error.
@@ -414,7 +414,7 @@ func (a *App) PermanentDeleteBot(rctx request.CTX, botUserId string) *model.AppE
}
}
if err := a.Srv().Store().User().PermanentDelete(botUserId); err != nil {
if err := a.Srv().Store().User().PermanentDelete(rctx, botUserId); err != nil {
return model.NewAppError("PermanentDeleteBot", "app.user.permanent_delete.app_error", nil, "", http.StatusInternalServerError).Wrap(err)
}