mirror of
https://github.com/mattermost/mattermost.git
synced 2026-02-18 18:18:23 -05:00
Add whitespace linter (#24855)
This commit is contained in:
parent
176370e175
commit
0d5a8b8841
189 changed files with 1 additions and 361 deletions
|
|
@ -28,6 +28,7 @@ linters:
|
|||
- misspell
|
||||
- goimports
|
||||
- makezero
|
||||
- whitespace
|
||||
# TODO: enable this later
|
||||
# - errcheck
|
||||
|
||||
|
|
|
|||
|
|
@ -1325,7 +1325,6 @@ func TestAssignBot(t *testing.T) {
|
|||
|
||||
_, _, err = th.Client.AssignBot(context.Background(), bot.UserId, bot2.UserId)
|
||||
CheckErrorID(t, err, "api.context.permissions.app_error")
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -834,7 +834,6 @@ func TestDeleteGroupChannel(t *testing.T) {
|
|||
_, err = client.DeleteChannel(context.Background(), rgc.Id)
|
||||
CheckErrorID(t, err, "api.channel.delete_channel.type.invalid")
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
func TestGetChannel(t *testing.T) {
|
||||
|
|
@ -2020,7 +2019,6 @@ func TestDeleteChannel(t *testing.T) {
|
|||
require.NoError(t, err)
|
||||
})
|
||||
th.TestForSystemAdminAndLocal(t, func(t *testing.T, client *model.Client4) {
|
||||
|
||||
th.LoginBasic()
|
||||
publicChannel5 := th.CreatePublicChannel()
|
||||
c.Logout(context.Background())
|
||||
|
|
@ -2041,9 +2039,7 @@ func TestDeleteChannel(t *testing.T) {
|
|||
|
||||
_, err = client.DeleteChannel(context.Background(), publicChannel5.Id)
|
||||
require.NoError(t, err)
|
||||
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
func TestDeleteChannel2(t *testing.T) {
|
||||
|
|
@ -3393,7 +3389,6 @@ func TestAddChannelMemberAddMyself(t *testing.T) {
|
|||
client.Login(context.Background(), user.Email, user.Password)
|
||||
for _, tc := range testCases {
|
||||
t.Run(tc.Name, func(t *testing.T) {
|
||||
|
||||
// Check the appropriate permissions are enforced.
|
||||
defaultRolePermissions := th.SaveDefaultRolePermissions()
|
||||
defer func() {
|
||||
|
|
|
|||
|
|
@ -329,7 +329,6 @@ func Test_requestTrial(t *testing.T) {
|
|||
}
|
||||
|
||||
func Test_validateBusinessEmail(t *testing.T) {
|
||||
|
||||
t.Run("Returns forbidden for invalid business email", func(t *testing.T) {
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
|
|
|||
|
|
@ -552,7 +552,6 @@ func TestGetCommand(t *testing.T) {
|
|||
newCmd, _, err := th.SystemAdminClient.CreateCommand(context.Background(), newCmd)
|
||||
require.NoError(t, err)
|
||||
th.TestForSystemAdminAndLocal(t, func(t *testing.T, client *model.Client4) {
|
||||
|
||||
t.Run("ValidId", func(t *testing.T) {
|
||||
cmd, _, err := client.GetCommandById(context.Background(), newCmd.Id)
|
||||
require.NoError(t, err)
|
||||
|
|
|
|||
|
|
@ -21,7 +21,6 @@ func (api *API) InitDrafts() {
|
|||
}
|
||||
|
||||
func upsertDraft(c *Context, w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
if !*c.App.Config().ServiceSettings.AllowSyncedDrafts {
|
||||
c.Err = model.NewAppError("upsertDraft", "api.drafts.disabled.app_error", nil, "", http.StatusNotImplemented)
|
||||
return
|
||||
|
|
|
|||
|
|
@ -42,7 +42,6 @@ func (api *API) InitFile() {
|
|||
api.BaseRoutes.Team.Handle("/files/search", api.APISessionRequiredDisableWhenBusy(searchFiles)).Methods("POST")
|
||||
|
||||
api.BaseRoutes.PublicFile.Handle("", api.APIHandler(getPublicFile)).Methods("GET")
|
||||
|
||||
}
|
||||
|
||||
func parseMultipartRequestHeader(req *http.Request) (boundary string, err error) {
|
||||
|
|
@ -179,7 +178,6 @@ func uploadFileSimple(c *Context, r *http.Request, timestamp time.Time) *model.F
|
|||
// entire message recursively calling itself in stream mode. In case of (b) it
|
||||
// calls to uploadFileMultipartLegacy for legacy support
|
||||
func uploadFileMultipart(c *Context, r *http.Request, asStream io.Reader, timestamp time.Time) *model.FileUploadResponse {
|
||||
|
||||
expectClientIds := true
|
||||
var clientIds []string
|
||||
resp := model.FileUploadResponse{
|
||||
|
|
@ -356,7 +354,6 @@ NextPart:
|
|||
// *model.FileUploadResponse filled in with the individual model.FileInfo's.
|
||||
func uploadFileMultipartLegacy(c *Context, mr *multipart.Reader,
|
||||
timestamp time.Time) *model.FileUploadResponse {
|
||||
|
||||
// Parse the entire form.
|
||||
form, err := mr.ReadForm(*c.App.Config().FileSettings.MaxFileSize)
|
||||
if err != nil {
|
||||
|
|
|
|||
|
|
@ -97,7 +97,6 @@ func testUploadFilesPost(
|
|||
clientIds []string,
|
||||
useChunked bool,
|
||||
) (*model.FileUploadResponse, *model.Response, error) {
|
||||
|
||||
// Do not check len(clientIds), leave it entirely to the user to
|
||||
// provide. The server will error out if it does not match the number
|
||||
// of files, but it's not critical here.
|
||||
|
|
@ -731,7 +730,6 @@ func TestUploadFiles(t *testing.T) {
|
|||
th.cleanupTestFile(dbInfo)
|
||||
}
|
||||
})
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1426,7 +1426,6 @@ func TestGetGroupsByUserId(t *testing.T) {
|
|||
groups, _, err = th.Client.GetGroupsByUserId(context.Background(), user1.Id)
|
||||
require.NoError(t, err)
|
||||
assert.ElementsMatch(t, []*model.Group{group1, group2}, groups)
|
||||
|
||||
}
|
||||
|
||||
func TestGetGroupStats(t *testing.T) {
|
||||
|
|
|
|||
|
|
@ -54,7 +54,6 @@ func (api *API) APISessionRequired(h handlerFunc) http.Handler {
|
|||
return gziphandler.GzipHandler(handler)
|
||||
}
|
||||
return handler
|
||||
|
||||
}
|
||||
|
||||
// CloudAPIKeyRequired provides a handler for webhook endpoints to access Cloud installations from CWS
|
||||
|
|
@ -74,7 +73,6 @@ func (api *API) CloudAPIKeyRequired(h handlerFunc) http.Handler {
|
|||
return gziphandler.GzipHandler(handler)
|
||||
}
|
||||
return handler
|
||||
|
||||
}
|
||||
|
||||
// RemoteClusterTokenRequired provides a handler for remote cluster requests to /remotecluster endpoints.
|
||||
|
|
@ -115,7 +113,6 @@ func (api *API) APISessionRequiredMfa(h handlerFunc) http.Handler {
|
|||
return gziphandler.GzipHandler(handler)
|
||||
}
|
||||
return handler
|
||||
|
||||
}
|
||||
|
||||
// APIHandlerTrustRequester provides a handler for API endpoints which do not require the user to be logged in and are
|
||||
|
|
@ -136,7 +133,6 @@ func (api *API) APIHandlerTrustRequester(h handlerFunc) http.Handler {
|
|||
return gziphandler.GzipHandler(handler)
|
||||
}
|
||||
return handler
|
||||
|
||||
}
|
||||
|
||||
// APISessionRequiredTrustRequester provides a handler for API endpoints which do require the user to be logged in and
|
||||
|
|
@ -156,7 +152,6 @@ func (api *API) APISessionRequiredTrustRequester(h handlerFunc) http.Handler {
|
|||
return gziphandler.GzipHandler(handler)
|
||||
}
|
||||
return handler
|
||||
|
||||
}
|
||||
|
||||
// DisableWhenBusy provides a handler for API endpoints which should be disabled when the server is under load,
|
||||
|
|
@ -177,7 +172,6 @@ func (api *API) APISessionRequiredDisableWhenBusy(h handlerFunc) http.Handler {
|
|||
return gziphandler.GzipHandler(handler)
|
||||
}
|
||||
return handler
|
||||
|
||||
}
|
||||
|
||||
// APILocal provides a handler for API endpoints to be used in local
|
||||
|
|
|
|||
|
|
@ -12,5 +12,4 @@ func (api *API) InitLdapLocal() {
|
|||
api.BaseRoutes.LDAP.Handle("/certificate/private", api.APILocal(addLdapPrivateCertificate)).Methods("POST")
|
||||
api.BaseRoutes.LDAP.Handle("/certificate/public", api.APILocal(removeLdapPublicCertificate)).Methods("DELETE")
|
||||
api.BaseRoutes.LDAP.Handle("/certificate/private", api.APILocal(removeLdapPrivateCertificate)).Methods("DELETE")
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -294,7 +294,6 @@ func TestRequestTrialLicenseWithExtraFields(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("returns status 451 when it receives status 451", func(t *testing.T) {
|
||||
|
||||
license := model.NewTestLicense()
|
||||
license.Features.Users = model.NewInt(nUsers)
|
||||
licenseJSON, jsonErr := json.Marshal(license)
|
||||
|
|
@ -369,7 +368,6 @@ func TestRequestTrialLicenseWithExtraFields(t *testing.T) {
|
|||
CheckErrorID(t, err, "api.license.upgrade_needed.app_error")
|
||||
CheckForbiddenStatus(t, resp)
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
func TestRequestTrialLicense(t *testing.T) {
|
||||
|
|
|
|||
|
|
@ -21,7 +21,6 @@ func TestNotifyAdmin(t *testing.T) {
|
|||
|
||||
require.Error(t, err)
|
||||
require.Equal(t, http.StatusBadRequest, statusCode)
|
||||
|
||||
})
|
||||
|
||||
t.Run("error when plan is unknown when notifying on upgrade", func(t *testing.T) {
|
||||
|
|
@ -36,7 +35,6 @@ func TestNotifyAdmin(t *testing.T) {
|
|||
require.Error(t, err)
|
||||
require.Equal(t, ": Unable to save notify data.", err.Error())
|
||||
require.Equal(t, http.StatusInternalServerError, statusCode)
|
||||
|
||||
})
|
||||
|
||||
t.Run("error when plan is unknown when notifying to trial", func(t *testing.T) {
|
||||
|
|
@ -52,7 +50,6 @@ func TestNotifyAdmin(t *testing.T) {
|
|||
require.Error(t, err)
|
||||
require.Equal(t, ": Unable to save notify data.", err.Error())
|
||||
require.Equal(t, http.StatusInternalServerError, statusCode)
|
||||
|
||||
})
|
||||
|
||||
t.Run("error when feature is unknown when notifying on upgrade", func(t *testing.T) {
|
||||
|
|
@ -132,7 +129,6 @@ func TestTriggerNotifyAdmin(t *testing.T) {
|
|||
require.Error(t, err)
|
||||
require.Equal(t, ": Internal error during cloud api request.", err.Error())
|
||||
require.Equal(t, http.StatusForbidden, statusCode)
|
||||
|
||||
})
|
||||
|
||||
t.Run("error when non admins try to trigger notifications", func(t *testing.T) {
|
||||
|
|
|
|||
|
|
@ -462,7 +462,6 @@ func TestDisableOnRemove(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestGetMarketplacePlugins(t *testing.T) {
|
||||
|
||||
th := Setup(t)
|
||||
defer th.TearDown()
|
||||
|
||||
|
|
@ -683,7 +682,6 @@ func TestGetMarketplacePlugins(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestGetInstalledMarketplacePlugins(t *testing.T) {
|
||||
|
||||
samplePlugins := []*model.MarketplacePlugin{
|
||||
{
|
||||
BaseMarketplacePlugin: &model.BaseMarketplacePlugin{
|
||||
|
|
@ -827,7 +825,6 @@ func TestGetInstalledMarketplacePlugins(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestSearchGetMarketplacePlugins(t *testing.T) {
|
||||
|
||||
samplePlugins := []*model.MarketplacePlugin{
|
||||
{
|
||||
BaseMarketplacePlugin: &model.BaseMarketplacePlugin{
|
||||
|
|
@ -953,7 +950,6 @@ func TestSearchGetMarketplacePlugins(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestGetLocalPluginInMarketplace(t *testing.T) {
|
||||
|
||||
th := Setup(t)
|
||||
defer th.TearDown()
|
||||
|
||||
|
|
@ -1115,7 +1111,6 @@ func TestGetLocalPluginInMarketplace(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestGetRemotePluginInMarketplace(t *testing.T) {
|
||||
|
||||
th := Setup(t)
|
||||
defer th.TearDown()
|
||||
|
||||
|
|
@ -1172,7 +1167,6 @@ func TestGetRemotePluginInMarketplace(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestGetPrepackagedPluginInMarketplace(t *testing.T) {
|
||||
|
||||
th := Setup(t)
|
||||
defer th.TearDown()
|
||||
|
||||
|
|
@ -1304,7 +1298,6 @@ func TestGetPrepackagedPluginInMarketplace(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestInstallMarketplacePlugin(t *testing.T) {
|
||||
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
|
|
@ -1655,7 +1648,6 @@ func TestInstallMarketplacePlugin(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestInstallMarketplacePluginPrepackagedDisabled(t *testing.T) {
|
||||
|
||||
path, _ := fileutils.FindDir("tests")
|
||||
|
||||
signatureFilename := "testplugin2.tar.gz.sig"
|
||||
|
|
|
|||
|
|
@ -1358,7 +1358,6 @@ func TestPatchPost(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("err with integrations-reserved props", func(t *testing.T) {
|
||||
|
||||
originalHardenedModeSetting := *th.App.Config().ServiceSettings.ExperimentalEnableHardenedMode
|
||||
th.App.UpdateConfig(func(cfg *model.Config) {
|
||||
*cfg.ServiceSettings.ExperimentalEnableHardenedMode = true
|
||||
|
|
|
|||
|
|
@ -192,7 +192,6 @@ func TestGetPreferenceByCategoryAndName(t *testing.T) {
|
|||
_, resp, err = client.GetPreferenceByCategoryAndName(context.Background(), user.Id, preferences[0].Category, preferences[0].Name)
|
||||
require.Error(t, err)
|
||||
CheckUnauthorizedStatus(t, resp)
|
||||
|
||||
}
|
||||
|
||||
func TestUpdatePreferences(t *testing.T) {
|
||||
|
|
|
|||
|
|
@ -574,7 +574,6 @@ func TestGetBulkReactions(t *testing.T) {
|
|||
assert.ElementsMatch(t, expectedPostIdsReactionsMap[post4.Id], postIdsReactionsMap[post4.Id])
|
||||
assert.ElementsMatch(t, expectedPostIdsReactionsMap[post5.Id], postIdsReactionsMap[post5.Id])
|
||||
assert.Equal(t, expectedPostIdsReactionsMap, postIdsReactionsMap)
|
||||
|
||||
})
|
||||
|
||||
t.Run("get-reactions-as-anonymous-user", func(t *testing.T) {
|
||||
|
|
|
|||
|
|
@ -273,7 +273,6 @@ func TestGraphQLChannels(t *testing.T) {
|
|||
assert.Equal(t, myTeam.DisplayName, ch.Team.DisplayName)
|
||||
}
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
t.Run("Delete+Update", func(t *testing.T) {
|
||||
|
|
@ -500,7 +499,6 @@ func TestGetPrettyDNForUsers(t *testing.T) {
|
|||
cache["user2"] = "teststring!!"
|
||||
assert.Equal(t, "teststring!!", getPrettyDNForUsers("full_name", users, "user1", cache))
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
func TestChannelCursor(t *testing.T) {
|
||||
|
|
|
|||
|
|
@ -184,7 +184,6 @@ func TestGetRolesByNames(t *testing.T) {
|
|||
_, _, err = client.GetRolesByNames(context.Background(), []string{model.NewId(), model.NewId(), "", " "})
|
||||
require.NoError(t, err)
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
func TestPatchRole(t *testing.T) {
|
||||
|
|
@ -208,7 +207,6 @@ func TestPatchRole(t *testing.T) {
|
|||
}
|
||||
|
||||
th.TestForSystemAdminAndLocal(t, func(t *testing.T, client *model.Client4) {
|
||||
|
||||
// Cannot edit a system admin
|
||||
adminRole, err := th.App.Srv().Store().Role().GetByName(context.Background(), "system_admin")
|
||||
assert.NoError(t, err)
|
||||
|
|
|
|||
|
|
@ -151,7 +151,6 @@ func TestGetRemoteClusterById(t *testing.T) {
|
|||
require.Error(t, err)
|
||||
CheckNotFoundStatus(t, resp)
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
func TestCreateDirectChannelWithRemoteUser(t *testing.T) {
|
||||
|
|
|
|||
|
|
@ -438,7 +438,6 @@ func TestPostLog(t *testing.T) {
|
|||
logMessage, _, err := th.SystemAdminClient.PostLog(context.Background(), message)
|
||||
require.NoError(t, err)
|
||||
require.NotEmpty(t, logMessage, "should return the log message")
|
||||
|
||||
}
|
||||
|
||||
func TestGetAnalyticsOld(t *testing.T) {
|
||||
|
|
@ -966,7 +965,6 @@ func TestCompleteOnboarding(t *testing.T) {
|
|||
case <-time.After(15 * time.Second):
|
||||
require.Fail(t, "timed out waiting testplugin2 to be installed and enabled ")
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
t.Run("as a system admin when plugins are disabled", func(t *testing.T) {
|
||||
|
|
|
|||
|
|
@ -1376,7 +1376,6 @@ func TestGetTeamByName(t *testing.T) {
|
|||
_, resp, err = client.GetTeamByName(context.Background(), "", "")
|
||||
require.Error(t, err)
|
||||
CheckNotFoundStatus(t, resp)
|
||||
|
||||
})
|
||||
|
||||
th.TestForSystemAdminAndLocal(t, func(t *testing.T, client *model.Client4) {
|
||||
|
|
@ -2427,7 +2426,6 @@ func TestAddTeamMemberMyself(t *testing.T) {
|
|||
}
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func TestAddTeamMembersDomainConstrained(t *testing.T) {
|
||||
|
|
@ -2732,7 +2730,6 @@ func TestRemoveTeamMemberEvents(t *testing.T) {
|
|||
assert.Equal(t, eventUserId, th.BasicUser2.Id)
|
||||
})
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
func TestGetTeamStats(t *testing.T) {
|
||||
|
|
|
|||
|
|
@ -53,7 +53,6 @@ func createUpload(c *Context, w http.ResponseWriter, r *http.Request) {
|
|||
c.Err = model.NewAppError("createUpload", "api.file.cloud_upload.app_error", nil, "", http.StatusBadRequest)
|
||||
return
|
||||
}
|
||||
|
||||
} else {
|
||||
if !c.App.SessionHasPermissionToChannel(c.AppContext, *c.AppContext.Session(), us.ChannelId, model.PermissionUploadFile) {
|
||||
c.SetPermissionError(model.PermissionUploadFile)
|
||||
|
|
|
|||
|
|
@ -161,7 +161,6 @@ func TestCreateUserInputFilter(t *testing.T) {
|
|||
defer th.TearDown()
|
||||
|
||||
t.Run("DomainRestriction", func(t *testing.T) {
|
||||
|
||||
enableAPIUserDeletion := th.App.Config().ServiceSettings.EnableAPIUserDeletion
|
||||
th.App.UpdateConfig(func(cfg *model.Config) {
|
||||
*cfg.TeamSettings.EnableOpenServer = true
|
||||
|
|
@ -354,7 +353,6 @@ func TestCreateUserWithToken(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("EnableUserCreationDisable", func(t *testing.T) {
|
||||
|
||||
enableUserCreation := th.App.Config().TeamSettings.EnableUserCreation
|
||||
defer func() {
|
||||
th.App.UpdateConfig(func(cfg *model.Config) { cfg.TeamSettings.EnableUserCreation = enableUserCreation })
|
||||
|
|
@ -375,7 +373,6 @@ func TestCreateUserWithToken(t *testing.T) {
|
|||
require.Error(t, err)
|
||||
CheckNotImplementedStatus(t, resp)
|
||||
CheckErrorID(t, err, "api.user.create_user.signup_email_disabled.app_error")
|
||||
|
||||
})
|
||||
th.TestForSystemAdminAndLocal(t, func(t *testing.T, client *model.Client4) {
|
||||
enableUserCreation := th.App.Config().TeamSettings.EnableUserCreation
|
||||
|
|
@ -3053,7 +3050,6 @@ func TestGetUsersInGroup(t *testing.T) {
|
|||
require.NoError(t, err)
|
||||
assert.Equal(t, len(users), 0)
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
func TestGetUsersInGroupByDisplayName(t *testing.T) {
|
||||
|
|
@ -3111,7 +3107,6 @@ func TestGetUsersInGroupByDisplayName(t *testing.T) {
|
|||
require.NoError(t, err)
|
||||
assert.Equal(t, users[0].Id, user1.Id)
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
func TestUpdateUserMfa(t *testing.T) {
|
||||
|
|
@ -3586,7 +3581,6 @@ func TestRevokeSessionsFromAllUsers(t *testing.T) {
|
|||
sessions, err = th.Server.Store().Session().GetSessions(admin.Id)
|
||||
require.Empty(t, sessions)
|
||||
require.NoError(t, err)
|
||||
|
||||
}
|
||||
|
||||
func TestAttachDeviceId(t *testing.T) {
|
||||
|
|
@ -3607,7 +3601,6 @@ func TestAttachDeviceId(t *testing.T) {
|
|||
|
||||
for _, tc := range testCases {
|
||||
t.Run(tc.Description, func(t *testing.T) {
|
||||
|
||||
th.App.UpdateConfig(func(cfg *model.Config) {
|
||||
*cfg.ServiceSettings.SiteURL = tc.SiteURL
|
||||
})
|
||||
|
|
@ -6630,7 +6623,6 @@ func TestThreadSocketEvents(t *testing.T) {
|
|||
require.EqualValues(t, float64(1), data["previous_unread_mentions"])
|
||||
require.EqualValues(t, float64(0), data["unread_replies"])
|
||||
require.EqualValues(t, float64(0), data["unread_mentions"])
|
||||
|
||||
}
|
||||
case <-time.After(1 * time.Second):
|
||||
return
|
||||
|
|
@ -6660,7 +6652,6 @@ func TestThreadSocketEvents(t *testing.T) {
|
|||
require.EqualValues(t, float64(0), data["previous_unread_mentions"])
|
||||
require.EqualValues(t, float64(1), data["unread_replies"])
|
||||
require.EqualValues(t, float64(1), data["unread_mentions"])
|
||||
|
||||
}
|
||||
case <-time.After(1 * time.Second):
|
||||
return
|
||||
|
|
@ -6852,7 +6843,6 @@ func TestFollowThreads(t *testing.T) {
|
|||
require.NoError(t, err)
|
||||
require.Len(t, uss.Threads, 1)
|
||||
require.GreaterOrEqual(t, uss.Threads[0].LastViewedAt, uss.Threads[0].LastReplyAt)
|
||||
|
||||
})
|
||||
|
||||
t.Run("No permission to channel", func(t *testing.T) {
|
||||
|
|
@ -6967,7 +6957,6 @@ func TestMaintainUnreadRepliesInThread(t *testing.T) {
|
|||
|
||||
// should have 2 unread replies now
|
||||
checkThreadListReplies(t, th, th.SystemAdminClient, th.SystemAdminUser.Id, 2, 1, &model.GetUserThreadsOpts{Unread: true})
|
||||
|
||||
}
|
||||
|
||||
func TestThreadCounts(t *testing.T) {
|
||||
|
|
@ -7167,7 +7156,6 @@ func TestReadThreads(t *testing.T) {
|
|||
})
|
||||
client := th.Client
|
||||
t.Run("all threads", func(t *testing.T) {
|
||||
|
||||
rpost, resp, err := client.CreatePost(context.Background(), &model.Post{ChannelId: th.BasicChannel.Id, Message: "testMsg"})
|
||||
require.NoError(t, err)
|
||||
CheckCreatedStatus(t, resp)
|
||||
|
|
|
|||
|
|
@ -143,7 +143,6 @@ func (s *Server) InvalidateAllCaches() *model.AppError {
|
|||
|
||||
func (s *Server) InvalidateAllCachesSkipSend() {
|
||||
s.platform.InvalidateAllCachesSkipSend()
|
||||
|
||||
}
|
||||
|
||||
func (a *App) RecycleDatabaseConnection(c request.CTX) {
|
||||
|
|
|
|||
|
|
@ -164,7 +164,6 @@ func (a *App) GetAnalytics(name string, teamID string) (model.AnalyticsRows, *mo
|
|||
rows[5].Value = float64(totalSockets)
|
||||
rows[6].Value = float64(totalMasterDb)
|
||||
rows[7].Value = float64(totalReadDb)
|
||||
|
||||
} else {
|
||||
rows[5].Value = float64(a.TotalWebsocketConnections())
|
||||
rows[6].Value = float64(a.Srv().Store().TotalMasterDbConnections())
|
||||
|
|
|
|||
|
|
@ -45,7 +45,6 @@ func (tl TokenLocation) String() string {
|
|||
}
|
||||
|
||||
func (a *App) IsPasswordValid(password string) *model.AppError {
|
||||
|
||||
if err := users.IsPasswordValidWithSettings(password, &a.Config().PasswordSettings); err != nil {
|
||||
var invErr *users.ErrInvalidPassword
|
||||
switch {
|
||||
|
|
|
|||
|
|
@ -212,7 +212,6 @@ func (a *App) SessionHasPermissionToGroup(session model.Session, groupID string,
|
|||
|
||||
func (a *App) SessionHasPermissionToChannelByPost(session model.Session, postID string, permission *model.Permission) bool {
|
||||
if channelMember, err := a.Srv().Store().Channel().GetMemberForPost(postID, session.UserId); err == nil {
|
||||
|
||||
if a.RolesGrantPermission(channelMember.GetRoles(), permission.Id) {
|
||||
return true
|
||||
}
|
||||
|
|
|
|||
|
|
@ -45,7 +45,6 @@ func TestCheckIfRolesGrantPermission(t *testing.T) {
|
|||
for _, testcase := range cases {
|
||||
require.Equal(t, th.App.RolesGrantPermission(testcase.roles, testcase.permissionId), testcase.shouldGrant)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func TestChannelRolesGrantPermission(t *testing.T) {
|
||||
|
|
|
|||
|
|
@ -49,7 +49,6 @@ func TestSetAutoResponderStatus(t *testing.T) {
|
|||
status, err = th.App.GetStatus(userUpdated2.Id)
|
||||
require.Nil(t, err)
|
||||
assert.Equal(t, model.StatusOnline, status.Status)
|
||||
|
||||
}
|
||||
|
||||
func TestDisableAutoResponder(t *testing.T) {
|
||||
|
|
|
|||
|
|
@ -3205,7 +3205,6 @@ func (a *App) MoveChannel(c request.CTX, team *model.Team, channel *model.Channe
|
|||
}
|
||||
|
||||
func (a *App) postChannelMoveMessage(c request.CTX, user *model.User, channel *model.Channel, previousTeam *model.Team) *model.AppError {
|
||||
|
||||
post := &model.Post{
|
||||
ChannelId: channel.Id,
|
||||
Message: fmt.Sprintf(i18n.T("api.team.move_channel.success"), previousTeam.Name),
|
||||
|
|
|
|||
|
|
@ -2341,7 +2341,6 @@ func TestMarkChannelAsUnreadFromPostCollapsedThreadsTurnedOff(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestMarkUnreadCRTOffUpdatesThreads(t *testing.T) {
|
||||
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
th.App.UpdateConfig(func(cfg *model.Config) {
|
||||
|
|
@ -2662,5 +2661,4 @@ func TestConvertGroupMessageToChannel(t *testing.T) {
|
|||
convertedChannel, appErr := th.App.ConvertGroupMessageToChannel(th.Context, "user_id_1", conversionRequest)
|
||||
require.Nil(t, appErr)
|
||||
require.Equal(t, model.ChannelTypePrivate, convertedChannel.Type)
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -287,7 +287,6 @@ func (ch *Channels) Start() error {
|
|||
ch.ShutDownPlugins()
|
||||
}
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
// TODO: This should be moved to the platform service.
|
||||
|
|
|
|||
|
|
@ -12,6 +12,5 @@ func (a *App) IsLeader() bool {
|
|||
}
|
||||
|
||||
func (a *App) GetClusterId() string {
|
||||
|
||||
return a.Srv().Platform().GetClusterId()
|
||||
}
|
||||
|
|
|
|||
|
|
@ -66,7 +66,6 @@ func (s *Server) clusterPluginEventHandler(msg *model.ClusterMessage) {
|
|||
// The cluster event handlers are spread across this function and NewLocalCacheLayer.
|
||||
// Be careful to not have duplicated handlers here and there.
|
||||
func (s *Server) registerClusterHandlers() {
|
||||
|
||||
s.platform.RegisterClusterMessageHandler(model.ClusterEventInstallPlugin, s.clusterInstallPluginHandler)
|
||||
s.platform.RegisterClusterMessageHandler(model.ClusterEventRemovePlugin, s.clusterRemovePluginHandler)
|
||||
s.platform.RegisterClusterMessageHandler(model.ClusterEventPluginEvent, s.clusterPluginEventHandler)
|
||||
|
|
|
|||
|
|
@ -198,7 +198,6 @@ func TestParseNamedArguments(t *testing.T) {
|
|||
assert.False(t, found)
|
||||
assert.Equal(t, "bla", parsed)
|
||||
assert.Equal(t, "", toBeParsed)
|
||||
|
||||
}
|
||||
|
||||
func TestSuggestions(t *testing.T) {
|
||||
|
|
|
|||
|
|
@ -163,7 +163,6 @@ func TestSendInviteEmails(t *testing.T) {
|
|||
false,
|
||||
)
|
||||
require.Error(t, err)
|
||||
|
||||
})
|
||||
|
||||
t.Run("SendGuestInviteEmails should sanitize HTML input", func(t *testing.T) {
|
||||
|
|
@ -356,7 +355,6 @@ func TestSendCloudWelcomeEmail(t *testing.T) {
|
|||
require.NoError(t, err, "Could not get message from mailbox")
|
||||
require.Contains(t, resultsEmail.Subject, "Congratulations!", "Wrong subject message %s", resultsEmail.Subject)
|
||||
require.Contains(t, resultsEmail.Body.Text, "Your workspace is ready to go!", "Wrong body %s", resultsEmail.Body.Text)
|
||||
|
||||
}
|
||||
mail.DeleteMailBox(emailTo)
|
||||
|
||||
|
|
|
|||
|
|
@ -540,7 +540,6 @@ func (a *App) BuildPostReactions(ctx request.CTX, postID string) (*[]ReactionImp
|
|||
}
|
||||
|
||||
return &reactionsOfPost, nil
|
||||
|
||||
}
|
||||
|
||||
func (a *App) buildPostAttachments(postID string) ([]imports.AttachmentImportData, *model.AppError) {
|
||||
|
|
|
|||
|
|
@ -95,7 +95,6 @@ func featureFlagsFromMap(featuresMap map[string]string, baseFeatureFlags model.F
|
|||
default:
|
||||
refField.Set(reflect.ValueOf(fieldValue))
|
||||
}
|
||||
|
||||
}
|
||||
return baseFeatureFlags
|
||||
}
|
||||
|
|
|
|||
|
|
@ -720,7 +720,6 @@ func (t *UploadFileTask) init(a *App) {
|
|||
// contained the last "good" FileInfo before the execution of that plugin.
|
||||
func (a *App) UploadFileX(c *request.Context, channelID, name string, input io.Reader,
|
||||
opts ...func(*UploadFileTask)) (*model.FileInfo, *model.AppError) {
|
||||
|
||||
t := &UploadFileTask{
|
||||
ChannelId: filepath.Base(channelID),
|
||||
Name: filepath.Base(name),
|
||||
|
|
|
|||
|
|
@ -89,7 +89,6 @@ func BenchmarkUploadFile(b *testing.B) {
|
|||
}
|
||||
th.App.Srv().Store().FileInfo().PermanentDelete(info1.Id)
|
||||
th.App.RemoveFile(info1.Path)
|
||||
|
||||
},
|
||||
},
|
||||
{
|
||||
|
|
|
|||
|
|
@ -647,7 +647,6 @@ func TestComputeLastAccessibleFileTime(t *testing.T) {
|
|||
|
||||
mockSystemStore.AssertNotCalled(t, "SaveOrUpdate", mock.Anything)
|
||||
mockSystemStore.AssertCalled(t, "PermanentDeleteByName", mock.Anything)
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -570,7 +570,6 @@ func (a *App) importUser(c request.CTX, data *imports.UserImportData, dryRun boo
|
|||
if err := a.Srv().Store().Preference().Save(model.Preferences{pref}); err != nil {
|
||||
c.Logger().Warn("Encountered error saving tutorial preference", mlog.Err(err))
|
||||
}
|
||||
|
||||
} else {
|
||||
var appErr *model.AppError
|
||||
if hasUserChanged {
|
||||
|
|
|
|||
|
|
@ -215,7 +215,6 @@ func TestImportImportScheme(t *testing.T) {
|
|||
assert.Equal(t, *data.DisplayName, scheme.DisplayName)
|
||||
assert.Equal(t, *data.Description, scheme.Description)
|
||||
assert.Equal(t, "team", scheme.Scope)
|
||||
|
||||
}
|
||||
|
||||
func TestImportImportSchemeWithoutGuestRoles(t *testing.T) {
|
||||
|
|
|
|||
|
|
@ -15,7 +15,6 @@ import (
|
|||
)
|
||||
|
||||
func ValidateSchemeImportData(data *SchemeImportData) *model.AppError {
|
||||
|
||||
if data.Scope == nil {
|
||||
return model.NewAppError("BulkImport", "app.import.validate_scheme_import_data.null_scope.error", nil, "", http.StatusBadRequest)
|
||||
}
|
||||
|
|
@ -85,7 +84,6 @@ func ValidateSchemeImportData(data *SchemeImportData) *model.AppError {
|
|||
}
|
||||
|
||||
func ValidateRoleImportData(data *RoleImportData) *model.AppError {
|
||||
|
||||
if data.Name == nil || !model.IsValidRoleName(*data.Name) {
|
||||
return model.NewAppError("BulkImport", "app.import.validate_role_import_data.name_invalid.error", nil, "", http.StatusBadRequest)
|
||||
}
|
||||
|
|
@ -118,7 +116,6 @@ func ValidateRoleImportData(data *RoleImportData) *model.AppError {
|
|||
}
|
||||
|
||||
func ValidateTeamImportData(data *TeamImportData) *model.AppError {
|
||||
|
||||
if data.Name == nil {
|
||||
return model.NewAppError("BulkImport", "app.import.validate_team_import_data.name_missing.error", nil, "", http.StatusBadRequest)
|
||||
} else if len(*data.Name) > model.TeamNameMaxLength {
|
||||
|
|
@ -153,7 +150,6 @@ func ValidateTeamImportData(data *TeamImportData) *model.AppError {
|
|||
}
|
||||
|
||||
func ValidateChannelImportData(data *ChannelImportData) *model.AppError {
|
||||
|
||||
if data.Team == nil {
|
||||
return model.NewAppError("BulkImport", "app.import.validate_channel_import_data.team_missing.error", nil, "", http.StatusBadRequest)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -257,7 +257,6 @@ func TestImportValidateRoleImportData(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestImportValidateTeamImportData(t *testing.T) {
|
||||
|
||||
// Test with minimum required valid properties.
|
||||
data := TeamImportData{
|
||||
Name: ptrStr("teamname"),
|
||||
|
|
@ -355,7 +354,6 @@ func TestImportValidateTeamImportData(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestImportValidateChannelImportData(t *testing.T) {
|
||||
|
||||
// Test with minimum required valid properties.
|
||||
chanTypeOpen := model.ChannelTypeOpen
|
||||
data := ChannelImportData{
|
||||
|
|
@ -469,7 +467,6 @@ func TestImportValidateChannelImportData(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestImportValidateUserImportData(t *testing.T) {
|
||||
|
||||
// Test with minimum required valid properties.
|
||||
data := UserImportData{
|
||||
Username: ptrStr("bob"),
|
||||
|
|
@ -671,11 +668,9 @@ func TestImportValidateUserAuth(t *testing.T) {
|
|||
require.NotNil(t, err, fmt.Sprintf("authService: %v, authData: %v", test.authService, test.authData))
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func TestImportValidateUserTeamsImportData(t *testing.T) {
|
||||
|
||||
// Invalid Name.
|
||||
data := []UserTeamImportData{
|
||||
{
|
||||
|
|
@ -721,7 +716,6 @@ func TestImportValidateUserTeamsImportData(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestImportValidateUserChannelsImportData(t *testing.T) {
|
||||
|
||||
// Invalid Name.
|
||||
data := []UserChannelImportData{
|
||||
{
|
||||
|
|
@ -1027,7 +1021,6 @@ func TestImportValidatePostImportData(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestImportValidateDirectChannelImportData(t *testing.T) {
|
||||
|
||||
// Test with valid number of members for direct message.
|
||||
data := DirectChannelImportData{
|
||||
Members: &[]string{
|
||||
|
|
|
|||
|
|
@ -45,7 +45,6 @@ func (a *App) DoPostAction(c *request.Context, postID, actionId, userID, selecte
|
|||
}
|
||||
|
||||
func (a *App) DoPostActionWithCookie(c *request.Context, postID, actionId, userID, selectedOption string, cookie *model.PostActionCookie) (string, *model.AppError) {
|
||||
|
||||
// PostAction may result in the original post being updated. For the
|
||||
// updated post, we need to unconditionally preserve the original
|
||||
// IsPinned and HasReaction attributes, and preserve its entire
|
||||
|
|
|
|||
|
|
@ -405,7 +405,6 @@ func TestPostAction(t *testing.T) {
|
|||
|
||||
_, err = th.App.DoPostAction(th.Context, postSubpath.Id, attachmentsSubpath[0].Actions[0].Id, th.BasicUser.Id, "")
|
||||
require.Nil(t, err)
|
||||
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
@ -744,7 +743,6 @@ func TestPostActionRelativeURL(t *testing.T) {
|
|||
|
||||
_, err = th.App.DoPostAction(th.Context, post.Id, attachments[0].Actions[0].Id, th.BasicUser.Id, "")
|
||||
require.NotNil(t, err)
|
||||
|
||||
})
|
||||
|
||||
t.Run("valid (but dirty) relative URL with SiteURL set", func(t *testing.T) {
|
||||
|
|
|
|||
|
|
@ -113,7 +113,6 @@ func extractMethodMetadata(method *ast.Field, src []byte) methodData {
|
|||
paramsToTrace[strings.TrimSpace(p)] = true
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
if e.Params != nil {
|
||||
|
|
|
|||
|
|
@ -19,7 +19,6 @@ import (
|
|||
// be re-added; otherwise, they will not be re-added.
|
||||
func (a *App) SyncLdap(c *request.Context, includeRemovedMembers bool) {
|
||||
a.Srv().Go(func() {
|
||||
|
||||
if license := a.Srv().License(); license != nil && *license.Features.LDAP {
|
||||
if !*a.Config().LdapSettings.EnableSync {
|
||||
c.Logger().Error("LdapSettings.EnableSync is set to false. Skipping LDAP sync.")
|
||||
|
|
|
|||
|
|
@ -257,7 +257,6 @@ func (a *App) AttachCloudSessionCookie(c *request.Context, w http.ResponseWriter
|
|||
if strings.Contains(domain, "localhost") {
|
||||
workspaceName = "localhost"
|
||||
} else {
|
||||
|
||||
// ensure we have a format for a cloud workspace url i.e. example.cloud.mattermost.com
|
||||
if len(strings.Split(domain, ".")) != 4 {
|
||||
return
|
||||
|
|
@ -278,7 +277,6 @@ func (a *App) AttachCloudSessionCookie(c *request.Context, w http.ResponseWriter
|
|||
}
|
||||
|
||||
http.SetCookie(w, cookie)
|
||||
|
||||
}
|
||||
|
||||
func (a *App) AttachSessionCookies(c *request.Context, w http.ResponseWriter, r *http.Request) {
|
||||
|
|
|
|||
|
|
@ -40,7 +40,6 @@ func TestCheckForClientSideCert(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestCWSLogin(t *testing.T) {
|
||||
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
license := model.NewTestLicense()
|
||||
|
|
|
|||
|
|
@ -467,7 +467,6 @@ func (s *Server) doPlaybooksRolesCreationMigration() {
|
|||
if err := s.Store().System().Save(&system); err != nil {
|
||||
mlog.Fatal("Failed to mark playbook roles creation migration as completed.", mlog.Err(err))
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// arbitrary choice, though if there is an longstanding installation with less than 10 messages,
|
||||
|
|
@ -599,7 +598,6 @@ func (s *Server) doCloudS3PathMigrations(c *request.Context) {
|
|||
mlog.Fatal("failed to start job for migrating s3 file paths", mlog.Err(appErr))
|
||||
return
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func (a *App) DoAppMigrations() {
|
||||
|
|
|
|||
|
|
@ -1189,7 +1189,6 @@ func getMentionsEnabledFields(post *model.Post) model.StringArray {
|
|||
|
||||
ret = append(ret, post.Message)
|
||||
for _, attachment := range post.Attachments() {
|
||||
|
||||
if attachment.Pretext != "" {
|
||||
ret = append(ret, attachment.Pretext)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -187,7 +187,6 @@ func (a *App) sendPushNotification(notification *PostNotification, user *model.U
|
|||
|
||||
func (a *App) getPushNotificationMessage(contentsConfig, postMessage string, explicitMention, channelWideMention,
|
||||
hasFiles bool, senderName string, channelType model.ChannelType, replyToThreadType string, userLocale i18n.TranslateFunc) string {
|
||||
|
||||
// If the post only has images then push an appropriate message
|
||||
if postMessage == "" && hasFiles {
|
||||
if channelType == model.ChannelTypeDirect {
|
||||
|
|
@ -582,7 +581,6 @@ func DoesStatusAllowPushNotification(userNotifyProps model.StringMap, status *mo
|
|||
|
||||
func (a *App) BuildPushNotificationMessage(c request.CTX, contentsConfig string, post *model.Post, user *model.User, channel *model.Channel, channelName string, senderName string,
|
||||
explicitMention bool, channelWideMention bool, replyToThreadType string) (*model.PushNotification, *model.AppError) {
|
||||
|
||||
var msg *model.PushNotification
|
||||
|
||||
notificationInterface := a.ch.Notification
|
||||
|
|
@ -669,7 +667,6 @@ func (a *App) buildIdLoadedPushNotificationMessage(c request.CTX, channel *model
|
|||
|
||||
func (a *App) buildFullPushNotificationMessage(c request.CTX, contentsConfig string, post *model.Post, user *model.User, channel *model.Channel, channelName string, senderName string,
|
||||
explicitMention bool, channelWideMention bool, replyToThreadType string) *model.PushNotification {
|
||||
|
||||
msg := &model.PushNotification{
|
||||
Category: model.CategoryCanReply,
|
||||
Version: model.PushMessageV2,
|
||||
|
|
|
|||
|
|
@ -1376,7 +1376,6 @@ func TestGetMentionKeywords(t *testing.T) {
|
|||
require.True(t, ok)
|
||||
require.Equal(t, user4.Id, ids[0], "should've returned mention key of First")
|
||||
dup_count := func(list []string) map[string]int {
|
||||
|
||||
duplicate_frequency := make(map[string]int)
|
||||
|
||||
for _, item := range list {
|
||||
|
|
@ -1779,7 +1778,6 @@ func TestAddMentionKeywordsForUser(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestGetMentionsEnabledFields(t *testing.T) {
|
||||
|
||||
attachmentWithTextAndPreText := model.SlackAttachment{
|
||||
Text: "@here with mentions",
|
||||
Pretext: "@Channel some comment for the channel",
|
||||
|
|
@ -2244,7 +2242,6 @@ func TestCheckForMentionUsers(t *testing.T) {
|
|||
},
|
||||
} {
|
||||
t.Run(name, func(t *testing.T) {
|
||||
|
||||
e := &ExplicitMentions{}
|
||||
e.checkForMention(tc.Word, tc.Keywords, nil)
|
||||
|
||||
|
|
@ -2550,7 +2547,6 @@ func TestUserAllowsEmail(t *testing.T) {
|
|||
|
||||
assert.False(t, th.App.userAllowsEmail(th.Context, user, channelMemberNotifcationProps, &model.Post{Type: model.PostTypeAutoResponder}))
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
func TestInsertGroupMentions(t *testing.T) {
|
||||
|
|
|
|||
|
|
@ -469,7 +469,6 @@ func TestAuthorizeOAuthUser(t *testing.T) {
|
|||
_, _, _, _, err := th.App.AuthorizeOAuthUser(th.Context, nil, nil, model.ServiceOpenid, "", "", "")
|
||||
require.NotNil(t, err)
|
||||
assert.Equal(t, "api.user.get_authorization_code.endpoint.app_error", err.Id)
|
||||
|
||||
})
|
||||
|
||||
t.Run("enabled and properly configured", func(t *testing.T) {
|
||||
|
|
|
|||
|
|
@ -103,14 +103,11 @@ func (a *App) ResetPermissionsSystem() *model.AppError {
|
|||
}
|
||||
|
||||
func (a *App) ExportPermissions(w io.Writer) error {
|
||||
|
||||
next := a.SchemesIterator("", permissionsExportBatchSize)
|
||||
var schemeBatch []*model.Scheme
|
||||
|
||||
for schemeBatch = next(); len(schemeBatch) > 0; schemeBatch = next() {
|
||||
|
||||
for _, scheme := range schemeBatch {
|
||||
|
||||
roleNames := []string{
|
||||
scheme.DefaultTeamAdminRole,
|
||||
scheme.DefaultTeamUserRole,
|
||||
|
|
@ -156,7 +153,6 @@ func (a *App) ExportPermissions(w io.Writer) error {
|
|||
return err
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
defaultRoleNames := []string{}
|
||||
|
|
|
|||
|
|
@ -89,7 +89,6 @@ func TestExportPermissions(t *testing.T) {
|
|||
t.Errorf("Expected %v but got %v.", expected, actual)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func TestImportPermissions(t *testing.T) {
|
||||
|
|
@ -106,7 +105,6 @@ func TestImportPermissions(t *testing.T) {
|
|||
var results []*model.Scheme
|
||||
var beforeCount int
|
||||
withMigrationMarkedComplete(th, func() {
|
||||
|
||||
var appErr *model.AppError
|
||||
results, appErr = th.App.GetSchemes(scope, 0, 100)
|
||||
if appErr != nil {
|
||||
|
|
@ -125,7 +123,6 @@ func TestImportPermissions(t *testing.T) {
|
|||
if appErr != nil {
|
||||
panic(appErr)
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
actual := len(results)
|
||||
|
|
@ -169,7 +166,6 @@ func TestImportPermissions(t *testing.T) {
|
|||
t.Errorf("Expected %v but got %v.", expected, actual)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func TestImportPermissions_idempotentScheme(t *testing.T) {
|
||||
|
|
@ -212,7 +208,6 @@ func TestImportPermissions_idempotentScheme(t *testing.T) {
|
|||
if expected != actual {
|
||||
t.Errorf("Expected count to be %v but got %v", expected, actual)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func TestImportPermissions_schemeDeletedOnRoleFailure(t *testing.T) {
|
||||
|
|
@ -254,7 +249,6 @@ func TestImportPermissions_schemeDeletedOnRoleFailure(t *testing.T) {
|
|||
if expected != actual {
|
||||
t.Errorf("Expected count to be %v but got %v", expected, actual)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func TestMigration(t *testing.T) {
|
||||
|
|
|
|||
|
|
@ -161,7 +161,6 @@ func (ps *PlatformService) InvalidateAllCaches() *model.AppError {
|
|||
ps.InvalidateAllCachesSkipSend()
|
||||
|
||||
if ps.clusterIFace != nil {
|
||||
|
||||
msg := &model.ClusterMessage{
|
||||
Event: model.ClusterEventInvalidateAllCaches,
|
||||
SendType: model.ClusterSendReliable,
|
||||
|
|
|
|||
|
|
@ -368,7 +368,6 @@ func (ps *PlatformService) IsFirstUserAccount() bool {
|
|||
}
|
||||
|
||||
return true
|
||||
|
||||
}
|
||||
|
||||
func (ps *PlatformService) MaxPostSize() int {
|
||||
|
|
@ -402,5 +401,4 @@ func (ps *PlatformService) GetSystemInstallDate() (int64, *model.AppError) {
|
|||
|
||||
func (ps *PlatformService) ClientConfig() map[string]string {
|
||||
return ps.clientConfig.Load().(map[string]string)
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -189,5 +189,4 @@ func TestIsFirstUserAccountThunderingHerd(t *testing.T) {
|
|||
wg.Wait()
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -371,7 +371,6 @@ func (ps *PlatformService) Start() error {
|
|||
ps.Go(func() {
|
||||
ps.Publish(message)
|
||||
})
|
||||
|
||||
})
|
||||
return nil
|
||||
}
|
||||
|
|
|
|||
|
|
@ -85,7 +85,6 @@ func (ps *PlatformService) GetStatusesByIds(userIDs []string) (map[string]any, *
|
|||
ps.AddStatusCacheSkipClusterSend(s)
|
||||
statusMap[s.UserId] = s.Status
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// For the case where the user does not have a row in the Status table and cache
|
||||
|
|
@ -134,7 +133,6 @@ func (ps *PlatformService) GetUserStatusesByIds(userIDs []string) ([]*model.Stat
|
|||
}
|
||||
|
||||
statusMap = append(statusMap, statuses...)
|
||||
|
||||
}
|
||||
|
||||
// For the case where the user does not have a row in the Status table and cache
|
||||
|
|
|
|||
|
|
@ -127,7 +127,6 @@ func setupMultiPluginAPITest(t *testing.T, pluginCodes []string, pluginManifests
|
|||
}
|
||||
|
||||
func setupPluginAPITest(t *testing.T, pluginCode string, pluginManifest string, pluginID string, app *App, c *request.Context) string {
|
||||
|
||||
asMain := pluginID != "test_db_driver"
|
||||
return setupMultiPluginAPITest(t,
|
||||
[]string{pluginCode}, []string{pluginManifest}, []string{pluginID},
|
||||
|
|
|
|||
|
|
@ -20,7 +20,6 @@ type BasicConfig struct {
|
|||
}
|
||||
|
||||
func IsEmpty(object any) bool {
|
||||
|
||||
// get nil case out of the way
|
||||
if object == nil {
|
||||
return true
|
||||
|
|
|
|||
|
|
@ -22,7 +22,6 @@ func (p *MyPlugin) OnConfigurationChange() error {
|
|||
}
|
||||
|
||||
func (p *MyPlugin) MessageWillBePosted(_ *plugin.Context, _ *model.Post) (*model.Post, string) {
|
||||
|
||||
channels, err := p.API.GetChannelsForTeamForUser(p.configuration.BasicTeamID, p.configuration.BasicUserID, false)
|
||||
if err != nil {
|
||||
return nil, err.Error()
|
||||
|
|
|
|||
|
|
@ -22,7 +22,6 @@ func (p *MyPlugin) OnConfigurationChange() error {
|
|||
}
|
||||
|
||||
func (p *MyPlugin) MessageWillBePosted(_ *plugin.Context, _ *model.Post) (*model.Post, string) {
|
||||
|
||||
// check existing user first
|
||||
data, err := p.API.GetProfileImage(p.configuration.BasicUserID)
|
||||
if err != nil {
|
||||
|
|
|
|||
|
|
@ -22,7 +22,6 @@ func (p *MyPlugin) OnConfigurationChange() error {
|
|||
}
|
||||
|
||||
func (p *MyPlugin) MessageWillBePosted(_ *plugin.Context, _ *model.Post) (*model.Post, string) {
|
||||
|
||||
channels, err := p.API.SearchChannels(p.configuration.BasicTeamID, p.configuration.BasicChannelName)
|
||||
if err != nil {
|
||||
return nil, err.Error()
|
||||
|
|
|
|||
|
|
@ -28,7 +28,6 @@ func (p *MyPlugin) OnConfigurationChange() error {
|
|||
}
|
||||
|
||||
func (p *MyPlugin) MessageWillBePosted(_ *plugin.Context, _ *model.Post) (*model.Post, string) {
|
||||
|
||||
// Create an 128 x 128 image
|
||||
img := image.NewRGBA(image.Rect(0, 0, 128, 128))
|
||||
// Draw a red dot at (2, 3)
|
||||
|
|
|
|||
|
|
@ -39,7 +39,6 @@ func (p *MyPlugin) MessageWillBePosted(_ *plugin.Context, _ *model.Post) (*model
|
|||
if s != status.Status {
|
||||
return nil, fmt.Sprintf("Invalid status returned: %v != %v", s, status.Status)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
status, err := p.API.UpdateUserStatus(uid, "notrealstatus")
|
||||
|
|
|
|||
|
|
@ -440,7 +440,6 @@ func TestPluginCommand(t *testing.T) {
|
|||
require.NotNil(t, err)
|
||||
require.Equal(t, 500, err.StatusCode)
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
// Test Product with the minimum code needed to handle
|
||||
|
|
@ -621,6 +620,5 @@ func TestProductCommands(t *testing.T) {
|
|||
require.Nil(t, err2)
|
||||
require.NotNil(t, resp)
|
||||
assert.Equal(t, "plugin slash command called", resp.Text)
|
||||
|
||||
})
|
||||
}
|
||||
|
|
|
|||
|
|
@ -393,7 +393,6 @@ func TestPrivateServePluginRequest(t *testing.T) {
|
|||
th.App.ch.servePluginRequest(recorder, request, handler)
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func TestHandlePluginRequest(t *testing.T) {
|
||||
|
|
@ -505,7 +504,6 @@ func TestPluginSync(t *testing.T) {
|
|||
cfg.FileSettings.AmazonS3Endpoint = model.NewString(s3Endpoint)
|
||||
cfg.FileSettings.AmazonS3Region = model.NewString("")
|
||||
cfg.FileSettings.AmazonS3SSL = model.NewBool(false)
|
||||
|
||||
},
|
||||
},
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1635,7 +1635,6 @@ func (a *App) SearchPostsForUser(c *request.Context, terms string, userID string
|
|||
}
|
||||
|
||||
func (a *App) GetFileInfosForPostWithMigration(postID string, includeDeleted bool) ([]*model.FileInfo, *model.AppError) {
|
||||
|
||||
pchan := make(chan store.StoreResult, 1)
|
||||
go func() {
|
||||
post, err := a.Srv().Store().Post().GetSingle(postID, includeDeleted)
|
||||
|
|
@ -2181,7 +2180,6 @@ func (a *App) CheckPostReminders() {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func (a *App) GetPostInfo(c request.CTX, postID string) (*model.PostInfo, *model.AppError) {
|
||||
|
|
|
|||
|
|
@ -646,7 +646,6 @@ func (a *App) getLinkMetadata(c request.CTX, requestURL string, timestamp int64,
|
|||
permalink = &model.Permalink{PreviewPost: model.NewPreviewPost(referencedPostWithMetadata, referencedTeam, referencedChannel)}
|
||||
}
|
||||
} else {
|
||||
|
||||
var request *http.Request
|
||||
// Make request for a web page or an image
|
||||
request, err = http.NewRequest("GET", requestURL, nil)
|
||||
|
|
|
|||
|
|
@ -350,7 +350,6 @@ func TestPreparePostForClient(t *testing.T) {
|
|||
assert.True(t, ok)
|
||||
assert.EqualValues(t, colonEmoji, s)
|
||||
})
|
||||
|
||||
})
|
||||
|
||||
t.Run("markdown image dimensions", func(t *testing.T) {
|
||||
|
|
@ -1971,7 +1970,6 @@ func TestGetLinkMetadata(t *testing.T) {
|
|||
params := r.URL.Query()
|
||||
|
||||
writeImage := func(height, width int) {
|
||||
|
||||
img := image.NewGray(image.Rect(0, 0, height, width))
|
||||
|
||||
var encoder png.Encoder
|
||||
|
|
|
|||
|
|
@ -1312,7 +1312,6 @@ func TestUpdatePost(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("sanitizes post metadata appropriately", func(t *testing.T) {
|
||||
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
|
|
|
|||
|
|
@ -123,7 +123,6 @@ func noticeMatchesConditions(config *model.Config, preferences store.PreferenceS
|
|||
if !cnd.Audience.Matches(isSystemAdmin, isTeamAdmin) {
|
||||
return false, nil
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// check user count condition against previously calculated total user count
|
||||
|
|
|
|||
|
|
@ -40,7 +40,6 @@ func parseContentLength(cl string) int64 {
|
|||
return -1
|
||||
}
|
||||
return n
|
||||
|
||||
}
|
||||
|
||||
func (rt *PluginResponseWriter) GenerateResponse() *http.Response {
|
||||
|
|
|
|||
|
|
@ -1035,7 +1035,6 @@ func (s *Server) Start() error {
|
|||
go func() {
|
||||
var err error
|
||||
if *s.platform.Config().ServiceSettings.ConnectionSecurity == model.ConnSecurityTLS {
|
||||
|
||||
tlsConfig := &tls.Config{
|
||||
PreferServerCipherSuites: true,
|
||||
CurvePreferences: []tls.CurveID{tls.CurveP521, tls.CurveP384, tls.CurveP256},
|
||||
|
|
@ -1467,7 +1466,6 @@ func (s *Server) doLicenseExpirationCheck() {
|
|||
// SendRemoveExpiredLicenseEmail formats an email and uses the email service to send the email to user with link pointing to CWS
|
||||
// to renew the user license
|
||||
func (s *Server) SendRemoveExpiredLicenseEmail(email, ctaText, ctaLink, locale, siteURL string) *model.AppError {
|
||||
|
||||
if err := s.EmailService.SendRemoveExpiredLicenseEmail(ctaText, ctaLink, email, locale, siteURL); err != nil {
|
||||
return model.NewAppError("SendRemoveExpiredLicenseEmail", "api.license.remove_expired_license.failed.error", nil, "", http.StatusInternalServerError).Wrap(err)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -101,7 +101,6 @@ func (a *App) GetSession(token string) (*model.Session, *model.AppError) {
|
|||
!session.IsOAuth && !session.IsMobileApp() &&
|
||||
session.Props[model.SessionPropType] != model.SessionTypeUserAccessToken &&
|
||||
!*a.Config().ServiceSettings.ExtendSessionLengthWithActivity {
|
||||
|
||||
timeout := int64(*a.Config().ServiceSettings.SessionIdleTimeoutInMinutes) * 1000 * 60
|
||||
if (model.GetMillis() - session.LastActivityAt) > timeout {
|
||||
// Revoking the session is an asynchronous task anyways since we are not checking
|
||||
|
|
@ -210,7 +209,6 @@ func (a *App) RevokeSessionById(sessionID string) *model.AppError {
|
|||
return model.NewAppError("RevokeSessionById", "app.session.get.app_error", nil, "", http.StatusBadRequest).Wrap(err)
|
||||
}
|
||||
return a.RevokeSession(session)
|
||||
|
||||
}
|
||||
|
||||
func (a *App) RevokeSession(session *model.Session) *model.AppError {
|
||||
|
|
@ -346,7 +344,6 @@ func (a *App) CreateUserAccessToken(token *model.UserAccessToken) (*model.UserAc
|
|||
}
|
||||
|
||||
return token, nil
|
||||
|
||||
}
|
||||
|
||||
func (a *App) createSessionForUserAccessToken(tokenString string) (*model.Session, *model.AppError) {
|
||||
|
|
@ -411,7 +408,6 @@ func (a *App) createSessionForUserAccessToken(tokenString string) (*model.Sessio
|
|||
a.ch.srv.platform.AddSessionToCache(session)
|
||||
|
||||
return session, nil
|
||||
|
||||
}
|
||||
|
||||
func (a *App) RevokeUserAccessToken(token *model.UserAccessToken) *model.AppError {
|
||||
|
|
@ -483,7 +479,6 @@ func (a *App) GetUserAccessTokensForUser(userID string, page, perPage int) ([]*m
|
|||
}
|
||||
|
||||
return tokens, nil
|
||||
|
||||
}
|
||||
|
||||
func (a *App) GetUserAccessToken(tokenID string, sanitize bool) (*model.UserAccessToken, *model.AppError) {
|
||||
|
|
|
|||
|
|
@ -325,7 +325,6 @@ func (*LoadTestProvider) UsersCommand(a *app.App, c request.CTX, args *model.Com
|
|||
if err != nil {
|
||||
return &model.CommandResponse{Text: "Failed to add users: " + err.Error(), ResponseType: model.CommandResponseTypeEphemeral}, err
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
team, err := a.Srv().Store().Team().Get(args.TeamId)
|
||||
|
|
@ -369,7 +368,6 @@ func (*LoadTestProvider) ChannelsCommand(a *app.App, c request.CTX, args *model.
|
|||
if err != nil {
|
||||
return &model.CommandResponse{Text: "Failed to add channels: " + err.Error(), ResponseType: model.CommandResponseTypeEphemeral}, err
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
team, err := a.Srv().Store().Team().Get(args.TeamId)
|
||||
|
|
@ -427,7 +425,6 @@ func (*LoadTestProvider) DMsCommand(a *app.App, c request.CTX, args *model.Comma
|
|||
if err != nil {
|
||||
return &model.CommandResponse{Text: "Failed to add DMs: " + err.Error(), ResponseType: model.CommandResponseTypeEphemeral}, err
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
time := int64(0)
|
||||
|
|
@ -465,7 +462,6 @@ func (*LoadTestProvider) ThreadedPostCommand(a *app.App, c request.CTX, args *mo
|
|||
if err != nil {
|
||||
return &model.CommandResponse{Text: "Failed to create post: " + err.Error(), ResponseType: model.CommandResponseTypeEphemeral}, err
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
time := int64(0)
|
||||
|
|
@ -520,7 +516,6 @@ func (*LoadTestProvider) PostsCommand(a *app.App, c request.CTX, args *model.Com
|
|||
if err != nil {
|
||||
return &model.CommandResponse{Text: "Failed to add posts: " + err.Error(), ResponseType: model.CommandResponseTypeEphemeral}, err
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
maxImages := 0
|
||||
|
|
@ -565,7 +560,6 @@ func (*LoadTestProvider) PostsCommand(a *app.App, c request.CTX, args *model.Com
|
|||
if err != nil {
|
||||
return &model.CommandResponse{Text: "Failed to add posts", ResponseType: model.CommandResponseTypeEphemeral}, err
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return &model.CommandResponse{Text: "Added posts", ResponseType: model.CommandResponseTypeEphemeral}, nil
|
||||
|
|
|
|||
|
|
@ -35,7 +35,6 @@ func (rp *RemoteProvider) GetTrigger() string {
|
|||
}
|
||||
|
||||
func (rp *RemoteProvider) GetCommand(a *app.App, T i18n.TranslateFunc) *model.Command {
|
||||
|
||||
remote := model.NewAutocompleteData(rp.GetTrigger(), "[action]", T("api.command_remote.remote_add_remove.help", map[string]any{"Actions": AvailableRemoteActions}))
|
||||
|
||||
create := model.NewAutocompleteData("create", "", T("api.command_remote.invite.help"))
|
||||
|
|
|
|||
|
|
@ -72,7 +72,6 @@ func (sp *ShareProvider) GetAutoCompleteListItems(c request.CTX, a *app.App, com
|
|||
case strings.Contains(parsed, " uninvite "):
|
||||
|
||||
return sp.getAutoCompleteUnInviteRemote(a, commandArgs, arg)
|
||||
|
||||
}
|
||||
return nil, errors.New("invalid action")
|
||||
}
|
||||
|
|
|
|||
|
|
@ -43,7 +43,6 @@ func TestCustomStatus(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestCustomStatusErrors(t *testing.T) {
|
||||
|
||||
fakeUserID := "foobar"
|
||||
mockErr := store.NewErrNotFound("User", fakeUserID)
|
||||
mockUser := &model.User{Id: fakeUserID}
|
||||
|
|
|
|||
|
|
@ -231,7 +231,6 @@ func (a *App) generateSupportPacketYaml(c *request.Context) (*model.FileData, er
|
|||
}
|
||||
|
||||
func (a *App) createPluginsFile(_ *request.Context) (*model.FileData, error) {
|
||||
|
||||
// Getting the plugins installed on the server, prettify it, and then add them to the file data array
|
||||
pluginsResponse, appErr := a.GetPlugins()
|
||||
if appErr != nil {
|
||||
|
|
@ -248,7 +247,6 @@ func (a *App) createPluginsFile(_ *request.Context) (*model.FileData, error) {
|
|||
Body: pluginsPrettyJSON,
|
||||
}
|
||||
return fileData, nil
|
||||
|
||||
}
|
||||
|
||||
func (a *App) getNotificationsLog(_ *request.Context) (*model.FileData, error) {
|
||||
|
|
|
|||
|
|
@ -83,7 +83,6 @@ func TestGenerateSupportPacketYaml(t *testing.T) {
|
|||
assert.Equal(t, "mock", packet.FileDriver)
|
||||
assert.Equal(t, "FAIL: all broken", packet.FileStatus)
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
func TestGenerateSupportPacket(t *testing.T) {
|
||||
|
|
|
|||
|
|
@ -220,7 +220,6 @@ func (a *App) UpdateTeam(team *model.Team) (*model.Team, *model.AppError) {
|
|||
|
||||
// RenameTeam is used to rename the team Name and the DisplayName fields
|
||||
func (a *App) RenameTeam(team *model.Team, newTeamName string, newDisplayName string) (*model.Team, *model.AppError) {
|
||||
|
||||
// check if name is occupied
|
||||
_, errnf := a.GetTeamByName(newTeamName)
|
||||
|
||||
|
|
@ -1574,7 +1573,6 @@ func (a *App) InviteGuestsToChannelsGracefully(teamID string, guestsInvite *mode
|
|||
} else {
|
||||
inviteListWithErrors[i].Error = model.NewAppError("InviteGuestsToChannelsGracefully", "api.team.invite_members.unable_to_send_email.app_error", nil, "", http.StatusInternalServerError)
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
case errors.Is(eErr, email.NoRateLimiterError):
|
||||
|
|
|
|||
|
|
@ -466,7 +466,6 @@ func TestAddUserToTeamByTeamId(t *testing.T) {
|
|||
require.NotNil(t, err, "Should not add restricted user")
|
||||
require.Equal(t, "JoinUserToTeam", err.Where, "Error should be JoinUserToTeam")
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
func TestAdjustTeamsFromProductLimits(t *testing.T) {
|
||||
|
|
@ -522,7 +521,6 @@ func TestAdjustTeamsFromProductLimits(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("Should not do anything if the amount of teams is equal to the limit", func(t *testing.T) {
|
||||
|
||||
expectedTeamsList, err := th.App.GetAllTeams()
|
||||
|
||||
var expectedActiveTeams []*model.Team
|
||||
|
|
@ -590,7 +588,6 @@ func TestAdjustTeamsFromProductLimits(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("Should only restore teams that were archived by cloud limits", func(t *testing.T) {
|
||||
|
||||
activeLimit := 1
|
||||
teamLimits := &model.TeamsLimits{Active: &activeLimit}
|
||||
|
||||
|
|
@ -622,7 +619,6 @@ func TestAdjustTeamsFromProductLimits(t *testing.T) {
|
|||
require.Equal(t, int64(0), teamsList[1].DeleteAt)
|
||||
require.Equal(t, int64(0), teamsList[2].DeleteAt)
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
func TestPermanentDeleteTeam(t *testing.T) {
|
||||
|
|
@ -1205,7 +1201,6 @@ func TestGetTeamMembers(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("Ensure Sorted By User ID when no TeamMemberGetOptions is passed", func(t *testing.T) {
|
||||
|
||||
// Sort them by UserID because the result of GetTeamMembers() is also sorted
|
||||
sort.Slice(users, func(i, j int) bool {
|
||||
return users[i].Id < users[j].Id
|
||||
|
|
|
|||
|
|
@ -46,7 +46,6 @@ func (a *App) getMarketplacePlugins() ([]string, error) {
|
|||
}
|
||||
|
||||
func (a *App) getTrueUpProfile() (*model.TrueUpReviewProfile, error) {
|
||||
|
||||
license := a.Channels().License()
|
||||
if license == nil {
|
||||
return nil, model.NewAppError("requestTrueUpReview", "api.license.true_up_review.license_required", nil, "Could not get the total active users count", http.StatusInternalServerError)
|
||||
|
|
@ -117,7 +116,6 @@ func (a *App) getTrueUpProfile() (*model.TrueUpReviewProfile, error) {
|
|||
}
|
||||
|
||||
return &reviewProfile, nil
|
||||
|
||||
}
|
||||
|
||||
func (a *App) GetTrueUpProfile() (map[string]any, error) {
|
||||
|
|
|
|||
|
|
@ -807,7 +807,6 @@ func (a *App) UpdateDefaultProfileImage(c request.CTX, user *model.User) *model.
|
|||
}
|
||||
|
||||
func (a *App) SetDefaultProfileImage(c request.CTX, user *model.User) *model.AppError {
|
||||
|
||||
if err := a.UpdateDefaultProfileImage(c, user); err != nil {
|
||||
c.Logger().Error("Failed to update default profile image for user", mlog.String("user_id", user.Id), mlog.Err(err))
|
||||
return err
|
||||
|
|
@ -1598,7 +1597,6 @@ func (a *App) UpdateUserRoles(c request.CTX, userID string, newRoles string, sen
|
|||
}
|
||||
|
||||
func (a *App) UpdateUserRolesWithUser(c request.CTX, user *model.User, newRoles string, sendWebSocketEvent bool) (*model.User, *model.AppError) {
|
||||
|
||||
if err := a.CheckRolesExist(strings.Fields(newRoles)); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
|
|
|||
|
|
@ -150,5 +150,4 @@ func getBrowserName(ua *uasurfer.UserAgent, userAgentString string) string {
|
|||
}
|
||||
|
||||
return browserNames[uasurfer.BrowserUnknown]
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -576,7 +576,6 @@ func TestUpdateUserEmail(t *testing.T) {
|
|||
botuser2, appErr := th.App.UpdateUser(th.Context, &botuser, false)
|
||||
assert.Nil(t, appErr)
|
||||
assert.Equal(t, botuser2.Email, newBotEmail)
|
||||
|
||||
})
|
||||
|
||||
t.Run("RequireVerificationAlreadyUsedEmail", func(t *testing.T) {
|
||||
|
|
@ -1171,7 +1170,6 @@ func TestPasswordRecovery(t *testing.T) {
|
|||
err = th.App.resetPasswordFromToken(th.Context, token.Token, "abcdefgh", model.GetMillisForTime(time.Now().Add(25*time.Hour)))
|
||||
assert.NotNil(t, err)
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
func TestInvalidatePasswordRecoveryTokens(t *testing.T) {
|
||||
|
|
@ -1742,7 +1740,6 @@ func TestPatchUser(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestUpdateThreadReadForUser(t *testing.T) {
|
||||
|
||||
t.Run("Ensure thread membership is created and followed", func(t *testing.T) {
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
|
|
|||
|
|
@ -39,7 +39,6 @@ func ComparePassword(hash string, password string) error {
|
|||
}
|
||||
|
||||
func (us *UserService) isPasswordValid(password string) error {
|
||||
|
||||
return IsPasswordValidWithSettings(password, &us.config().PasswordSettings)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -186,5 +186,4 @@ func TestWebConnShouldSendEvent(t *testing.T) {
|
|||
|
||||
event3 := model.NewWebSocketEvent(model.WebsocketEventUpdateTeam, "wrongId", "", "", nil, "")
|
||||
assert.False(t, basicUserWc.ShouldSendEvent(event3))
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -813,7 +813,6 @@ func (a *App) CreateCommandWebhook(commandID string, args *model.CommandArgs) (*
|
|||
default:
|
||||
return nil, model.NewAppError("CreateCommandWebhook", "app.command_webhook.create_command_webhook.internal_error", nil, "", http.StatusInternalServerError).Wrap(err)
|
||||
}
|
||||
|
||||
}
|
||||
return savedHook, nil
|
||||
}
|
||||
|
|
|
|||
|
|
@ -584,11 +584,9 @@ func TestCreateOutGoingWebhookWithUsernameAndIconURL(t *testing.T) {
|
|||
assert.Equal(t, createdHook.IconURL, outgoingWebhook.IconURL)
|
||||
assert.Equal(t, createdHook.DisplayName, outgoingWebhook.DisplayName)
|
||||
assert.Equal(t, createdHook.Description, outgoingWebhook.Description)
|
||||
|
||||
}
|
||||
|
||||
func TestTriggerOutGoingWebhookWithUsernameAndIconURL(t *testing.T) {
|
||||
|
||||
getPayload := func(hook *model.OutgoingWebhook, th *TestHelper, channel *model.Channel) *model.OutgoingWebhookPayload {
|
||||
return &model.OutgoingWebhookPayload{
|
||||
Token: hook.Token,
|
||||
|
|
@ -647,7 +645,6 @@ func TestTriggerOutGoingWebhookWithUsernameAndIconURL(t *testing.T) {
|
|||
}
|
||||
|
||||
getTestCases := func() map[string]TestCaseOutgoing {
|
||||
|
||||
webHookResponse := "sample response text from test server"
|
||||
testCasesOutgoing := map[string]TestCaseOutgoing{
|
||||
|
||||
|
|
@ -682,7 +679,6 @@ func TestTriggerOutGoingWebhookWithUsernameAndIconURL(t *testing.T) {
|
|||
|
||||
for name, testCase := range getTestCases() {
|
||||
t.Run(name, func(t *testing.T) {
|
||||
|
||||
th.App.UpdateConfig(func(cfg *model.Config) {
|
||||
*cfg.ServiceSettings.EnableOutgoingWebhooks = true
|
||||
*cfg.ServiceSettings.EnablePostUsernameOverride = testCase.EnablePostUsernameOverride
|
||||
|
|
@ -726,10 +722,8 @@ func TestTriggerOutGoingWebhookWithUsernameAndIconURL(t *testing.T) {
|
|||
case <-time.After(5 * time.Second):
|
||||
require.Fail(t, "Timeout, webhook response not created as post")
|
||||
}
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
type InfiniteReader struct {
|
||||
|
|
|
|||
|
|
@ -38,7 +38,6 @@ func TestAudit_LogRecord(t *testing.T) {
|
|||
{
|
||||
"update user record, no error",
|
||||
func(audit Audit) {
|
||||
|
||||
usr := &model.User{}
|
||||
usr.Id = userId
|
||||
usr.Username = "TestABC"
|
||||
|
|
|
|||
|
|
@ -21,5 +21,4 @@ func MakeInstallPluginScheduler(jobServer *jobs.JobServer, license *model.Licens
|
|||
return enabled
|
||||
}
|
||||
return jobs.NewPeriodicScheduler(jobServer, jobType, installPluginSchedFreq, isEnabled)
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,5 +21,4 @@ func MakeScheduler(jobServer *jobs.JobServer, license *model.License, jobType st
|
|||
return enabled
|
||||
}
|
||||
return jobs.NewPeriodicScheduler(jobServer, jobType, schedFreq, isEnabled)
|
||||
|
||||
}
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue