Merge branch 'master' into post-metadata

Этот коммит содержится в:
Harrison Healey
2018-11-14 09:58:56 -05:00
родитель fab63f8ba2 e0569e766a
Коммит d07def5169
152 изменённых файлов: 4303 добавлений и 801 удалений

Просмотреть файл

@@ -78,13 +78,13 @@ func (a *App) SendNotifications(post *model.Post, team *model.Team, channel *mod
}
if post.Type != model.POST_AUTO_RESPONDER {
a.Go(func() {
a.Srv.Go(func() {
a.SendAutoResponse(channel, otherUser)
})
}
} else {
keywords := a.GetMentionKeywordsInChannel(profileMap, post.Type != model.POST_HEADER_CHANGE && post.Type != model.POST_PURPOSE_CHANGE)
keywords := a.GetMentionKeywordsInChannel(profileMap, post.Type != model.POST_HEADER_CHANGE && post.Type != model.POST_PURPOSE_CHANGE, channelMemberNotifyPropsMap)
m := GetExplicitMentions(post, keywords)
@@ -127,7 +127,7 @@ func (a *App) SendNotifications(post *model.Post, team *model.Team, channel *mod
if result := <-a.Srv.Store.User().GetProfilesByUsernames(m.OtherPotentialMentions, team.Id); result.Err == nil {
outOfChannelMentions := result.Data.([]*model.User)
if channel.Type != model.CHANNEL_GROUP {
a.Go(func() {
a.Srv.Go(func() {
a.sendOutOfChannelMentions(sender, post, outOfChannelMentions)
})
}
@@ -560,7 +560,7 @@ func GetMentionsEnabledFields(post *model.Post) model.StringArray {
// Given a map of user IDs to profiles, returns a list of mention
// keywords for all users in the channel.
func (a *App) GetMentionKeywordsInChannel(profiles map[string]*model.User, lookForSpecialMentions bool) map[string][]string {
func (a *App) GetMentionKeywordsInChannel(profiles map[string]*model.User, lookForSpecialMentions bool, channelMemberNotifyPropsMap map[string]model.StringMap) map[string][]string {
keywords := make(map[string][]string)
for id, profile := range profiles {
@@ -582,9 +582,16 @@ func (a *App) GetMentionKeywordsInChannel(profiles map[string]*model.User, lookF
keywords[profile.FirstName] = append(keywords[profile.FirstName], profile.Id)
}
ignoreChannelMentions := false
if ignoreChannelMentionsNotifyProp, ok := channelMemberNotifyPropsMap[profile.Id][model.IGNORE_CHANNEL_MENTIONS_NOTIFY_PROP]; ok {
if ignoreChannelMentionsNotifyProp == model.IGNORE_CHANNEL_MENTIONS_ON {
ignoreChannelMentions = true
}
}
// Add @channel and @all to keywords if user has them turned on
if lookForSpecialMentions {
if int64(len(profiles)) <= *a.Config().TeamSettings.MaxNotificationsPerChannel && profile.NotifyProps["channel"] == "true" {
if int64(len(profiles)) <= *a.Config().TeamSettings.MaxNotificationsPerChannel && profile.NotifyProps["channel"] == "true" && !ignoreChannelMentions {
keywords["@channel"] = append(keywords["@channel"], profile.Id)
keywords["@all"] = append(keywords["@all"], profile.Id)