mirror of
https://github.com/abhinavxd/libredesk.git
synced 2025-10-23 05:11:57 +00:00
Compare commits
4 Commits
a4a9a9ccd3
...
48b8d14f8f
Author | SHA1 | Date | |
---|---|---|---|
|
48b8d14f8f | ||
|
6231a9e131 | ||
|
d63302843b | ||
|
a652f380b2 |
@@ -5,7 +5,7 @@
|
||||
|
||||
Modern, open source, self-hosted customer support desk. Single binary app.
|
||||
|
||||

|
||||

|
||||
|
||||
|
||||
Visit [libredesk.io](https://libredesk.io) for more info. Check out the [**Live demo**](https://demo.libredesk.io/).
|
||||
|
@@ -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;
|
||||
|
@@ -885,7 +885,7 @@ func (m *Manager) evaluateSLA(appliedSLA models.AppliedSLA) error {
|
||||
|
||||
// If first response is not breached and not met, check the deadline and set them.
|
||||
if !appliedSLA.FirstResponseBreachedAt.Valid && !appliedSLA.FirstResponseMetAt.Valid {
|
||||
m.lo.Debug("checking deadline", "deadline", appliedSLA.FirstResponseDeadlineAt, "met_at", appliedSLA.ConversationFirstResponseAt.Time, "metric", MetricFirstResponse)
|
||||
m.lo.Debug("checking deadline", "deadline", appliedSLA.FirstResponseDeadlineAt.Time, "met_at", appliedSLA.ConversationFirstResponseAt.Time, "metric", MetricFirstResponse)
|
||||
if err := checkDeadline(appliedSLA.FirstResponseDeadlineAt.Time, appliedSLA.ConversationFirstResponseAt, MetricFirstResponse); err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -893,7 +893,7 @@ func (m *Manager) evaluateSLA(appliedSLA models.AppliedSLA) error {
|
||||
|
||||
// If resolution is not breached and not met, check the deadine and set them.
|
||||
if !appliedSLA.ResolutionBreachedAt.Valid && !appliedSLA.ResolutionMetAt.Valid {
|
||||
m.lo.Debug("checking deadline", "deadline", appliedSLA.ResolutionDeadlineAt, "met_at", appliedSLA.ConversationResolvedAt.Time, "metric", MetricResolution)
|
||||
m.lo.Debug("checking deadline", "deadline", appliedSLA.ResolutionDeadlineAt.Time, "met_at", appliedSLA.ConversationResolvedAt.Time, "metric", MetricResolution)
|
||||
if err := checkDeadline(appliedSLA.ResolutionDeadlineAt.Time, appliedSLA.ConversationResolvedAt, MetricResolution); err != nil {
|
||||
return err
|
||||
}
|
||||
|
Reference in New Issue
Block a user