diff --git a/go.mod b/go.mod index 08f008ee3..499345a25 100644 --- a/go.mod +++ b/go.mod @@ -3,7 +3,7 @@ module github.com/mgdelacroix/mmctl go 1.12 require ( - github.com/mattermost/mattermost-server v0.0.0-20190416171630-13fba10eb824 + github.com/mattermost/mattermost-server v0.0.0-20190417144445-84a59ddb3928 github.com/pkg/errors v0.8.1 github.com/spf13/cobra v0.0.3 golang.org/x/crypto v0.0.0-20190325154230-a5d413f7728c diff --git a/go.sum b/go.sum index 0a0eb7b2b..5a55b4c1f 100644 --- a/go.sum +++ b/go.sum @@ -155,12 +155,15 @@ github.com/marstr/guid v0.0.0-20170427235115-8bdf7d1a087c/go.mod h1:74gB1z2wpxxI github.com/mattermost/gorp v2.0.1-0.20190301154413-3b31e9a39d05+incompatible/go.mod h1:0kX1qa3DOpaPJyOdMLeo7TcBN0QmUszj9a/VygOhDe0= github.com/mattermost/mattermost-server v0.0.0-20190416171630-13fba10eb824 h1:sQphcyZMnTJM/bVD5NQgjx0clel8MVL3kiGq9XmyklE= github.com/mattermost/mattermost-server v0.0.0-20190416171630-13fba10eb824/go.mod h1:/ZSPDRN6dUv1vWWTl8Vi05VwOIxPfGqIcDo01ytBiIQ= +github.com/mattermost/mattermost-server v0.0.0-20190417144445-84a59ddb3928 h1:OoQ4ONxc0V1dsZ+zW4+bMC5/6O+l8B1sjUEKPdaOXQI= +github.com/mattermost/mattermost-server v0.0.0-20190417144445-84a59ddb3928/go.mod h1:/ZSPDRN6dUv1vWWTl8Vi05VwOIxPfGqIcDo01ytBiIQ= github.com/mattermost/mattermost-server v5.3.1+incompatible h1:R/ld+VjFz7u7SgAFiJbvh2HFUaMaJtyCM/jXDe/wXTI= github.com/mattermost/mattermost-server v5.3.1+incompatible/go.mod h1:5L6MjAec+XXQwMIt791Ganu45GKsSiM+I0tLR9wUj8Y= github.com/mattermost/mattermost-server v5.9.0+incompatible h1:bUlZKAhjp7cGQRepmmsv225vbXyZaXOuVstqgpB+cE4= github.com/mattermost/mattermost-server v5.9.0+incompatible/go.mod h1:5L6MjAec+XXQwMIt791Ganu45GKsSiM+I0tLR9wUj8Y= github.com/mattermost/mattermost-server v5.10.0-rc6+incompatible h1:ylEbLN0V8VyuVjY0a2N9JDkevF7qYYOLdoBzvuo89sU= github.com/mattermost/mattermost-server v5.10.0-rc6+incompatible/go.mod h1:5L6MjAec+XXQwMIt791Ganu45GKsSiM+I0tLR9wUj8Y= +github.com/mattermost/mattermost-server v5.10.0+incompatible h1:egegOxu77bvu1N5VVUwLylJAqWqs6nriFPM2QrdSbLs= github.com/mattermost/rsc v0.0.0-20160330161541-bbaefb05eaa0/go.mod h1:nV5bfVpT//+B1RPD2JvRnxbkLmJEYXmRaaVl15fsXjs= github.com/mattermost/viper v1.0.4/go.mod h1:uc5hKG9lv4/KRwPOt2c1omOyirS/UnuA2TytiZQSFHM= github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= diff --git a/vendor/github.com/mattermost/mattermost-server/model/user.go b/vendor/github.com/mattermost/mattermost-server/model/user.go index d8948eadb..7c1cd146e 100644 --- a/vendor/github.com/mattermost/mattermost-server/model/user.go +++ b/vendor/github.com/mattermost/mattermost-server/model/user.go @@ -9,6 +9,7 @@ import ( "io" "net/http" "regexp" + "sort" "strings" "unicode/utf8" @@ -117,6 +118,53 @@ type UserForIndexing struct { ChannelsIds []string `json:"channel_id"` } +type UserSlice []*User + +func (u UserSlice) Usernames() []string { + usernames := []string{} + for _, user := range u { + usernames = append(usernames, user.Username) + } + sort.Strings(usernames) + return usernames +} + +func (u UserSlice) IDs() []string { + ids := []string{} + for _, user := range u { + ids = append(ids, user.Id) + } + return ids +} + +func (u UserSlice) FilterByID(ids []string) UserSlice { + var matches []*User + for _, user := range u { + for _, id := range ids { + if id == user.Id { + matches = append(matches, user) + } + } + } + return UserSlice(matches) +} + +func (u UserSlice) FilterWithoutID(ids []string) UserSlice { + var keep []*User + for _, user := range u { + present := false + for _, id := range ids { + if id == user.Id { + present = true + } + } + if !present { + keep = append(keep, user) + } + } + return UserSlice(keep) +} + func (u *User) DeepCopy() *User { copyUser := *u if u.AuthData != nil { diff --git a/vendor/modules.txt b/vendor/modules.txt index e739dcbd8..19e1050eb 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -12,7 +12,7 @@ github.com/gorilla/websocket github.com/inconshreveable/mousetrap # github.com/konsorten/go-windows-terminal-sequences v1.0.2 github.com/konsorten/go-windows-terminal-sequences -# github.com/mattermost/mattermost-server v0.0.0-20190416171630-13fba10eb824 +# github.com/mattermost/mattermost-server v0.0.0-20190417144445-84a59ddb3928 github.com/mattermost/mattermost-server/mlog/human github.com/mattermost/mattermost-server/model github.com/mattermost/mattermost-server/mlog