Mm 16623 fix all initialism errors in channels/app and channels/api4 dir (#25743)
* updated go mod and sum files * fixed var-naming errors in channels/app and channels/api4 dir * Revert "updated go mod and sum files" This reverts commit 088dd00a848c2c31952c29f0a2a28a9fb47fc3f7. * renamed a cost .
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
293caec0c7
Коммит
ebdc964161
@@ -79,7 +79,7 @@ func (cfg *AutoPostCreator) CreateRandomPost(c request.CTX) (*model.Post, error)
|
||||
return cfg.CreateRandomPostNested(c, "")
|
||||
}
|
||||
|
||||
func (cfg *AutoPostCreator) CreateRandomPostNested(c request.CTX, rootId string) (*model.Post, error) {
|
||||
func (cfg *AutoPostCreator) CreateRandomPostNested(c request.CTX, rootID string) (*model.Post, error) {
|
||||
var fileIDs []string
|
||||
if cfg.HasImage {
|
||||
var err error
|
||||
@@ -99,7 +99,7 @@ func (cfg *AutoPostCreator) CreateRandomPostNested(c request.CTX, rootId string)
|
||||
post := &model.Post{
|
||||
ChannelId: cfg.channelid,
|
||||
UserId: cfg.userid,
|
||||
RootId: rootId,
|
||||
RootId: rootID,
|
||||
Message: postText,
|
||||
FileIds: fileIDs,
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@ type InvitePeopleProvider struct {
|
||||
}
|
||||
|
||||
const (
|
||||
CmdInvite_PEOPLE = "invite_people"
|
||||
CmdInvitePeople = "invite_people"
|
||||
)
|
||||
|
||||
func init() {
|
||||
@@ -24,7 +24,7 @@ func init() {
|
||||
}
|
||||
|
||||
func (*InvitePeopleProvider) GetTrigger() string {
|
||||
return CmdInvite_PEOPLE
|
||||
return CmdInvitePeople
|
||||
}
|
||||
|
||||
func (*InvitePeopleProvider) GetCommand(a *app.App, T i18n.TranslateFunc) *model.Command {
|
||||
@@ -33,7 +33,7 @@ func (*InvitePeopleProvider) GetCommand(a *app.App, T i18n.TranslateFunc) *model
|
||||
autoComplete = false
|
||||
}
|
||||
return &model.Command{
|
||||
Trigger: CmdInvite_PEOPLE,
|
||||
Trigger: CmdInvitePeople,
|
||||
AutoComplete: autoComplete,
|
||||
AutoCompleteDesc: T("api.command.invite_people.desc"),
|
||||
AutoCompleteHint: T("api.command.invite_people.hint"),
|
||||
|
||||
@@ -195,7 +195,7 @@ func (lt *LoadTestProvider) doCommand(a *app.App, c request.CTX, args *model.Com
|
||||
}
|
||||
|
||||
if strings.HasPrefix(message, "json") {
|
||||
return lt.JsonCommand(a, c, args, message)
|
||||
return lt.JSONCommand(a, c, args, message)
|
||||
}
|
||||
|
||||
return lt.HelpCommand(args, message), nil
|
||||
@@ -292,8 +292,8 @@ func (*LoadTestProvider) SetupCommand(a *app.App, c request.CTX, args *model.Com
|
||||
}
|
||||
|
||||
func (*LoadTestProvider) ActivateUserCommand(a *app.App, c request.CTX, args *model.CommandArgs, message string) (*model.CommandResponse, error) {
|
||||
user_id := strings.TrimSpace(strings.TrimPrefix(message, "activate_user"))
|
||||
if err := a.UpdateUserActive(c, user_id, true); err != nil {
|
||||
userID := strings.TrimSpace(strings.TrimPrefix(message, "activate_user"))
|
||||
if err := a.UpdateUserActive(c, userID, true); err != nil {
|
||||
return &model.CommandResponse{Text: "Failed to activate user", ResponseType: model.CommandResponseTypeEphemeral}, err
|
||||
}
|
||||
|
||||
@@ -301,8 +301,8 @@ func (*LoadTestProvider) ActivateUserCommand(a *app.App, c request.CTX, args *mo
|
||||
}
|
||||
|
||||
func (*LoadTestProvider) DeActivateUserCommand(a *app.App, c request.CTX, args *model.CommandArgs, message string) (*model.CommandResponse, error) {
|
||||
user_id := strings.TrimSpace(strings.TrimPrefix(message, "deactivate_user"))
|
||||
if err := a.UpdateUserActive(c, user_id, false); err != nil {
|
||||
userID := strings.TrimSpace(strings.TrimPrefix(message, "deactivate_user"))
|
||||
if err := a.UpdateUserActive(c, userID, false); err != nil {
|
||||
return &model.CommandResponse{Text: "Failed to deactivate user", ResponseType: model.CommandResponseTypeEphemeral}, err
|
||||
}
|
||||
|
||||
@@ -670,7 +670,7 @@ func (*LoadTestProvider) URLCommand(a *app.App, c request.CTX, args *model.Comma
|
||||
return &model.CommandResponse{Text: "Loaded data", ResponseType: model.CommandResponseTypeEphemeral}, nil
|
||||
}
|
||||
|
||||
func (*LoadTestProvider) JsonCommand(a *app.App, c request.CTX, args *model.CommandArgs, message string) (*model.CommandResponse, error) {
|
||||
func (*LoadTestProvider) JSONCommand(a *app.App, c request.CTX, args *model.CommandArgs, message string) (*model.CommandResponse, error) {
|
||||
url := strings.TrimSpace(strings.TrimPrefix(message, "json"))
|
||||
if url == "" {
|
||||
return &model.CommandResponse{Text: "Command must contain a url", ResponseType: model.CommandResponseTypeEphemeral}, nil
|
||||
|
||||
@@ -73,7 +73,7 @@ func (*msgProvider) DoCommand(a *app.App, c request.CTX, args *model.CommandArgs
|
||||
// Find the channel based on this user
|
||||
channelName := model.GetDMNameFromIds(args.UserId, userProfile.Id)
|
||||
|
||||
targetChannelId := ""
|
||||
targetChannelID := ""
|
||||
if channel, channelErr := a.Srv().Store().Channel().GetByName(args.TeamId, channelName, true); channelErr != nil {
|
||||
var nfErr *store.ErrNotFound
|
||||
if errors.As(channelErr, &nfErr) {
|
||||
@@ -86,19 +86,19 @@ func (*msgProvider) DoCommand(a *app.App, c request.CTX, args *model.CommandArgs
|
||||
c.Logger().Error(err.Error())
|
||||
return &model.CommandResponse{Text: args.T(err.Id), ResponseType: model.CommandResponseTypeEphemeral}
|
||||
}
|
||||
targetChannelId = directChannel.Id
|
||||
targetChannelID = directChannel.Id
|
||||
} else {
|
||||
c.Logger().Error(channelErr.Error())
|
||||
return &model.CommandResponse{Text: args.T("api.command_msg.dm_fail.app_error"), ResponseType: model.CommandResponseTypeEphemeral}
|
||||
}
|
||||
} else {
|
||||
targetChannelId = channel.Id
|
||||
targetChannelID = channel.Id
|
||||
}
|
||||
|
||||
if parsedMessage != "" {
|
||||
post := &model.Post{}
|
||||
post.Message = parsedMessage
|
||||
post.ChannelId = targetChannelId
|
||||
post.ChannelId = targetChannelID
|
||||
post.UserId = args.UserId
|
||||
if _, err = a.CreatePostMissingChannel(c, post, true, true); err != nil {
|
||||
return &model.CommandResponse{Text: args.T("api.command_msg.fail.app_error"), ResponseType: model.CommandResponseTypeEphemeral}
|
||||
|
||||
@@ -279,10 +279,10 @@ func getRemoteClusterAutocompleteListItems(a *app.App, includeOffline bool) ([]m
|
||||
return list, nil
|
||||
}
|
||||
|
||||
func getRemoteClusterAutocompleteListItemsNotInChannel(a *app.App, channelId string, includeOffline bool) ([]model.AutocompleteListItem, error) {
|
||||
func getRemoteClusterAutocompleteListItemsNotInChannel(a *app.App, channelID string, includeOffline bool) ([]model.AutocompleteListItem, error) {
|
||||
filter := model.RemoteClusterQueryFilter{
|
||||
ExcludeOffline: !includeOffline,
|
||||
NotInChannel: channelId,
|
||||
NotInChannel: channelID,
|
||||
}
|
||||
all, err := a.GetAllRemoteClusters(filter)
|
||||
if err != nil || len(all) == 0 {
|
||||
|
||||
@@ -225,12 +225,12 @@ func (sp *ShareProvider) doUnshareChannel(a *app.App, args *model.CommandArgs, m
|
||||
}
|
||||
|
||||
func (sp *ShareProvider) doInviteRemote(a *app.App, c request.CTX, args *model.CommandArgs, margs map[string]string) (resp *model.CommandResponse) {
|
||||
remoteId, ok := margs["connectionID"]
|
||||
if !ok || remoteId == "" {
|
||||
remoteID, ok := margs["connectionID"]
|
||||
if !ok || remoteID == "" {
|
||||
return responsef(args.T("api.command_share.must_specify_valid_remote"))
|
||||
}
|
||||
|
||||
hasRemote, err := a.HasRemote(args.ChannelId, remoteId)
|
||||
hasRemote, err := a.HasRemote(args.ChannelId, remoteID)
|
||||
if err != nil {
|
||||
return responsef(args.T("api.command_share.fetch_remote.error", map[string]any{"Error": err.Error()}))
|
||||
}
|
||||
@@ -259,7 +259,7 @@ func (sp *ShareProvider) doInviteRemote(a *app.App, c request.CTX, args *model.C
|
||||
return responsef(args.T("api.command_share.channel_invite_not_home.error"))
|
||||
}
|
||||
|
||||
rc, appErr := a.GetRemoteCluster(remoteId)
|
||||
rc, appErr := a.GetRemoteCluster(remoteID)
|
||||
if appErr != nil {
|
||||
return responsef(args.T("api.command_share.remote_id_invalid.error", map[string]any{"Error": appErr.Error()}))
|
||||
}
|
||||
@@ -277,21 +277,21 @@ func (sp *ShareProvider) doInviteRemote(a *app.App, c request.CTX, args *model.C
|
||||
}
|
||||
|
||||
func (sp *ShareProvider) doUninviteRemote(a *app.App, args *model.CommandArgs, margs map[string]string) *model.CommandResponse {
|
||||
remoteId, ok := margs["connectionID"]
|
||||
if !ok || remoteId == "" {
|
||||
remoteID, ok := margs["connectionID"]
|
||||
if !ok || remoteID == "" {
|
||||
return responsef(args.T("api.command_share.remote_not_valid"))
|
||||
}
|
||||
|
||||
scr, err := a.GetSharedChannelRemoteByIds(args.ChannelId, remoteId)
|
||||
scr, err := a.GetSharedChannelRemoteByIds(args.ChannelId, remoteID)
|
||||
if err != nil || scr.ChannelId != args.ChannelId {
|
||||
return responsef(args.T("api.command_share.channel_remote_id_not_exists", map[string]any{"RemoteId": remoteId}))
|
||||
return responsef(args.T("api.command_share.channel_remote_id_not_exists", map[string]any{"RemoteId": remoteID}))
|
||||
}
|
||||
|
||||
deleted, err := a.DeleteSharedChannelRemote(scr.Id)
|
||||
if err != nil || !deleted {
|
||||
return responsef(args.T("api.command_share.could_not_uninvite.error", map[string]any{"RemoteId": remoteId, "Error": err.Error()}))
|
||||
return responsef(args.T("api.command_share.could_not_uninvite.error", map[string]any{"RemoteId": remoteID, "Error": err.Error()}))
|
||||
}
|
||||
return responsef("##### " + args.T("api.command_share.remote_uninvited", map[string]any{"RemoteId": remoteId}))
|
||||
return responsef("##### " + args.T("api.command_share.remote_uninvited", map[string]any{"RemoteId": remoteID}))
|
||||
}
|
||||
|
||||
func (sp *ShareProvider) doStatus(a *app.App, args *model.CommandArgs, _ map[string]string) *model.CommandResponse {
|
||||
|
||||
Ссылка в новой задаче
Block a user