704 Commits

Author SHA1 Message Date
jbpenrath
7a0f6fba80 (backend) fix test suites relying on boto3
In a5b2c2d0bc, we mocked `socket.getaddrinfo`
module but this one is also used by boto3 under the hood, so the mock brokes
all tests using boto3.
2026-04-20 15:04:34 +02:00
jbpenrath
9a44d2cf69 🐛(frontend) initialize thread event input on open
Currently, the logic to show/hide thread-event-input was only processed
into a scroll handler and by default the thread-event-input was hiddden.
So in thread view with only few messages, we expect to display the
thread
event input, but it is not. Now we call the near bottom check at mount
to
display the input if it is relevant when a thread is opened.
2026-04-20 10:24:43 +02:00
Bastien
e8d4a00817 (chore) bump keycloak to 26.6.1 (#637) 2026-04-19 15:59:02 +02:00
Sylvain Zimmer
a5b2c2d0bc 🔒️(ssrf) factorize SSRF code, allow redirects in image proxy (#631)
Also use the SSRF code in IMAP imports.
2026-04-17 10:00:56 +02:00
Sylvain Zimmer
b4da8a3af7 (inbound) add configurable inbound auth backends (#636)
Added sender authentication checks (DKIM/DMARC) with multiple modes (native, rspamd, authentication-results). Message UI now shows a clear error banner for forged senders and a warning for unverified senders; contact chips display a forged state.
2026-04-17 09:22:00 +02:00
Jean-Baptiste PENRATH
21a8cd0413 🐛(frontend) fix label popup stacking with create-label modal (#635)
The popup hosted the modal and portalled into document.body. Because
#__next establishes an isolated stacking context while body does not,
the popup sat on a higher paint layer than anything inside #__next
regardless of z-index, making the modal appear behind it and letting
the popup's overlay steal clicks and Escape from it.

Lift modal ownership and label mutations to LabelsWidget so the modal
renders as a sibling of the popup, portal the popup into #__next so
both share a stacking context, mark the popup aria-modal, and expose
closeOnEsc so the parent can silence the popup's Escape while a modal
is stacked above. thread-selection now defers Escape to any open
dialog so the popup owning Escape no longer exits selection mode.
2026-04-16 19:45:25 +02:00
jbpenrath
9b1e3fa295 🐛(backend) fix race condition in last-editor deletion guard
The select_for_update() was ineffective for two reasons:
- .exclude(id=instance.id) caused each concurrent thread to lock
  a disjoint set of rows, so no serialization occurred
- .count()/.exists() generate aggregate SQL (SELECT COUNT(*))
  that silently drops the FOR UPDATE clause in Django ORM

Now locks ALL editor rows (including self) via values_list()
evaluation, forcing concurrent deletes to serialize properly.
2026-04-16 16:14:16 +02:00
jbpenrath
b857122e45 🚸(frontend) show/hide ThreadEventInput when relevant
Currently the ThreadEventInput is always showed and sticked to the
bottom of the screen. But it can be annoying when the user is writing a
message for example as the input is displayed above the message reply
form. Then it is not relevant to show the input when the user is at the
top of the thread view. So we only show the input when the user reach
the end of the view.
2026-04-16 15:41:11 +02:00
jbpenrath
1103721b75 🚸(frontend) focus to field on forward
When user forwards a message, the message form should focus the `to`
field not the message composer.
2026-04-16 15:41:11 +02:00
Jean-Baptiste PENRATH
730fea15ee 🐛(global) handle non-serializable celery task errors and stop infinite polling (#633)
When a Celery worker crashes (e.g. OOM during large imports), the task
result contains a raw exception object (WorkerLostError) that is not
JSON-serializable, causing a 500 on the task status endpoint. The
frontend polling hooks never received a FAILURE status and kept polling
indefinitely.

Backend: convert exception objects in task results to serializable
strings instead of letting DRF fail on serialization.
Frontend: stop polling on API errors and surface the failure state to
consumers so they can display appropriate error UI immediately.
2026-04-16 12:17:55 +02:00
Stanislas Bruhière
631522b388 🐛(mda) quote error field and log socks proxy in outbound delivery (#626) 2026-04-16 12:12:18 +02:00
Jean-Baptiste PENRATH
8f8798cba3 🐛(global) allow thread viewers to post internal comments (#632)
Writing an internal comment is a personal authoring act that should
not require thread edit rights: support teammates invited as thread
viewers must still be able to comment and mention colleagues, as long
as they have edit rights on the mailbox. ThreadEvent IM writes and
ThreadUser listing are relaxed accordingly, while every other thread
mutation keeps the full edit-rights check.

  The message composer is now gated by the thread edit ability so that
  read-only users cannot bypass the check through reply or forward, and
  the thread-panel selection separator is hidden when no bulk action is
  available. A few unrelated UI polish fixes (disabled link button
  style, combobox placeholder visibility) ship alongside.
2026-04-15 17:07:51 +02:00
jbpenrath
efbae5f517 🚸(frontend) disable application menu when no option is available
Previously the settings dropdown could open an empty menu when
the selected mailbox granted none of the required abilities, leaving
users to think the button was broken. The menu is now rendered as a
disabled button with an explanatory tooltip so the UI stays stable
across mailbox switches and the reason is surfaced to the user.
2026-04-15 13:06:17 +02:00
jbpenrath
78c1842d99 (frontend) add label assignment with archive and bulk label widget
Dragging threads onto a label now assigns the label and archive by default.
Holding Shift while dropping only assign the label to the threads, mimicking
Gmail's "move" behavior. A custom drag preview follows the cursor
and updates in real-time to reflect the current action.

A new BulkLabelsWidget in the thread selection toolbar lets users
assign labels to multiple threads at once.
The existing LabelsPopup was refactored to support
multi-thread selection with indeterminate checkbox states.

Resolve #396
2026-04-15 13:06:17 +02:00
jbpenrath
a7dc4b4ef9 ⬆️(frontend) upgrade cunningham & ui-kit
Upgrade @gouvfr-lasuite/cunningham-react and @gouvfr-lasuite/ui-kit to
its latest version
2026-04-14 23:08:14 +02:00
jbpenrath
01b45a69fb 🐛(global) enforce full edit rights on thread mutations
A user with VIEWER MailboxAccess on a shared mailbox could still mutate
threads that the mailbox had EDITOR ThreadAccess to: the permission
check only looked at ThreadAccess.role, never at MailboxAccess.role.

Both roles must now be satisfied (EDITOR on ThreadAccess AND a role in
MAILBOX_ROLES_CAN_EDIT on MailboxAccess) for archive, spam, trash,
label, split, refresh_summary and thread-event writes. Personal actions
(unread, starred) intentionally stay open to any mailbox access since
they only mutate the caller's own ThreadAccess row.

The rule is centralised in ThreadAccessQuerySet.editable_by(user,
mailbox_id) so viewsets and permission classes share a single source of
truth, and exposed to the frontend via a new Thread.abilities.edit
field consumed by use-ability, which gates the matching UI controls.
2026-04-14 23:08:13 +02:00
jbpenrath
13d34c213f 💅(frontend) align send button on left
To improve ui consistency in thread view, align the send button of the
message form on the left. In this way, its position is in sync with
reply CTAs
2026-04-14 18:27:30 +02:00
jbpenrath
6e8abf991a 🚸(frontend) improve thread event date format
Use relative date to improve date readability in ThreadEvent component
2026-04-14 18:24:34 +02:00
Sylvain Zimmer
16acb5d820 (dns) add recursive SPF check and optional send-time validation (#625)
- Optional outgoing SPF validation that can block or mark external deliveries when sender SPF fails.
 - SPF cache invalidation so DNS rechecks are used immediately after DNS validation.
 - More robust SPF evaluation including recursive include resolution, improved TXT handling, duplicate/limit detection, and clearer result statuses.
2026-04-12 00:47:29 +02:00
Jean-Baptiste PENRATH
1044614a76 (global) add mention notifications via UserEvent (#621)
ThreadEvent IM mentions previously lived only inside the event payload,
with no per-user tracking, so a user had no way to see or filter the
threads where they were mentioned. The new UserEvent model materializes
mentions as first-class records (one row per mentioned user per event),
reconciled by a post_save signal whenever a ThreadEvent is created or
edited.

ThreadEvent edits and deletes are now bounded by THREAD_EVENT_EDIT_DELAY
(1h default) so UserEvent records cannot drift out of sync with stale
audit data past the window.
2026-04-10 00:54:39 +02:00
Jean-Baptiste PENRATH
4a59033a98 🔧(backend) put split thread feature under a feature flag (#624)
Allow to dis/enable split thread feature through environment variable
`FEATURE_THREAD_SPLIT`
2026-04-09 19:19:12 +02:00
Sylvain Zimmer
a3ccc7a57b (channels) add encryption, custom scopes and levels, auditing (#599)
- Scoped API-key channels with per-scope authorization, personal user channels (users/me/channels), encrypted channel secrets, API-key regeneration (API + admin UI), channel last-used tracking, and a raw email submission endpoint.
 - Provisioning mailbox lookup/listing API.
 - Stricter outbound MIME size checks, DKIM signing improvements, and hardened channel/permission validation.
 - Expanded end-to-end and unit coverage for channels, auth/scopes, provisioning, submission, metrics, and admin flows.
2026-04-09 00:53:03 +02:00
Jean-Baptiste PENRATH
d72df6c77d 🐛(backend) fix threads ordering (#617)
There was bug in the default thread ordering. Actually, on list that
embed active and draft messages, some draft messages might have a
messaged_at at None (New message) but when we were sort threads by this
field, new draft message was sort at the top of the list because of null
attribute. So in this case, we need to first try to sort by messaged_at
then by draft_message_at.
2026-04-02 16:27:21 +02:00
Jean-Baptiste PENRATH
c1666b45fe 🔧(frontend) remove npm from engines (#616)
buildpack is no more able to install dependencies due to the npm version
constraint... As npm is installed with node, we can assume to only set
node version into engines
2026-04-02 16:08:57 +02:00
Sylvain Zimmer
f002a22dd3 (global) allow user to send internal message through ThreadEvent (#566)
When a Thread has several accesses or is linked to a shared mailbox,
an input allows to post internal messages. It also allows to
mention user in a message. The ThreadEvent model
is the foundation to enrich Threads with further kind of event.

Co-authored-by: Sylvain Zimmer <sylvinus@users.noreply.github.com>
2026-04-01 18:22:30 +02:00
Stanislas Bruhière
5a9bfd5cb4 (frontend) add lprobe healthchecks and checksum verification for lprobe + caddy (#600)
* (frontend) add lprobe healthchecks and checksum verification for lprobe + caddy

* (frontend) add comment clarifying the absence of shell expansion
2026-04-01 00:40:06 +02:00
Jean-Baptiste PENRATH
346198171f 🐛(search) fix double request and flickering on search (#596)
The search queryKey included searchParams.toString(), creating a new
React Query entry per search term (triggering fetch #1). Meanwhile,
resetSearchQueryDebounced cleared the active query 500ms later
(triggering fetch #2 + flicker).
2026-03-19 14:57:51 +01:00
Jean-Baptiste PENRATH
7a8cf44479 (search) use bulk API and prefetching for reindex_all (#595)
The previous implementation indexed each thread and message with individual
OpenSearch HTTP calls and triggered N+1 DB queries for accesses, recipients
and sender lookups. This rewrites reindex_all to batch documents via
opensearchpy.helpers.bulk and prefetch related objects in a single queryset,
drastically reducing both DB round-trips and HTTP overhead.
2026-03-18 16:23:17 +01:00
Niels Kersic
1767e17117 (global) support silent login
Allow to enable silent login through envvar
`FRONTEND_SILENT_LOGIN_ENABLED`
2026-03-18 11:09:52 +01:00
jbpenrath
1c83a510b8 🏷️(orval) type API errors
Export ErrorType from custom fetch api client to properly
type api errors.

https://github.com/orval-labs/orval/issues/258
2026-03-18 10:55:54 +01:00
Jean-Baptiste PENRATH
138f4fba65 🐛(autoreply) do not mark thread as read when sending autoreply (#594)
The autoreply sender is away — marking the thread as read prevents
them from seeing new messages when they return.
2026-03-17 10:07:05 +01:00
jbpenrath
0bdeb06a87 🔖(minor) release version 0.5.0
Update all version files and changelog for minor release.
v0.5.0
2026-03-16 18:38:08 +01:00
jbpenrath
054fdbc01d 🐛(frontend) invalidate thread on self access removal
Invalidate thread list when the user deletes its own
access to a thread to prevent buggy situation where the
user still display a thread that has no more access..
2026-03-16 18:38:08 +01:00
jbpenrath
17ffd3fb8a 🚸(frontend) customize thread panel action according to selection state
Show mark as read/unread and star/unstar actions according to the current
thread selections in order to improve ux.
2026-03-16 17:21:23 +01:00
jbpenrath
292c8db9a3 🐛(global) improve unread state computation on backend and frontend
The unread filter relied on active_messaged_at and has_active which excluded
sent and archived threads from being marked unread. Switching to messaged_at
(now excluding both drafts and trashed messages) makes the filter view-agnostic
and consistent across inbox, sent, archive, and trash.

Sent and autoreply messages now update the sender's ThreadAccess.read_at so
threads don't flash as unread in the sender's own mailbox.
2026-03-16 17:00:23 +01:00
Sylvain Zimmer
e1970cc732 (autoreply) add autoreply feature (#569)
This reuses message templates and allows to define scheduling

Co-authored-by: Sylvain Zimmer <sylvinus@users.noreply.github.com>
2026-03-16 16:59:54 +01:00
Sylvain Zimmer
6f0a022bf8 ♻️(metrics) rename usage API params to be more generic (#589) 2026-03-12 22:01:23 +01:00
Jean-Baptiste PENRATH
b6e4ef2974 🔥(frontend) remove starred from here (#588)
The user was able to starred a thread from a message to act like a pointer but
this feature is too confusing so we prefer to remove it.
2026-03-12 10:00:06 +01:00
Jean-Baptiste PENRATH
b1d455022c (drive) use url_permalink and limit request to drive resource server (#587)
With the latest version of Drive, items have no a url_permalink property which
is more robust than the previous url property we were using as download link
for drive attachments.

Furthermore, we totally revamp the logic to save attachment to drive. Actually
the current implementation triggered n requests for n attachments each time a
user opened a thread... that was great for ux as the user always know if the
attachment exists in its workspace but it triggers too muck request to be a
production ready implementation. So now, the user is no more able to know
if an attachment exists in its workspace until it clicks to upload the
attachment and the backend checks if the file already exists in the user
workspace.

Finally, we also replace the DriveIcon which was used to open drive item
preview by an eye icon.

Resolve #567
2026-03-11 18:45:05 +01:00
Sylvain Zimmer
4a18fe2019 (threads) add an action to split a thread from a message (#561)
Co-authored-by: Sylvain Zimmer <sylvinus@users.noreply.github.com>
2026-03-11 18:09:24 +01:00
jbpenrath
b65730075a 🔒(frontend) prevent XSS and URL redirect in shallow navigation
String interpolation of user-controlled values (router.query.mailboxId,
searchParams) into router.push URLs was flagged by github-advanced-security.
Extract safe shallow push logic into a reusable hook that uses Next.js
object-form router.push, eliminating the attack vector entirely.
2026-03-11 12:22:48 +01:00
Jean-Baptiste PENRATH
5175704138 (thread-panel) add unread and starred filters (#581)
Allow users to quickly filter threads in the panel by "unread only"
and/or "starred only" via URL search params, keeping consistency
with the existing folder navigation pattern. Also fixes folder title
resolution and active state highlighting when filter params are present.
2026-03-11 12:22:46 +01:00
jbpenrath
54fd3deb04 (frontend) add starred/important thread feature
The backend already scopes the starred flag per mailbox via
ThreadAccess.starred_at. This commit exposes the feature in the
frontend: a useStarred hook, a toggle button in the thread action
bar, a starred badge in thread items, an important icon in the
thread view subject, and a search filter checkbox for starred
threads (is:starred / est:important).

Also fixes the undo toast in use-flag to propagate mailboxId so
that mailbox-scoped flags (unread, starred) can be properly undone.
2026-03-11 11:55:19 +01:00
jbpenrath
03aac79606 (thread) scope starred flag per mailbox via ThreadAccess.starred_at
The starred flag was previously global (Message.is_starred + Thread.has_starred),
meaning if one mailbox starred a thread, all mailboxes would see it as starred.

This migrates starred to ThreadAccess.starred_at (DateTimeField), following the
same per-mailbox scoping pattern already established for read_at. Each mailbox
now independently controls its own starred state.
2026-03-10 16:26:12 +01:00
Sylvain Zimmer
dc52f1f99a 🐛(metrics) remove mailbox.id in metrics
This was a useless field for our remote scraper
2026-03-08 11:17:07 +01:00
Sylvain Zimmer
6e0b2138a2 (metrics) add better filtering and granularity for usage metrics 2026-03-07 22:50:39 +01:00
Sylvain Zimmer
5b89cf545b 🐛(dns_check) make DNS checking more resilient
Instead of exact matching, we now parse DKIM and SPF records
2026-03-07 01:02:05 +01:00
Sylvain Zimmer
ae40938211 (provisioning) expose oidc_autojoin and identity_sync flags 2026-03-05 20:05:03 +01:00
jbpenrath
db1957028c 🔖(minor) release version 0.4.0
Update all version files and changelog for minor release.
Added
- Store thread read state per thread access #575
  ⚠️ This migration requires a search reindex to be run after the upgrade.
- Store and display the user who sent a message #574
- Display selected threads count in right panel #576
- Add skip navigation link for keyboard users #573
- Add DeployCenter backend for syncing maildomain admins #572
- Add management command to print all users of the instance

Changed
- Bump keycloak to 26.5.4 #571
- Add migrations-check Makefile command

Fixed
- Preserve scroll position across renders #578
- Convert newlines to `<br>` in styled text #577
- Scope labels and user_role to the requested mailbox
v0.4.0
2026-03-05 16:56:47 +01:00
jbpenrath
2c9d9745c2 🌐(i18n) update translated strings
Update translated files with new translations
2026-03-05 16:41:26 +01:00