From 0dc8db1eed93539bc5f830a85af5774e9596e6a8 Mon Sep 17 00:00:00 2001 From: Abhinav Raut Date: Mon, 5 Jan 2026 16:28:47 +0530 Subject: [PATCH] refactor: rename email notification methods to generic notification methods as they also send in-app notifications --- internal/conversation/conversation.go | 14 +++++++------- internal/conversation/message.go | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/internal/conversation/conversation.go b/internal/conversation/conversation.go index 7365629f..6aa1f71a 100644 --- a/internal/conversation/conversation.go +++ b/internal/conversation/conversation.go @@ -553,9 +553,9 @@ func (c *Manager) UpdateConversationUserAssignee(uuid string, assigneeID int, ac // Evaluate automation rules. c.automation.EvaluateConversationUpdateRules(conversation, amodels.EventConversationUserAssigned) - // Send email to assignee. - if err := c.SendAssignedConversationEmail([]int{assigneeID}, conversation); err != nil { - c.lo.Error("error sending assigned conversation email", "error", err) + // Send notifications to assignee. + if err := c.NotifyAssignment([]int{assigneeID}, conversation); err != nil { + c.lo.Error("error sending assignment notification", "error", err) } if err := c.RecordAssigneeUserChange(uuid, assigneeID, actor); err != nil { @@ -841,8 +841,8 @@ func (m *Manager) GetMessageSourceIDs(conversationID, limit int) ([]string, erro return refs, nil } -// SendAssignedConversationEmail sends a email for an assigned conversation to the passed user ids. -func (m *Manager) SendAssignedConversationEmail(userIDs []int, conversation models.Conversation) error { +// NotifyAssignment sends notifications (in-app, WebSocket, email) for an assigned conversation. +func (m *Manager) NotifyAssignment(userIDs []int, conversation models.Conversation) error { agent, err := m.userStore.GetAgent(userIDs[0], "") if err != nil { m.lo.Error("error fetching agent", "user_id", userIDs[0], "error", err) @@ -915,9 +915,9 @@ func (m *Manager) SendAssignedConversationEmail(userIDs []int, conversation mode return nil } -// SendMentionNotificationEmail sends email notifications for mentions. +// NotifyMention sends notifications (in-app, WebSocket, email) for mentions. // For team mentions, expands to all team members. -func (m *Manager) SendMentionNotificationEmail(conversationUUID string, message models.Message, mentions []models.MentionInput, mentionedByUserID int) { +func (m *Manager) NotifyMention(conversationUUID string, message models.Message, mentions []models.MentionInput, mentionedByUserID int) { conversation, err := m.GetConversation(0, conversationUUID, "") if err != nil { m.lo.Error("error fetching conversation for mention notification", "uuid", conversationUUID, "error", err) diff --git a/internal/conversation/message.go b/internal/conversation/message.go index b231256e..905dd889 100644 --- a/internal/conversation/message.go +++ b/internal/conversation/message.go @@ -378,7 +378,7 @@ func (m *Manager) SendPrivateNote(media []mmodels.Media, senderID int, conversat if err := m.InsertMentions(message.ConversationID, message.ID, senderID, mentions); err != nil { m.lo.Error("error inserting mentions", "error", err) } - go m.SendMentionNotificationEmail(conversationUUID, message, mentions, senderID) + go m.NotifyMention(conversationUUID, message, mentions, senderID) } return message, nil