Commit Graph

439 Commits

Author SHA1 Message Date
Abhinav Raut bfbcd0a885 add contact deletion and data export for GDPR compliance
First part of GDPR support (#244): the right to erasure and the right
to access.

- DELETE /api/v1/contacts/{id} permanently deletes a contact or
  visitor. Conversations, messages, notes, and participants go with it
  via DB cascades. The avatar file is removed too.
- GET /api/v1/contacts/{id}/export downloads a JSON file with
  everything stored about the contact: profile, custom attributes, and
  all conversations with their messages. Private notes stay internal.
- Both actions are gated by new permissions (contacts:delete,
  contacts:export), granted to Admin in migration v2.6.0, and recorded
  in the activity log with actor and IP.
- Contact page gets Export data and Delete contact buttons, with a
  confirm dialog for delete.
- The unlinked media cleaner now also removes attachment files whose
  message no longer exists. Before this, deleting a conversation left
  its attachments on disk forever.
2026-07-14 01:30:59 +05:30
Abhinav Raut 2e203607e5 fix duplicate contact creation on transient error during ext_id enrichment
CreateContact treated any SetExternalUserID failure as "ext_id taken" and
fell through to the upsert, so a transient DB error created a second
contact with the same email. Now only a unique violation or a contact
deleted mid-flight falls through, other errors are returned.
SetExternalUserID also reports whether a row was actually updated, and
dbutil error checks use errors.As so wrapped errors match. Widget JWTs
with no email now store NULL instead of an empty string.
2026-07-10 01:06:38 +05:30
Abhinav Raut fc71d30b8a accept phone country code in livechat JWT auth 2026-07-09 23:15:05 +05:30
Abhinav Raut 8a8d372a70 use one phone field in livechat JWT and fix phone validation 2026-07-09 02:27:08 +05:30
Abhinav Raut 8f658f274d add livechat pre-chat phone field and fix default launcher logo 2026-07-09 01:49:38 +05:30
Abhinav Raut 9b5326c689 normalize email before validating create conversation request 2026-07-08 13:14:22 +05:30
Abhinav Raut 4dabc84a33 harden contact create, drop set-away-on-login, make status dots colorblind-safe 2026-07-08 12:14:36 +05:30
Abhinav Raut 43b43a82ef Merge branch 'main' into delete-private-notes 2026-07-08 00:47:28 +05:30
Abhinav Raut d696b53c80 soft-delete private notes with a tombstone instead of removing them 2026-07-08 00:43:29 +05:30
Abhinav Raut 5a826b9c14 Merge pull request #399 from abhinavxd/reply-box-per-type-drafts
Reply box per type drafts
2026-07-08 00:26:21 +05:30
Abhinav Raut 9e0c1f332d Merge branch 'main' into delete-private-notes 2026-07-07 23:37:05 +05:30
ahfoysal f4f8db81d9 Mark assignment notifications read on action 2026-07-06 13:32:16 +06:00
Abhinav Raut ee7b829ff2 Merge branch 'main' into reply-box-per-type-drafts 2026-07-05 20:12:44 +05:30
Abhinav Raut 0949761d04 fix contrast threshold and cache invalidation order on login 2026-07-05 20:03:31 +05:30
Abhinav Raut 5166358301 move isValidDraftType to bottom of file 2026-07-05 18:42:33 +05:30
Abhinav Raut ec3938c365 save reply and private note drafts separately per type 2026-07-03 03:37:09 +05:30
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
josephsellers 406a2941a1 Scope delete-private-message to its conversation (fix IDOR)
Address CodeRabbit review: the query deleted by message uuid alone, so an agent
with access to one conversation could delete a private note from another by
pairing an accessible cuuid with a foreign message uuid. The delete is now
scoped via conversation_id = (SELECT id FROM conversations WHERE uuid = $2), and
DeletePrivateMessage / the handler pass the conversation uuid alongside the
message uuid.

[Used Claude Code 🤖]
2026-06-18 12:07:31 +01:00
josephsellers b699cacd30 Add API endpoint to delete private notes
Adds DELETE /api/v1/conversations/{cuuid}/messages/{uuid} for removing private
notes via the API. Uses a dedicated `delete-private-message` query/stmt
(separate from the generic `delete-message` used internally by continuity) so
only messages with private=true can be deleted — sent/incoming messages are
protected. Returns 404 if the message doesn't exist or isn't private.

Useful for API consumers that create private notes programmatically and need to
clean them up (e.g. replacing an outdated note before adding a new one).

[Used Claude Code 🤖]
2026-06-18 11:33:19 +01:00
Abhinav Raut a629beaf0b resolve sql builder date filters in the app timezone instead of UTC 2026-06-18 11:56:43 +05:30
Abhinav Raut 3247a3aa58 feat: support nested AND/OR filter groups and new fields in views 2026-06-16 16:14:12 +05:30
Abhinav Raut edbc026a24 Merge pull request #359 from abhinavxd/transcript
feat: add conversation transcript download and CSAT in sidebar
2026-06-07 15:29:20 +05:30
Abhinav Raut f70e488662 refactor: sanitize only the reference number for transcript filename 2026-06-07 15:22:52 +05:30
Abhinav Raut 2d81703ae2 fix: address review nits on transcript download
- sanitize Content-Disposition filename via stringutil.SanitizeFilename to neutralize header injection
- use i18n.Tc for count-aware singular/plural attachment label
- append download anchor to DOM and defer URL.revokeObjectURL for cross-browser reliability
2026-06-07 15:17:03 +05:30
Abhinav Raut f987224cee perf: avoid DB lookups when building email From name 2026-06-07 14:45:51 +05:30
Abhinav Raut 1fccfceb4c feat: add customisable From display name template for outgoing emails
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>
2026-06-07 14:20:56 +05:30
Abhinav Raut eb6a195aaf feat: add conversation transcript download and CSAT in sidebar
Agents can download a full conversation as a .txt file from the
header menu. The conversation sidebar now shows the CSAT rating and
feedback once the customer responds.
2026-06-02 16:25:33 +05:30
Abhinav Raut 3e7756a8b0 fix: correct config keys for socket and draft retention 2026-05-29 22:18:36 +05:30
Abhinav Raut c8a5717b43 fix: filter search results by conversation read permission
Auto focus on search input
Trim search responses to 200 chars as more's not needed.
2026-05-28 21:38:57 +05:30
Abhinav Raut 29881f2f82 fix: close ws stale-perm gaps and resub on reconnect
Reject disabled agents in FilterAuthorizedListUUIDs, kick role members on
permission removal or role delete, and re-sub the list and open conv on
ws reconnect using local state. Also plug the app logger into the ws
package so kicks no longer log when no connections exist.
2026-05-28 20:07:19 +05:30
Abhinav Raut 743b00ee22 fix: address PR review across stores, ws broadcast, and sticky scroll 2026-05-28 18:32:16 +05:30
Abhinav Raut 0654e3bd2f fix: skip empty incoming attachments; assign team/agent before running post message hooks this allows automations to see the conversations assigned agent & team. 2026-05-27 00:24:27 +05:30
Abhinav Raut 0a0500f29a refactor: fold widget availability broadcast into BroadcastAgentAvailability 2026-05-26 00:21:15 +05:30
Abhinav Raut a502039e59 perf: WS push for conv list, store/cache cleanups, ad-hoc UI polish
Convs and messages now push the full list-row payload to perm-authorized agents on create/assign/message, so livechat returning customers bubble up instantly without waiting for the timer refresh. Background list refresh bumped 30s ->  60s as a drift safety net.
2026-05-22 20:47:36 +05:30
Abhinav Raut ee4ddae407 fix: log team-member fetch errors during cache invalidation 2026-05-21 21:44:25 +05:30
Abhinav Raut edc82e9e55 refactor: drop Casbin, centralize agent cache invalidation, dedupe pending SLAs 2026-05-21 21:24:42 +05:30
Abhinav Raut 43ebed1c3a WS rewrite: per-client subscriptions and perf improvements
Targets broadcasts via per-tab list and open subs (validated at subscribe time)
instead of broadcasting message uuid to all agents. Adds frontend list typing, throttled sound,
and many perf improvements to reduce cpu memory & database queries.
Other fixes: Enforce message-to-conversation binding in handleGetMessage
2026-05-20 23:42:07 +05:30
Abhinav Raut 4e13e72cc3 fix: harden media + conversation queries against empty-uuid casts 2026-05-19 14:13:56 +05:30
Abhinav Raut b15c776142 update migration to version 2.3.0 2026-05-18 18:56:31 +05:30
Abhinav Raut c85cb90bef Merge pull request #317 from jleroy/i18n/update-2026-05-15
Update translations [2026-05-15] and add regions names in languages filenames
2026-05-18 15:24:43 +05:30
Abhinav Raut 7b1256a249 bump frontend deps and tighten image upload validation 2026-05-18 01:51:13 +05:30
Abhinav Raut b014d0d9a5 resolve inline image cids on send-message response, revert f841a81f 2026-05-15 17:39:04 +05:30
Jonathan Leroy e0f362c14e Migrate DB to the new locale format 2026-05-15 09:21:59 +02:00
Jonathan Leroy 8283b4e917 Update languages codes to include regions names and set default language to
"en-US"
2026-05-15 07:09:51 +02:00
Abhinav Raut 0abd96fb70 Fix quoted image resolution 2026-05-15 02:47:30 +05:30
Abhinav Raut 123b809be4 Address review feedback on bulk actions 2026-05-14 20:06:56 +05:30
Abhinav Raut 0be4a48b9c Generate thumbnails for extensionless images with magic byte detection 2026-05-14 17:06:35 +05:30
Abhinav Raut b72dad7cc7 Swap lightbox to lib, force-download via query param, link inline media on insert 2026-05-14 17:06:35 +05:30
Abhinav Raut 74189f84fb reduce websocket message channel buffer size from 10000 to 256 2026-05-12 15:48:10 +05:30
Abhinav Raut ffa5a22f3f fix s3 avatar_url storing bucket path instead of /uploads/<uuid>
Trim spaces around reply to config
2026-04-24 20:12:04 +05:30