Files
libredesk/internal/search/queries.sql
T
Abhinav Raut 62a1fc836e add livechat widget preview and misc improvements
Livechat:
- Add a live widget preview that renders in the inbox settings help rail.
- Warn when the primary or header colors are too close to the background.
- Require gradient/image background values and notice banner text when enabled.
- Show a default launcher logo in the widget when none is set, matching the preview.
- Drop the Beta badge from the livechat channel.

General settings:
- Add "set agents away on login". Agents log in as away and must go online manually.
- Add "show subject in conversation list" toggle.

Other:
- Add a keyboard shortcuts dialog from the user menu.
- Show a "snoozed until" badge on snoozed conversations.
- Contact search now matches emails partially instead of exact.
- Give outgoing message bubbles a secondary background.
2026-07-03 02:34:42 +05:30

52 lines
1.4 KiB
SQL

-- name: search-conversations-by-reference-number
SELECT
conversations.created_at,
conversations.uuid,
conversations.reference_number,
conversations.subject,
cs.name AS status
FROM conversations
LEFT JOIN conversation_statuses cs ON conversations.status_id = cs.id
WHERE reference_number::text = $1;
-- name: search-conversations-by-contact-email
SELECT
conversations.created_at,
conversations.uuid,
conversations.reference_number,
conversations.subject,
cs.name AS status
FROM conversations
JOIN users ON conversations.contact_id = users.id
LEFT JOIN conversation_statuses cs ON conversations.status_id = cs.id
WHERE users.email ILIKE '%' || $1 || '%'
ORDER BY conversations.created_at DESC
LIMIT 1000;
-- name: search-messages
SELECT
c.created_at as "conversation_created_at",
c.reference_number as "conversation_reference_number",
c.uuid as "conversation_uuid",
LEFT(m.text_content, 200) AS text_content,
cs.name as "conversation_status"
FROM conversation_messages m
JOIN conversations c ON m.conversation_id = c.id
LEFT JOIN conversation_statuses cs ON c.status_id = cs.id
WHERE m.type != 'activity' and m.text_content ILIKE '%' || $1 || '%'
LIMIT 30;
-- name: search-contacts
SELECT
id,
created_at,
first_name,
last_name,
email,
external_user_id
FROM users
WHERE type = 'contact'
AND deleted_at IS NULL
AND email ILIKE '%' || $1 || '%'
LIMIT 15;