Skip to content

Commit 1a4e07e

Browse files
committed
clean up some lint violations
1 parent 9b95097 commit 1a4e07e

File tree

3 files changed

+21
-12
lines changed

3 files changed

+21
-12
lines changed

server/job.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ func (p *Plugin) runSync(ctx context.Context, trigger string) error {
3333
API: p.API,
3434
}
3535
ftr := p.API.GetLicense().Features
36-
if ftr == nil || ftr.LDAPGroups == nil || *ftr.LDAPGroups == false {
36+
if ftr == nil || ftr.LDAPGroups == nil || !*ftr.LDAPGroups {
3737
l.Warning("Force-enabling custom-groups syncing: installed license does not have LDAP groups support!")
3838
cfg.SyncAsCustomGroups = true
3939
}

server/syncengine/mattermost_restgroup.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@ type mattermostRESTAPI interface {
4040

4141
// GetGroupMembers(ctx context.Context, groupID string) (*model.GroupMemberList, *model.Response, error) // This API is useless because it doesn't paginate. WTF?
4242
DoAPIGet(ctx context.Context, url string, etag string) (*http.Response, error)
43-
UpsertGroupMembers(ctx context.Context, groupID string, userIds *model.GroupModifyMembers) ([]*model.GroupMember, *model.Response, error)
44-
DeleteGroupMembers(ctx context.Context, groupID string, userIds *model.GroupModifyMembers) ([]*model.GroupMember, *model.Response, error)
43+
UpsertGroupMembers(ctx context.Context, groupID string, userIDs *model.GroupModifyMembers) ([]*model.GroupMember, *model.Response, error)
44+
DeleteGroupMembers(ctx context.Context, groupID string, userIDs *model.GroupModifyMembers) ([]*model.GroupMember, *model.Response, error)
4545
}
4646

4747
var _ mattermostRESTAPI = ((*model.Client4)(nil))

server/syncengine/mattermostservice_test.go

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,15 @@ func (f *fakeMattermostPluginAPI) CreateSession(session *model.Session) (*model.
247247

248248
var _ mattermostPluginAPI = (*fakeMattermostPluginAPI)(nil)
249249

250+
func makeService(p *fakeMattermostPluginAPI) *MattermostService {
251+
return &MattermostService{
252+
MattermostGroupBackend: &MattermostPluginGroupBackend{
253+
API: p,
254+
},
255+
API: p,
256+
}
257+
}
258+
250259
func TestMattermostFetchUsers(t *testing.T) {
251260
p := &fakeMattermostPluginAPI{
252261
Users: []*model.User{{
@@ -276,7 +285,7 @@ func TestMattermostFetchUsers(t *testing.T) {
276285
AuthService: "password",
277286
}},
278287
}
279-
m := &MattermostService{&MattermostPluginGroupBackend{p}, p}
288+
m := makeService(p)
280289

281290
want := []*User[string]{{
282291
UserID: "id::user::testuser",
@@ -319,7 +328,7 @@ func TestMattermostCreateUsersThatAreUnassociated(t *testing.T) {
319328
AuthService: "email",
320329
}},
321330
}
322-
m := &MattermostService{&MattermostPluginGroupBackend{p}, p}
331+
m := makeService(p)
323332

324333
got, err := m.CreateUsers(context.Background(), []*User[int]{{
325334
UserID: 1000,
@@ -391,7 +400,7 @@ func TestMattermostFetchGroups(t *testing.T) {
391400
UserId: "id::user::testuser",
392401
}},
393402
}
394-
m := &MattermostService{&MattermostPluginGroupBackend{p}, p}
403+
m := makeService(p)
395404

396405
want := []*Group[string]{{
397406
GroupID: "id::group::testgroup",
@@ -417,7 +426,7 @@ func TestMattermostFetchGroups(t *testing.T) {
417426

418427
func TestMattermostCreateUsers(t *testing.T) {
419428
p := &fakeMattermostPluginAPI{}
420-
m := &MattermostService{&MattermostPluginGroupBackend{p}, p}
429+
m := makeService(p)
421430

422431
got, err := m.CreateUsers(context.Background(), []*User[int]{{
423432
UserID: 1000,
@@ -491,7 +500,7 @@ func TestMattermostCreateUsers(t *testing.T) {
491500

492501
func TestMattermostCreateGroups(t *testing.T) {
493502
p := &fakeMattermostPluginAPI{}
494-
m := &MattermostService{&MattermostPluginGroupBackend{p}, p}
503+
m := makeService(p)
495504

496505
got, err := m.CreateGroups(context.Background(), []*Group[int]{{
497506
GroupID: 1000,
@@ -588,7 +597,7 @@ func TestMattermostUpdateUsers(t *testing.T) {
588597
DisableWelcomeEmail: true,
589598
}},
590599
}
591-
m := &MattermostService{&MattermostPluginGroupBackend{p}, p}
600+
m := makeService(p)
592601

593602
got, updated, err := m.UpdateUsers(context.Background(), []*User[string]{{
594603
UserID: "id::user::testuser",
@@ -739,7 +748,7 @@ func TestMattermostDeleteGroups(t *testing.T) {
739748
Source: MMPluginSource,
740749
}},
741750
}
742-
m := &MattermostService{&MattermostPluginGroupBackend{p}, p}
751+
m := makeService(p)
743752

744753
err := m.DeleteGroups(context.Background(), []*Group[string]{{
745754
GroupID: "id::group::testgroup",
@@ -780,7 +789,7 @@ func TestMattermostAddGroupMembers(t *testing.T) {
780789
Source: MMPluginSource,
781790
}},
782791
}
783-
m := &MattermostService{&MattermostPluginGroupBackend{p}, p}
792+
m := makeService(p)
784793

785794
err := m.AddGroupMembers(context.Background(), "id::group::testgroup", []string{"id::user::testuser"})
786795
if err != nil {
@@ -821,7 +830,7 @@ func TestMattermostRemoveGroupMembers(t *testing.T) {
821830
GroupId: "id::group::testgroup",
822831
}},
823832
}
824-
m := &MattermostService{&MattermostPluginGroupBackend{p}, p}
833+
m := makeService(p)
825834

826835
err := m.RemoveGroupMembers(context.Background(), "id::group::testgroup", []string{"id::user::testuser"})
827836
if err != nil {

0 commit comments

Comments
 (0)