mirror of
https://github.com/mattermost/mattermost.git
synced 2025-02-25 18:55:24 -06:00
PLT-4457 Added API to get multiple users by their usernames (#6218)
* Allow getting profiles by username without a team * Changed UserStore.GetProfilesByUsernames to return an array * PLT-4457 Added API to get multiple users by their usernames * Changed users/names route to users/usernames
This commit is contained in:
committed by
Corey Hulen
parent
cb668b9283
commit
db68e598a1
@@ -95,7 +95,7 @@ func SendNotifications(post *model.Post, team *model.Team, channel *model.Channe
|
||||
|
||||
if len(potentialOtherMentions) > 0 {
|
||||
if result := <-Srv.Store.User().GetProfilesByUsernames(potentialOtherMentions, team.Id); result.Err == nil {
|
||||
outOfChannelMentions := result.Data.(map[string]*model.User)
|
||||
outOfChannelMentions := result.Data.([]*model.User)
|
||||
go sendOutOfChannelMentions(sender, post, team.Id, outOfChannelMentions)
|
||||
}
|
||||
}
|
||||
@@ -592,13 +592,13 @@ func getMobileAppSessions(userId string) ([]*model.Session, *model.AppError) {
|
||||
}
|
||||
}
|
||||
|
||||
func sendOutOfChannelMentions(sender *model.User, post *model.Post, teamId string, profiles map[string]*model.User) *model.AppError {
|
||||
if len(profiles) == 0 {
|
||||
func sendOutOfChannelMentions(sender *model.User, post *model.Post, teamId string, users []*model.User) *model.AppError {
|
||||
if len(users) == 0 {
|
||||
return nil
|
||||
}
|
||||
|
||||
var usernames []string
|
||||
for _, user := range profiles {
|
||||
for _, user := range users {
|
||||
usernames = append(usernames, user.Username)
|
||||
}
|
||||
sort.Strings(usernames)
|
||||
|
||||
Reference in New Issue
Block a user