* Fix initialism errors

* Revert some changes and regenerate file

* Update client4.go

* Update group_test.go

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
Этот коммит содержится в:
Haardik Dharma
2021-03-23 01:08:19 +05:30
коммит произвёл GitHub
родитель 0aa6499a48
Коммит ea61458f16
26 изменённых файлов: 1146 добавлений и 1146 удалений

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

@@ -149,15 +149,15 @@ func (a *App) getOrCreateWarnMetricsBot(botDef *model.Bot) (*model.Bot, *model.A
}
// PatchBot applies the given patch to the bot and corresponding user.
func (a *App) PatchBot(botUserId string, botPatch *model.BotPatch) (*model.Bot, *model.AppError) {
bot, err := a.GetBot(botUserId, true)
func (a *App) PatchBot(botUserID string, botPatch *model.BotPatch) (*model.Bot, *model.AppError) {
bot, err := a.GetBot(botUserID, true)
if err != nil {
return nil, err
}
bot.Patch(botPatch)
user, nErr := a.Srv().Store.User().Get(context.Background(), botUserId)
user, nErr := a.Srv().Store.User().Get(context.Background(), botUserID)
if nErr != nil {
var nfErr *store.ErrNotFound
switch {
@@ -209,8 +209,8 @@ func (a *App) PatchBot(botUserId string, botPatch *model.BotPatch) (*model.Bot,
}
// GetBot returns the given bot.
func (a *App) GetBot(botUserId string, includeDeleted bool) (*model.Bot, *model.AppError) {
bot, err := a.Srv().Store.Bot().Get(botUserId, includeDeleted)
func (a *App) GetBot(botUserID string, includeDeleted bool) (*model.Bot, *model.AppError) {
bot, err := a.Srv().Store.Bot().Get(botUserID, includeDeleted)
if err != nil {
var nfErr *store.ErrNotFound
switch {
@@ -233,8 +233,8 @@ func (a *App) GetBots(options *model.BotGetOptions) (model.BotList, *model.AppEr
}
// UpdateBotActive marks a bot as active or inactive, along with its corresponding user.
func (a *App) UpdateBotActive(botUserId string, active bool) (*model.Bot, *model.AppError) {
user, nErr := a.Srv().Store.User().Get(context.Background(), botUserId)
func (a *App) UpdateBotActive(botUserID string, active bool) (*model.Bot, *model.AppError) {
user, nErr := a.Srv().Store.User().Get(context.Background(), botUserID)
if nErr != nil {
var nfErr *store.ErrNotFound
switch {
@@ -249,7 +249,7 @@ func (a *App) UpdateBotActive(botUserId string, active bool) (*model.Bot, *model
return nil, err
}
bot, nErr := a.Srv().Store.Bot().Get(botUserId, true)
bot, nErr := a.Srv().Store.Bot().Get(botUserID, true)
if nErr != nil {
var nfErr *store.ErrNotFound
switch {
@@ -289,8 +289,8 @@ func (a *App) UpdateBotActive(botUserId string, active bool) (*model.Bot, *model
}
// PermanentDeleteBot permanently deletes a bot and its corresponding user.
func (a *App) PermanentDeleteBot(botUserId string) *model.AppError {
if err := a.Srv().Store.Bot().PermanentDelete(botUserId); err != nil {
func (a *App) PermanentDeleteBot(botUserID string) *model.AppError {
if err := a.Srv().Store.Bot().PermanentDelete(botUserID); err != nil {
var invErr *store.ErrInvalidInput
switch {
case errors.As(err, &invErr):
@@ -300,7 +300,7 @@ func (a *App) PermanentDeleteBot(botUserId string) *model.AppError {
}
}
if err := a.Srv().Store.User().PermanentDelete(botUserId); err != nil {
if err := a.Srv().Store.User().PermanentDelete(botUserID); err != nil {
return model.NewAppError("PermanentDeleteBot", "app.user.permanent_delete.app_error", nil, err.Error(), http.StatusInternalServerError)
}
@@ -308,8 +308,8 @@ func (a *App) PermanentDeleteBot(botUserId string) *model.AppError {
}
// UpdateBotOwner changes a bot's owner to the given value.
func (a *App) UpdateBotOwner(botUserId, newOwnerId string) (*model.Bot, *model.AppError) {
bot, err := a.Srv().Store.Bot().Get(botUserId, true)
func (a *App) UpdateBotOwner(botUserID, newOwnerID string) (*model.Bot, *model.AppError) {
bot, err := a.Srv().Store.Bot().Get(botUserID, true)
if err != nil {
var nfErr *store.ErrNotFound
switch {
@@ -320,7 +320,7 @@ func (a *App) UpdateBotOwner(botUserId, newOwnerId string) (*model.Bot, *model.A
}
}
bot.OwnerId = newOwnerId
bot.OwnerId = newOwnerID
bot, err = a.Srv().Store.Bot().Update(bot)
if err != nil {
@@ -500,7 +500,7 @@ func (a *App) ConvertUserToBot(user *model.User) (*model.Bot, *model.AppError) {
}
// SetBotIconImageFromMultiPartFile sets LHS icon for a bot.
func (a *App) SetBotIconImageFromMultiPartFile(botUserId string, imageData *multipart.FileHeader) *model.AppError {
func (a *App) SetBotIconImageFromMultiPartFile(botUserID string, imageData *multipart.FileHeader) *model.AppError {
file, err := imageData.Open()
if err != nil {
return model.NewAppError("SetBotIconImage", "api.bot.set_bot_icon_image.open.app_error", nil, err.Error(), http.StatusBadRequest)
@@ -508,12 +508,12 @@ func (a *App) SetBotIconImageFromMultiPartFile(botUserId string, imageData *mult
defer file.Close()
file.Seek(0, 0)
return a.SetBotIconImage(botUserId, file)
return a.SetBotIconImage(botUserID, file)
}
// SetBotIconImage sets LHS icon for a bot.
func (a *App) SetBotIconImage(botUserId string, file io.ReadSeeker) *model.AppError {
bot, err := a.GetBot(botUserId, true)
func (a *App) SetBotIconImage(botUserID string, file io.ReadSeeker) *model.AppError {
bot, err := a.GetBot(botUserID, true)
if err != nil {
return err
}
@@ -524,7 +524,7 @@ func (a *App) SetBotIconImage(botUserId string, file io.ReadSeeker) *model.AppEr
// Set icon
file.Seek(0, 0)
if _, err = a.WriteFile(file, getBotIconPath(botUserId)); err != nil {
if _, err = a.WriteFile(file, getBotIconPath(botUserID)); err != nil {
return model.NewAppError("SetBotIconImage", "api.bot.set_bot_icon_image.app_error", nil, err.Error(), http.StatusInternalServerError)
}
@@ -541,24 +541,24 @@ func (a *App) SetBotIconImage(botUserId string, file io.ReadSeeker) *model.AppEr
return model.NewAppError("SetBotIconImage", "app.bot.patchbot.internal_error", nil, err.Error(), http.StatusInternalServerError)
}
}
a.invalidateUserCacheAndPublish(botUserId)
a.invalidateUserCacheAndPublish(botUserID)
return nil
}
// DeleteBotIconImage deletes LHS icon for a bot.
func (a *App) DeleteBotIconImage(botUserId string) *model.AppError {
bot, err := a.GetBot(botUserId, true)
func (a *App) DeleteBotIconImage(botUserID string) *model.AppError {
bot, err := a.GetBot(botUserID, true)
if err != nil {
return err
}
// Delete icon
if err = a.RemoveFile(getBotIconPath(botUserId)); err != nil {
if err = a.RemoveFile(getBotIconPath(botUserID)); err != nil {
return model.NewAppError("DeleteBotIconImage", "api.bot.delete_bot_icon_image.app_error", nil, err.Error(), http.StatusInternalServerError)
}
if nErr := a.Srv().Store.User().UpdateLastPictureUpdate(botUserId); nErr != nil {
if nErr := a.Srv().Store.User().UpdateLastPictureUpdate(botUserID); nErr != nil {
mlog.Warn(nErr.Error())
}
@@ -576,18 +576,18 @@ func (a *App) DeleteBotIconImage(botUserId string) *model.AppError {
}
}
a.invalidateUserCacheAndPublish(botUserId)
a.invalidateUserCacheAndPublish(botUserID)
return nil
}
// GetBotIconImage retrieves LHS icon for a bot.
func (a *App) GetBotIconImage(botUserId string) ([]byte, *model.AppError) {
if _, err := a.GetBot(botUserId, true); err != nil {
func (a *App) GetBotIconImage(botUserID string) ([]byte, *model.AppError) {
if _, err := a.GetBot(botUserID, true); err != nil {
return nil, err
}
data, err := a.ReadFile(getBotIconPath(botUserId))
data, err := a.ReadFile(getBotIconPath(botUserID))
if err != nil {
return nil, model.NewAppError("GetBotIconImage", "api.bot.get_bot_icon_image.read.app_error", nil, err.Error(), http.StatusNotFound)
}
@@ -595,6 +595,6 @@ func (a *App) GetBotIconImage(botUserId string) ([]byte, *model.AppError) {
return data, nil
}
func getBotIconPath(botUserId string) string {
return fmt.Sprintf("bots/%v/icon.svg", botUserId)
func getBotIconPath(botUserID string) string {
return fmt.Sprintf("bots/%v/icon.svg", botUserID)
}