PLT-6485 Add ability to disable @here notifications (#6372)

Этот коммит содержится в:
David Meza
2017-05-30 11:02:44 -05:00
коммит произвёл Harrison Healey
родитель 23ca4fe69c
Коммит eab6f74594
3 изменённых файлов: 8 добавлений и 19 удалений

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

@@ -222,23 +222,6 @@ func SendNotifications(post *model.Post, team *model.Team, channel *model.Channe
)
}
if hereNotification {
statuses := GetAllStatuses()
for _, status := range statuses {
if status.UserId == post.UserId {
continue
}
_, profileFound := profileMap[status.UserId]
_, alreadyMentioned := mentionedUserIds[status.UserId]
if status.Status == model.STATUS_ONLINE && profileFound && !alreadyMentioned {
mentionedUsersList = append(mentionedUsersList, status.UserId)
updateMentionChans = append(updateMentionChans, Srv.Store.Channel().IncrementMentionCount(post.ChannelId, status.UserId))
}
}
}
// Make sure all mention updates are complete to prevent race
// Probably better to batch these DB updates in the future
// MUST be completed before push notifications send
@@ -790,6 +773,11 @@ func GetMentionKeywordsInChannel(profiles map[string]*model.User) map[string][]s
if int64(len(profiles)) < *utils.Cfg.TeamSettings.MaxNotificationsPerChannel && profile.NotifyProps["channel"] == "true" {
keywords["@channel"] = append(keywords["@channel"], profile.Id)
keywords["@all"] = append(keywords["@all"], profile.Id)
status := GetStatusFromCache(profile.Id)
if status != nil && status.Status == model.STATUS_ONLINE {
keywords["@here"] = append(keywords["@here"], profile.Id)
}
}
}

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

@@ -589,7 +589,7 @@ export default class NotificationsTab extends React.Component {
/>
<FormattedMessage
id='user.settings.notifications.channelWide'
defaultMessage='Channel-wide mentions "@channel", "@all"'
defaultMessage='Channel-wide mentions "@channel", "@all", "@here"'
/>
</label>
</div>
@@ -658,6 +658,7 @@ export default class NotificationsTab extends React.Component {
if (this.state.channelKey) {
keys.push('@channel');
keys.push('@all');
keys.push('@here');
}
if (this.state.customKeys.length > 0) {
keys = keys.concat(this.state.customKeys.split(','));

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

@@ -2257,7 +2257,7 @@
"user.settings.modal.security": "Security",
"user.settings.modal.title": "Account Settings",
"user.settings.notifications.allActivity": "For all activity",
"user.settings.notifications.channelWide": "Channel-wide mentions \"@channel\", \"@all\"",
"user.settings.notifications.channelWide": "Channel-wide mentions \"@channel\", \"@all\", \"@here\"",
"user.settings.notifications.close": "Close",
"user.settings.notifications.comments": "Reply notifications",
"user.settings.notifications.commentsAny": "Trigger notifications on messages in reply threads that I start or participate in",