MM-22355 - Fix typos detected by goreportcad.com (#13842)
* Update webhook_test.go * Update user_test.go * Update filesstore_test.go * Update plugin_requests.go * Update syncables.go * Update helper.go * Update html_entities.go * Update user.go * Update team.go * Update notification.go * Update notification_test.go * Update plugin_api_test.go * Update post_metadata.go * Update channel_test.go * Update database.go * Update channel.go * Update user_store.go * Update team_test.go * revert andd * Revert back to infintie Co-authored-by: Jesús Espino <jespinog@gmail.com> Co-authored-by: mattermod <mattermod@users.noreply.github.com>
Этот коммит содержится в:
@@ -1163,7 +1163,7 @@ func viewChannel(c *Context, w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
|
||||
// Validate view struct
|
||||
// Check IDs are valid or blank. Blank IDs are used to denote focus loss or inital channel view.
|
||||
// Check IDs are valid or blank. Blank IDs are used to denote focus loss or initial channel view.
|
||||
if view.ChannelId != "" && !model.IsValidId(view.ChannelId) {
|
||||
c.SetInvalidParam("channel_view.channel_id")
|
||||
return
|
||||
|
||||
@@ -2828,7 +2828,7 @@ func TestUpdateChannelScheme(t *testing.T) {
|
||||
_, resp = th.Client.UpdateChannelScheme(channel.Id, channelScheme.Id)
|
||||
CheckForbiddenStatus(t, resp)
|
||||
|
||||
// Test that a license is requried.
|
||||
// Test that a license is required.
|
||||
th.App.SetLicense(nil)
|
||||
_, resp = th.SystemAdminClient.UpdateChannelScheme(channel.Id, channelScheme.Id)
|
||||
CheckNotImplementedStatus(t, resp)
|
||||
|
||||
@@ -986,7 +986,7 @@ func inviteUsersToTeam(c *Context, w http.ResponseWriter, r *http.Request) {
|
||||
c.Err = err
|
||||
return
|
||||
}
|
||||
// in graceful mode we return both the succesful ones and the failed ones
|
||||
// in graceful mode we return both the successful ones and the failed ones
|
||||
w.Write([]byte(model.EmailInviteWithErrorToJson(invitesWithError)))
|
||||
} else {
|
||||
err := c.App.InviteNewUsersToTeam(emailList, c.Params.TeamId, c.App.Session().UserId)
|
||||
@@ -1035,7 +1035,7 @@ func inviteGuestsToChannels(c *Context, w http.ResponseWriter, r *http.Request)
|
||||
c.Err = err
|
||||
return
|
||||
}
|
||||
// in graceful mode we return both the succesful ones and the failed ones
|
||||
// in graceful mode we return both the successful ones and the failed ones
|
||||
w.Write([]byte(model.EmailInviteWithErrorToJson(invitesWithError)))
|
||||
} else {
|
||||
err := c.App.InviteGuestsToChannels(c.Params.TeamId, guestsInvite, c.App.Session().UserId)
|
||||
|
||||
@@ -2483,7 +2483,7 @@ func TestRevokeSessions(t *testing.T) {
|
||||
CheckBadRequestStatus(t, resp)
|
||||
|
||||
status, resp := th.Client.RevokeSession(user.Id, session.Id)
|
||||
require.True(t, status, "user session revoke successfuly")
|
||||
require.True(t, status, "user session revoke successfully")
|
||||
CheckNoError(t, resp)
|
||||
|
||||
th.LoginBasic()
|
||||
|
||||
@@ -703,7 +703,7 @@ type PostNotification struct {
|
||||
}
|
||||
|
||||
// Returns the name of the channel for this notification. For direct messages, this is the sender's name
|
||||
// preceeded by an at sign. For group messages, this is a comma-separated list of the members of the
|
||||
// preceded by an at sign. For group messages, this is a comma-separated list of the members of the
|
||||
// channel, with an option to exclude the recipient of the message from that list.
|
||||
func (n *PostNotification) GetChannelName(userNameFormat, excludeId string) string {
|
||||
switch n.Channel.Type {
|
||||
|
||||
@@ -247,7 +247,7 @@ func TestFilterOutOfChannelMentions(t *testing.T) {
|
||||
assert.Nil(t, outOfGroupUsers)
|
||||
})
|
||||
|
||||
t.Run("should not return results for non-existant users", func(t *testing.T) {
|
||||
t.Run("should not return results for non-existent users", func(t *testing.T) {
|
||||
post := &model.Post{}
|
||||
potentialMentions := []string{"foo", "bar"}
|
||||
|
||||
|
||||
@@ -919,7 +919,7 @@ func pluginAPIHookTest(t *testing.T, th *TestHelper, fileName string, id string,
|
||||
// 2. For each folder - compiles the main.go inside and executes it, validating it's result
|
||||
// 3. If folder starts with "manual." it is skipped ("manual." tests executed in other part of this file)
|
||||
// 4. Before compiling the main.go file is passed through templating and the following values are available in the template: BasicUser, BasicUser2, BasicChannel, BasicTeam, BasicPost
|
||||
// 5. Succesfully running test should return nil, "OK". Any other returned string is considered and error
|
||||
// 5. Successfully running test should return nil, "OK". Any other returned string is considered and error
|
||||
|
||||
func TestBasicAPIPlugins(t *testing.T) {
|
||||
defaultSchema := getDefaultPluginSettingsSchema()
|
||||
|
||||
@@ -45,7 +45,7 @@ func (a *App) ServePluginRequest(w http.ResponseWriter, r *http.Request) {
|
||||
func (a *App) ServeInterPluginRequest(w http.ResponseWriter, r *http.Request, sourcePluginId, destinationPluginId string) {
|
||||
pluginsEnvironment := a.GetPluginsEnvironment()
|
||||
if pluginsEnvironment == nil {
|
||||
err := model.NewAppError("ServeInterPluginRequest", "app.plugin.disabled.app_error", nil, "Plugin enviroment not found.", http.StatusNotImplemented)
|
||||
err := model.NewAppError("ServeInterPluginRequest", "app.plugin.disabled.app_error", nil, "Plugin environment not found.", http.StatusNotImplemented)
|
||||
a.Log().Error(err.Error())
|
||||
w.WriteHeader(err.StatusCode)
|
||||
w.Header().Set("Content-Type", "application/json")
|
||||
|
||||
@@ -72,7 +72,7 @@ func (a *App) OverrideIconURLIfEmoji(post *model.Post) {
|
||||
if emojiUrl, err := a.GetEmojiStaticUrl(emojiName); err == nil {
|
||||
post.AddProp(model.POST_PROPS_OVERRIDE_ICON_URL, emojiUrl)
|
||||
} else {
|
||||
mlog.Warn("Failed to retrieve URL for overriden profile icon (emoji)", mlog.String("emojiName", emojiName), mlog.Err(err))
|
||||
mlog.Warn("Failed to retrieve URL for overridden profile icon (emoji)", mlog.String("emojiName", emojiName), mlog.Err(err))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -123,7 +123,7 @@ func (a *App) DeleteGroupConstrainedMemberships() error {
|
||||
|
||||
// deleteGroupConstrainedTeamMemberships deletes team memberships of users who aren't members of the allowed
|
||||
// groups of the given group-constrained team. If a teamID is given then the procedure is scoped to the given team,
|
||||
// if teamID is nil then the proceedure affects all teams.
|
||||
// if teamID is nil then the procedure affects all teams.
|
||||
func (a *App) deleteGroupConstrainedTeamMemberships(teamID *string) error {
|
||||
teamMembers, appErr := a.TeamMembersToRemove(teamID)
|
||||
if appErr != nil {
|
||||
@@ -147,7 +147,7 @@ func (a *App) deleteGroupConstrainedTeamMemberships(teamID *string) error {
|
||||
|
||||
// deleteGroupConstrainedChannelMemberships deletes channel memberships of users who aren't members of the allowed
|
||||
// groups of the given group-constrained channel. If a channelID is given then the procedure is scoped to the given team,
|
||||
// if channelID is nil then the proceedure affects all teams.
|
||||
// if channelID is nil then the procedure affects all teams.
|
||||
func (a *App) deleteGroupConstrainedChannelMemberships(channelID *string) error {
|
||||
channelMembers, appErr := a.ChannelMembersToRemove(channelID)
|
||||
if appErr != nil {
|
||||
|
||||
@@ -209,7 +209,7 @@ func TestRenameTeam(t *testing.T) {
|
||||
|
||||
th.CheckCommand(t, "team", "rename", team2.Name, newTeamName, "--display_name", newDisplayName)
|
||||
|
||||
// No renaming should have occured
|
||||
// No renaming should have occurred
|
||||
require.Equal(t, team2.Name, n, "team was renamed when it should have not been")
|
||||
require.Equal(t, team2.DisplayName, dn, "team display name was changed when it should have not been")
|
||||
|
||||
|
||||
@@ -373,7 +373,7 @@ func userCreateCmdF(command *cobra.Command, args []string) error {
|
||||
}
|
||||
} else {
|
||||
// This else case exists to prevent the first user created from being
|
||||
// created as a system admin unless explicity specified.
|
||||
// created as a system admin unless explicitly specified.
|
||||
if _, err := a.UpdateUserRoles(ruser.Id, "system_user", false); err != nil {
|
||||
return errors.New("If this is the first user: Unable to prevent user from being system admin. Error: " + err.Error())
|
||||
}
|
||||
|
||||
@@ -291,7 +291,7 @@ func TestCreateOutgoingWebhook(t *testing.T) {
|
||||
th.CheckCommand(t, "webhook", "create-outgoing", "--team", team, "--channel", th.BasicChannel.Id, "--display-name", displayName, "--trigger-word", triggerWord1, "--trigger-word", triggerWord2, "--url", callbackURL1, "--url", callbackURL2, "--user", user)
|
||||
|
||||
webhooks, err := th.App.GetOutgoingWebhooksPage(0, 1000)
|
||||
require.Nil(t, err, "Unable to retreive outgoing webhooks")
|
||||
require.Nil(t, err, "Unable to retrieve outgoing webhooks")
|
||||
|
||||
found := false
|
||||
for _, webhook := range webhooks {
|
||||
|
||||
@@ -102,7 +102,7 @@ func initializeConfigurationsTable(db *sqlx.DB) error {
|
||||
|
||||
// Change from TEXT (65535 limit) to MEDIUM TEXT (16777215) on MySQL. This is a
|
||||
// backwards-compatible migration for any existing schema.
|
||||
// Also fix using the wrong encoding initally
|
||||
// Also fix using the wrong encoding initially
|
||||
if db.DriverName() == "mysql" {
|
||||
_, err = db.Exec(`ALTER TABLE Configurations MODIFY Value MEDIUMTEXT`)
|
||||
if err != nil {
|
||||
|
||||
@@ -27,7 +27,7 @@ type FileBackendTestSuite struct {
|
||||
|
||||
func TestLocalFileBackendTestSuite(t *testing.T) {
|
||||
// Setup a global logger to catch tests logging outside of app context
|
||||
// The global logger will be stomped by apps initalizing but that's fine for testing. Ideally this won't happen.
|
||||
// The global logger will be stomped by apps initializing but that's fine for testing. Ideally this won't happen.
|
||||
mlog.InitGlobalLogger(mlog.NewLogger(&mlog.LoggerConfiguration{
|
||||
EnableConsole: true,
|
||||
ConsoleJson: true,
|
||||
|
||||
@@ -1021,7 +1021,7 @@ func (us SqlUserStore) Count(options model.UserCountOptions) (int64, *model.AppE
|
||||
} else {
|
||||
query = query.LeftJoin("Bots ON u.Id = Bots.UserId").Where("Bots.UserId IS NULL")
|
||||
if options.ExcludeRegularUsers {
|
||||
// Currenty this doesn't make sense because it will always return 0
|
||||
// Currently this doesn't make sense because it will always return 0
|
||||
return int64(0), model.NewAppError("SqlUserStore.Count", "store.sql_user.count.app_error", nil, "", http.StatusInternalServerError)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -45,7 +45,7 @@ func NewMainHelperWithOptions(options *HelperOptions) *MainHelper {
|
||||
flag.Parse()
|
||||
|
||||
// Setup a global logger to catch tests logging outside of app context
|
||||
// The global logger will be stomped by apps initalizing but that's fine for testing.
|
||||
// The global logger will be stomped by apps initializing but that's fine for testing.
|
||||
// Ideally this won't happen.
|
||||
mlog.InitGlobalLogger(mlog.NewLogger(&mlog.LoggerConfiguration{
|
||||
EnableConsole: true,
|
||||
|
||||
Ссылка в новой задаче
Block a user