MM-17383: Update query to include users who are not members of any gr… (#11730)
* MM-17383: Update query to include users who are not members of any groups. * MM-17383: Fixes govet complaint. * MM-17383: Sorts by username. * MM-17383: Removes accidental staging.
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
f44473e062
Коммит
ddc48c3ac1
10
app/group.go
10
app/group.go
@@ -4,8 +4,6 @@
|
||||
package app
|
||||
|
||||
import (
|
||||
"strings"
|
||||
|
||||
"github.com/mattermost/mattermost-server/model"
|
||||
)
|
||||
|
||||
@@ -140,7 +138,7 @@ func (a *App) TeamMembersMinusGroupMembers(teamID string, groupIDs []string, pag
|
||||
// parse all group ids of all users
|
||||
allUsersGroupIDMap := map[string]bool{}
|
||||
for _, user := range users {
|
||||
for _, groupID := range strings.Split(user.GroupIDs, ",") {
|
||||
for _, groupID := range user.GetGroupIDs() {
|
||||
allUsersGroupIDMap[groupID] = true
|
||||
}
|
||||
}
|
||||
@@ -166,7 +164,7 @@ func (a *App) TeamMembersMinusGroupMembers(teamID string, groupIDs []string, pag
|
||||
// populate each instance's groups field
|
||||
for _, user := range users {
|
||||
user.Groups = []*model.Group{}
|
||||
for _, groupID := range strings.Split(user.GroupIDs, ",") {
|
||||
for _, groupID := range user.GetGroupIDs() {
|
||||
group, ok := groupMap[groupID]
|
||||
if ok {
|
||||
user.Groups = append(user.Groups, group)
|
||||
@@ -199,7 +197,7 @@ func (a *App) ChannelMembersMinusGroupMembers(channelID string, groupIDs []strin
|
||||
// parse all group ids of all users
|
||||
allUsersGroupIDMap := map[string]bool{}
|
||||
for _, user := range users {
|
||||
for _, groupID := range strings.Split(user.GroupIDs, ",") {
|
||||
for _, groupID := range user.GetGroupIDs() {
|
||||
allUsersGroupIDMap[groupID] = true
|
||||
}
|
||||
}
|
||||
@@ -225,7 +223,7 @@ func (a *App) ChannelMembersMinusGroupMembers(channelID string, groupIDs []strin
|
||||
// populate each instance's groups field
|
||||
for _, user := range users {
|
||||
user.Groups = []*model.Group{}
|
||||
for _, groupID := range strings.Split(user.GroupIDs, ",") {
|
||||
for _, groupID := range user.GetGroupIDs() {
|
||||
group, ok := groupMap[groupID]
|
||||
if ok {
|
||||
user.Groups = append(user.Groups, group)
|
||||
|
||||
Ссылка в новой задаче
Block a user