mirror of
https://github.com/abhinavxd/libredesk.git
synced 2026-09-22 10:33:24 +00:00
skip auto-reply and csat send when contact has no email
This commit is contained in:
@@ -1287,6 +1287,9 @@ func (m *Manager) ApplyAction(action amodels.RuleAction, conv models.Conversatio
|
||||
case amodels.ActionReply:
|
||||
// Automated replies always go to the contact only. CCs from the
|
||||
// conversation history are deliberately not carried forward.
|
||||
if conv.Contact.Email.String == "" {
|
||||
return fmt.Errorf("auto-reply skipped: contact has no email for conversation: %s", conv.UUID)
|
||||
}
|
||||
_, err := m.QueueReply(
|
||||
[]mmodels.Media{},
|
||||
conv.InboxID,
|
||||
@@ -1356,8 +1359,12 @@ func (m *Manager) RemoveConversationAssignee(uuid, typ string, actor umodels.Use
|
||||
return nil
|
||||
}
|
||||
|
||||
// SendCSATReply sends a CSAT reply message to a conversation. No-op if one was already sent.
|
||||
// SendCSATReply sends a CSAT reply message to a conversation. No-op if one was already sent or contact has no email.
|
||||
func (m *Manager) SendCSATReply(actorUserID int, conversation models.Conversation) error {
|
||||
if conversation.Contact.Email.String == "" {
|
||||
m.lo.Info("CSAT reply skipped: contact has no email for conversation: %s", "conversation_uuid", conversation.UUID)
|
||||
return nil
|
||||
}
|
||||
csatResp, err := m.csatStore.Create(conversation.ID)
|
||||
if err != nil {
|
||||
if errors.Is(err, csat.ErrCSATAlreadyExists) {
|
||||
|
||||
Reference in New Issue
Block a user