@@ -181,16 +181,16 @@ func (a *App) SendNotifications(post *model.Post, team *model.Team, channel *mod
|
||||
// for each mention, make sure to update thread autofollow (if enabled) and update increment mention count
|
||||
for id := range threadParticipants {
|
||||
mac := make(chan *model.AppError, 1)
|
||||
go func(userId string) {
|
||||
go func(userID string) {
|
||||
defer close(mac)
|
||||
incrementMentions := false
|
||||
for mid := range mentions.Mentions {
|
||||
if userId == mid {
|
||||
if userID == mid {
|
||||
incrementMentions = true
|
||||
break
|
||||
}
|
||||
}
|
||||
nErr := a.Srv().Store.Thread().CreateMembershipIfNeeded(userId, post.RootId, true, incrementMentions, *a.Config().ServiceSettings.ThreadAutoFollow)
|
||||
nErr := a.Srv().Store.Thread().CreateMembershipIfNeeded(userID, post.RootId, true, incrementMentions, *a.Config().ServiceSettings.ThreadAutoFollow)
|
||||
if nErr != nil {
|
||||
mac <- model.NewAppError("SendNotifications", "app.channel.autofollow.app_error", nil, nErr.Error(), http.StatusInternalServerError)
|
||||
return
|
||||
@@ -205,9 +205,9 @@ func (a *App) SendNotifications(post *model.Post, team *model.Team, channel *mod
|
||||
mentionedUsersList = append(mentionedUsersList, id)
|
||||
|
||||
umc := make(chan *model.AppError, 1)
|
||||
go func(userId string) {
|
||||
go func(userID string) {
|
||||
defer close(umc)
|
||||
nErr := a.Srv().Store.Channel().IncrementMentionCount(post.ChannelId, userId, *a.Config().ServiceSettings.ThreadAutoFollow)
|
||||
nErr := a.Srv().Store.Channel().IncrementMentionCount(post.ChannelId, userID, *a.Config().ServiceSettings.ThreadAutoFollow)
|
||||
if nErr != nil {
|
||||
umc <- model.NewAppError("SendNotifications", "app.channel.increment_mention_count.app_error", nil, nErr.Error(), http.StatusInternalServerError)
|
||||
return
|
||||
@@ -705,16 +705,16 @@ const (
|
||||
GroupMention
|
||||
)
|
||||
|
||||
func (m *ExplicitMentions) addMention(userId string, mentionType MentionType) {
|
||||
func (m *ExplicitMentions) addMention(userID string, mentionType MentionType) {
|
||||
if m.Mentions == nil {
|
||||
m.Mentions = make(map[string]MentionType)
|
||||
}
|
||||
|
||||
if currentType, ok := m.Mentions[userId]; ok && currentType >= mentionType {
|
||||
if currentType, ok := m.Mentions[userID]; ok && currentType >= mentionType {
|
||||
return
|
||||
}
|
||||
|
||||
m.Mentions[userId] = mentionType
|
||||
m.Mentions[userID] = mentionType
|
||||
}
|
||||
|
||||
func (m *ExplicitMentions) addGroupMention(word string, groups map[string]*model.Group) bool {
|
||||
@@ -745,14 +745,14 @@ func (m *ExplicitMentions) addGroupMention(word string, groups map[string]*model
|
||||
return true
|
||||
}
|
||||
|
||||
func (m *ExplicitMentions) addMentions(userIds []string, mentionType MentionType) {
|
||||
for _, userId := range userIds {
|
||||
m.addMention(userId, mentionType)
|
||||
func (m *ExplicitMentions) addMentions(userIDs []string, mentionType MentionType) {
|
||||
for _, userID := range userIDs {
|
||||
m.addMention(userID, mentionType)
|
||||
}
|
||||
}
|
||||
|
||||
func (m *ExplicitMentions) removeMention(userId string) {
|
||||
delete(m.Mentions, userId)
|
||||
func (m *ExplicitMentions) removeMention(userID string) {
|
||||
delete(m.Mentions, userID)
|
||||
}
|
||||
|
||||
// Given a message and a map mapping mention keywords to the users who use them, returns a map of mentioned
|
||||
|
||||
Ссылка в новой задаче
Block a user