summaryrefslogtreecommitdiffstats
path: root/app/notification.go
diff options
context:
space:
mode:
authorSaturnino Abril <saturnino.abril@gmail.com>2017-08-01 20:16:45 +0800
committerJoram Wilander <jwawilander@gmail.com>2017-08-01 08:16:45 -0400
commit88f398ffddbcbb58265d085c09cb72008be3f3d5 (patch)
tree6db22e220a781a144808e113505ce040c7e2eac7 /app/notification.go
parentb023b891550cd8fb2f874e822f05921d13f51fb2 (diff)
downloadchat-88f398ffddbcbb58265d085c09cb72008be3f3d5.tar.gz
chat-88f398ffddbcbb58265d085c09cb72008be3f3d5.tar.bz2
chat-88f398ffddbcbb58265d085c09cb72008be3f3d5.zip
Revert " #4755 Combining consecutive user join/leave system messages to single message and few other changes." (#7072)
* Revert "PLT-6603: Don't return all posts on invalid query. (#7061)" This reverts commit 25a2013890c7e07b4621fa9b18342e7f35363049. * Revert " #4755 Combining consecutive user join/leave system messages to single message and few other changes. (#5945)" This reverts commit 8a91235fb3cdc8d094dbc2eaa0d7baa447132b3c.
Diffstat (limited to 'app/notification.go')
-rw-r--r--app/notification.go85
1 files changed, 0 insertions, 85 deletions
diff --git a/app/notification.go b/app/notification.go
index e5a43b4e8..d145b21b3 100644
--- a/app/notification.go
+++ b/app/notification.go
@@ -306,91 +306,6 @@ func SendNotifications(post *model.Post, team *model.Team, channel *model.Channe
return mentionedUsersList, nil
}
-func SendNotificationsForSystemMessageAddRemove(user *model.User, otherUser *model.User, channel *model.Channel, post *model.Post) *model.AppError {
- otherUserChannelMember, _ := GetChannelMember(channel.Id, otherUser.Id)
- team, err := GetTeam(channel.TeamId)
- if err != nil {
- return err
- }
-
- err = (<-Srv.Store.Channel().IncrementMentionCount(channel.Id, otherUser.Id)).Err
- if err != nil {
- return err
- }
-
- if utils.Cfg.EmailSettings.SendEmailNotifications {
- userAllowsEmails := otherUser.NotifyProps[model.EMAIL_NOTIFY_PROP] != "false"
- if otherUserChannelMember != nil {
- channelEmail, ok := otherUserChannelMember.NotifyProps[model.EMAIL_NOTIFY_PROP]
- if ok && channelEmail != model.CHANNEL_NOTIFY_DEFAULT {
- userAllowsEmails = channelEmail != "false"
- }
- }
-
- var status *model.Status
- var err *model.AppError
- if status, err = GetStatus(otherUser.Id); err != nil {
- status = &model.Status{
- UserId: otherUser.Id,
- Status: model.STATUS_OFFLINE,
- Manual: false,
- LastActivityAt: 0,
- ActiveChannel: "",
- }
- }
-
- senderName := utils.T("system.message.name")
- if userAllowsEmails && status.Status != model.STATUS_ONLINE && otherUser.DeleteAt == 0 {
- if err = sendNotificationEmail(post, otherUser, channel, team, senderName, user); err != nil {
- return err
- }
- }
- }
-
- if otherUserChannelMember != nil {
- sendPushNotifications := false
- if *utils.Cfg.EmailSettings.SendPushNotifications {
- pushServer := *utils.Cfg.EmailSettings.PushNotificationServer
- if pushServer == model.MHPNS && (!utils.IsLicensed || !*utils.License.Features.MHPNS) {
- l4g.Warn(utils.T("api.post.send_notifications_and_forget.push_notification.mhpnsWarn"))
- sendPushNotifications = false
- } else {
- sendPushNotifications = true
- }
- }
-
- channelName := channel.DisplayName
- senderUsername := user.Username
-
- if sendPushNotifications {
- var status *model.Status
- var err *model.AppError
- if status, err = GetStatus(otherUser.Id); err != nil {
- status = &model.Status{UserId: otherUser.Id, Status: model.STATUS_OFFLINE, Manual: false, LastActivityAt: 0, ActiveChannel: ""}
- }
-
- if ShouldSendPushNotification(otherUser, otherUserChannelMember.NotifyProps, true, status, post) {
- if err = sendPushNotification(post, otherUser, channel, senderUsername, channelName, true); err != nil {
- return err
- }
- }
- }
-
- message := model.NewWebSocketEvent(model.WEBSOCKET_EVENT_POSTED, "", post.ChannelId, "", nil)
- message.Add("post", post.ToJson())
- message.Add("channel_type", channel.Type)
- message.Add("channel_display_name", channelName)
- message.Add("channel_name", channel.Name)
- message.Add("sender_name", senderUsername)
- message.Add("team_id", channel.TeamId)
- message.Add("mentions", otherUser.Username)
-
- Publish(message)
- }
-
- return nil
-}
-
func sendNotificationEmail(post *model.Post, user *model.User, channel *model.Channel, team *model.Team, senderName string, sender *model.User) *model.AppError {
if channel.IsGroupOrDirect() {
if result := <-Srv.Store.Team().GetTeamsByUserId(user.Id); result.Err != nil {