MM-10122: Adds a mention for added-to-channel messages even when 'username mentions' are disabled. (#8648)
Этот коммит содержится в:
коммит произвёл
George Goldberg
родитель
2b83f8c48f
Коммит
4921fda79f
@@ -1140,10 +1140,10 @@ func (a *App) PostAddToChannelMessage(user *model.User, addedUser *model.User, c
|
|||||||
UserId: user.Id,
|
UserId: user.Id,
|
||||||
RootId: postRootId,
|
RootId: postRootId,
|
||||||
Props: model.StringInterface{
|
Props: model.StringInterface{
|
||||||
"userId": user.Id,
|
"userId": user.Id,
|
||||||
"username": user.Username,
|
"username": user.Username,
|
||||||
"addedUserId": addedUser.Id,
|
model.POST_PROPS_ADDED_USER_ID: addedUser.Id,
|
||||||
"addedUsername": addedUser.Username,
|
"addedUsername": addedUser.Username,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1162,10 +1162,10 @@ func (a *App) postAddToTeamMessage(user *model.User, addedUser *model.User, chan
|
|||||||
UserId: user.Id,
|
UserId: user.Id,
|
||||||
RootId: postRootId,
|
RootId: postRootId,
|
||||||
Props: model.StringInterface{
|
Props: model.StringInterface{
|
||||||
"userId": user.Id,
|
"userId": user.Id,
|
||||||
"username": user.Username,
|
"username": user.Username,
|
||||||
"addedUserId": addedUser.Id,
|
model.POST_PROPS_ADDED_USER_ID: addedUser.Id,
|
||||||
"addedUsername": addedUser.Username,
|
"addedUsername": addedUser.Username,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -89,6 +89,17 @@ func (a *App) SendNotifications(post *model.Post, team *model.Team, channel *mod
|
|||||||
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)
|
||||||
|
|
||||||
m := GetExplicitMentions(post.Message, keywords)
|
m := GetExplicitMentions(post.Message, keywords)
|
||||||
|
|
||||||
|
// Add an implicit mention when a user is added to a channel
|
||||||
|
// even if the user has set 'username mentions' to false in account settings.
|
||||||
|
if post.Type == model.POST_ADD_TO_CHANNEL {
|
||||||
|
val := post.Props[model.POST_PROPS_ADDED_USER_ID]
|
||||||
|
if val != nil {
|
||||||
|
uid := val.(string)
|
||||||
|
m.MentionedUserIds[uid] = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
mentionedUserIds, hereNotification, channelNotification, allNotification = m.MentionedUserIds, m.HereMentioned, m.ChannelMentioned, m.AllMentioned
|
mentionedUserIds, hereNotification, channelNotification, allNotification = m.MentionedUserIds, m.HereMentioned, m.ChannelMentioned, m.AllMentioned
|
||||||
|
|
||||||
// get users that have comment thread mentions enabled
|
// get users that have comment thread mentions enabled
|
||||||
|
|||||||
@@ -49,6 +49,7 @@ const (
|
|||||||
POST_PROPS_MAX_USER_RUNES = POST_PROPS_MAX_RUNES - 400 // Leave some room for system / pre-save modifications
|
POST_PROPS_MAX_USER_RUNES = POST_PROPS_MAX_RUNES - 400 // Leave some room for system / pre-save modifications
|
||||||
POST_CUSTOM_TYPE_PREFIX = "custom_"
|
POST_CUSTOM_TYPE_PREFIX = "custom_"
|
||||||
PROPS_ADD_CHANNEL_MEMBER = "add_channel_member"
|
PROPS_ADD_CHANNEL_MEMBER = "add_channel_member"
|
||||||
|
POST_PROPS_ADDED_USER_ID = "addedUserId"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Post struct {
|
type Post struct {
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user