mirror of
https://github.com/abhinavxd/libredesk.git
synced 2025-11-02 04:53:41 +00:00
Compare commits
2 Commits
a4a9a9ccd3
...
v0.7.4-alp
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d63302843b | ||
|
|
a652f380b2 |
@@ -541,6 +541,10 @@ func (c *Manager) UpdateConversationTeamAssignee(uuid string, teamID int, actor
|
||||
|
||||
// Team changed?
|
||||
if previousAssignedTeamID != teamID {
|
||||
// Remove assigned user if team has changed.
|
||||
c.RemoveConversationAssignee(uuid, models.AssigneeTypeUser, actor)
|
||||
|
||||
// Apply SLA policy if this new team has a SLA policy.
|
||||
team, err := c.teamStore.Get(teamID)
|
||||
if err != nil {
|
||||
return nil
|
||||
@@ -582,8 +586,6 @@ func (c *Manager) UpdateAssignee(uuid string, assigneeID int, assigneeType strin
|
||||
c.lo.Error("error updating conversation assignee", "error", err)
|
||||
return fmt.Errorf("updating assignee: %w", err)
|
||||
}
|
||||
// Clear assigned user ID.
|
||||
c.BroadcastConversationUpdate(uuid, "assigned_user_id", nil)
|
||||
default:
|
||||
return fmt.Errorf("invalid assignee type: %s", assigneeType)
|
||||
}
|
||||
@@ -962,7 +964,7 @@ func (m *Manager) ApplyAction(action amodels.RuleAction, conv models.Conversatio
|
||||
return nil
|
||||
}
|
||||
|
||||
// RemoveConversationAssignee removes the assignee from the conversation.
|
||||
// RemoveConversationAssignee removes assigned user from a conversation.
|
||||
func (m *Manager) RemoveConversationAssignee(uuid, typ string, actor umodels.User) error {
|
||||
if _, err := m.q.RemoveConversationAssignee.Exec(uuid, typ); err != nil {
|
||||
m.lo.Error("error removing conversation assignee", "error", err)
|
||||
@@ -977,6 +979,14 @@ func (m *Manager) RemoveConversationAssignee(uuid, typ string, actor umodels.Use
|
||||
})
|
||||
}
|
||||
|
||||
// Broadcast ws update.
|
||||
switch typ {
|
||||
case models.AssigneeTypeUser:
|
||||
m.BroadcastConversationUpdate(uuid, "assigned_user_id", nil)
|
||||
case models.AssigneeTypeTeam:
|
||||
m.BroadcastConversationUpdate(uuid, "assigned_team_id", nil)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
@@ -462,6 +462,11 @@ func (m *Manager) InsertMessage(message *models.Message) error {
|
||||
message.Meta = json.RawMessage(`{}`)
|
||||
}
|
||||
|
||||
// Handle empty content type enum, default to text.
|
||||
if message.ContentType == "" {
|
||||
message.ContentType = models.ContentTypeText
|
||||
}
|
||||
|
||||
// Convert HTML content to text for search.
|
||||
message.TextContent = stringutil.HTML2Text(message.Content)
|
||||
|
||||
|
||||
@@ -215,8 +215,6 @@ WHERE uuid = $1;
|
||||
-- name: update-conversation-assigned-team
|
||||
UPDATE conversations
|
||||
SET assigned_team_id = $2,
|
||||
assigned_user_id = NULL,
|
||||
assignee_last_seen_at = NULL,
|
||||
updated_at = NOW()
|
||||
WHERE uuid = $1;
|
||||
|
||||
@@ -355,6 +353,7 @@ WHERE uuid = $1;
|
||||
UPDATE conversations
|
||||
SET
|
||||
assigned_user_id = CASE WHEN $2 = 'user' THEN NULL ELSE assigned_user_id END,
|
||||
assignee_last_seen_at = CASE WHEN $2 = 'user' THEN NULL ELSE assignee_last_seen_at END,
|
||||
assigned_team_id = CASE WHEN $2 = 'team' THEN NULL ELSE assigned_team_id END,
|
||||
updated_at = NOW()
|
||||
WHERE uuid = $1;
|
||||
|
||||
Reference in New Issue
Block a user