mirror of
https://github.com/abhinavxd/libredesk.git
synced 2026-09-11 13:28:57 +00:00
1fccfceb4c
Adds a from_name_template field to email inboxes. When set and the sender is an agent, the template renders with agent and inbox variables and becomes the From display name; the inbox email address is unchanged. Any render failure, or a system-user sender, falls back to the plain inbox From so a misconfigured template never blocks delivery. Variables: .Agent.FirstName, .Agent.LastName, .Agent.FullName, .Inbox.Name (the inbox name). Based on #249. Co-authored-by: josephsellers <6892567+josephsellers@users.noreply.github.com>
37 lines
1.9 KiB
SQL
37 lines
1.9 KiB
SQL
-- name: get-active-inboxes
|
|
SELECT id, uuid, created_at, updated_at, "name", deleted_at, channel, enabled, csat_enabled, prompt_tags_on_reply, config, "from", from_name_template, linked_email_inbox_id FROM inboxes where enabled is TRUE and deleted_at is NULL;
|
|
|
|
-- name: get-all-inboxes
|
|
SELECT id, uuid, created_at, updated_at, "name", deleted_at, channel, enabled, csat_enabled, prompt_tags_on_reply, config, "from", from_name_template, linked_email_inbox_id FROM inboxes where deleted_at is NULL;
|
|
|
|
-- name: insert-inbox
|
|
INSERT INTO inboxes
|
|
(channel, config, "name", "from", enabled, csat_enabled, prompt_tags_on_reply, secret, linked_email_inbox_id, from_name_template)
|
|
VALUES($1, $2, $3, $4, $5, $6, $7, $8, $9, $10)
|
|
RETURNING *
|
|
|
|
-- name: get-inbox
|
|
SELECT id, uuid, created_at, updated_at, "name", deleted_at, channel, enabled, csat_enabled, prompt_tags_on_reply, config, "from", from_name_template, secret, linked_email_inbox_id FROM inboxes where id = $1 and deleted_at is NULL;
|
|
|
|
-- name: get-inbox-by-uuid
|
|
SELECT id, uuid, created_at, updated_at, "name", deleted_at, channel, enabled, csat_enabled, prompt_tags_on_reply, config, "from", from_name_template, secret, linked_email_inbox_id FROM inboxes where uuid = $1 and deleted_at is NULL;
|
|
|
|
-- name: update
|
|
UPDATE inboxes
|
|
set channel = $2, config = $3, "name" = $4, "from" = $5, csat_enabled = $6, prompt_tags_on_reply = $7, enabled = $8, secret = $9, linked_email_inbox_id = $10, from_name_template = $11, updated_at = now()
|
|
where id = $1 and deleted_at is NULL
|
|
RETURNING *;
|
|
|
|
-- name: soft-delete
|
|
UPDATE inboxes set deleted_at = now(), updated_at = now(), config = '{}', enabled = false where id = $1 and deleted_at is NULL;
|
|
|
|
-- name: toggle
|
|
UPDATE inboxes
|
|
SET enabled = NOT enabled, updated_at = NOW()
|
|
WHERE id = $1
|
|
RETURNING *;
|
|
|
|
-- name: update-config
|
|
UPDATE inboxes
|
|
SET config = $2, updated_at = NOW()
|
|
WHERE id = $1 AND deleted_at IS NULL; |