Commit Graph
100 Commits
Author SHA1 Message Date
jbpenrath 94d079bc1b (mobile) add self-hosted OTA update chain
Store review cycles make shipping web-layer fixes through the stores
too slow, so the apps update their JS bundle over the air. The chain is
fully self-hosted to keep sovereignty: bundles and channel manifests
live on an anonymous-read S3 bucket (create_bucket --public / the
create-ota-bucket script) and the Capgo plugin is driven entirely from
JS against that manifest (autoUpdate off — no Capgo server involved).
Bundles are RSA-signed at publish time and verified against the
per-instance public key baked in at cap sync, so a tampered zip on the
public bucket is rejected.
Versions use a git-derived <count>-<sha> id stamped into the builtin
bundle so a fresh install does not re-download its own commit, and
channels (dev/staging/prod) are fully independent because
NEXT_PUBLIC_* vars are inlined at build time.
Also ships docs/mobile.md.
2026-07-22 11:21:05 +02:00
jbpenrath ace7991084 (frontend) bootstrap Capacitor mobile apps
Ship the existing SPA as native iOS/Android apps without forking the
codebase: Capacitor wraps the web build, and every mobile-specific
behavior is gated behind isNativePlatform() so the web app is
untouched. The native shells route fetch/cookies through the native
HTTP layer (CapacitorHttp) — the WebView cookie jar is unreliable for
cross-origin sessions — which is why login runs in the system browser
(cross-app SSO via the shared IdP cookie) and finishes through the
backend session handoff, with the deep-link scheme pinned by
sso-invariants tests. Downloads/share go through the Filesystem/Share
plugins since WebView navigation would lose the session.
2026-07-22 11:21:02 +02:00
jbpenrath 4ad0a80999 🐛(keycloak) map eidas1 acr value in dev realm
The backend sends acr_values=eidas1 on every authorization request
(OIDC_AUTH_REQUEST_EXTRA_PARAMS) but the dev realm had an empty
acr.loa.map, so Keycloak treated the value as an unknown essential acr
claim. Web logins survived it, but the mobile system-browser flow
(ASWebAuthenticationSession / Custom Tabs) failed the login round-trip,
breaking cross-app SSO in dev. Mapping eidas1 to LoA 1 mirrors what the
production IdP declares.
2026-07-22 11:16:42 +02:00
jbpenrath b7b5ff0604 (backend) add mobile OIDC session handoff
Capacitor apps must run the OIDC flow in the system browser (the IdP
cookie has to live there to provide cross-app SSO), but the browser's
cookies never reach the app's native HTTP layer, so the Django session
created by the callback would be stranded. The callback now redirects
to an allowlisted app deep link with a one-time token that the app
exchanges for its session cookie and CSRF token. The token is bound to
the initiating app instance with a PKCE S256 verifier, single-use,
short-lived (MOBILE_AUTH_TOKEN_TTL) and the anonymous exchange endpoint
is throttled per IP to cap brute-force guessing. An empty
MOBILE_AUTH_CALLBACK_SCHEMES (the default) keeps the whole handoff
disabled.
2026-07-22 11:16:41 +02:00
jbpenrath 5038dd977a ♻️(auth) deliver CSRF token via session instead of cookie
The upcoming Capacitor mobile shell replays the Django session cookie
through its native HTTP layer but not the `csrftoken` cookie, so
cookie-based CSRF would break every mutation on mobile. Enabling
CSRF_USE_SESSIONS moves the secret server-side and removes the need for
a JS-readable cookie: the token is now delivered on the authenticated
/users/me/ response, cached in memory by the SPA and echoed as
X-CSRFToken. On web this is equivalent or safer — the secret is no
longer readable by scripts nor overridable via cross-subdomain cookie
tossing.
2026-07-22 11:16:41 +02:00
Jean-Baptiste PENRATHandGitHub f058ee4d4a 📦(frontend) setup browserlist and support chrome >= 109 (#750)
Some of our users has reported issues using the application
with Chrome 109. Instead of polyfilling one by one each
method, we setup vite legacy plugin and configured a
browserlist. It adds a 23.5Kb Gzipped module but the
polyfill strategy management is more standard and robust.

Close #741
2026-07-20 18:12:00 +02:00
Jean-Baptiste PENRATHandGitHub 1eb68eeb61 🐛(frontend) fix outlook web handler in unquote logic (#754)
About the unquote-message logic, we encount a bug with a thread
implying Outlook Desktop quotes. Actually, for Outlook web we were looking for
a hr tag as quote separtor element. But sometimes this one can be wrap into a div
and we missed it.
2026-07-20 10:55:10 +02:00
39f2d9ca98 (frontend) detect text link in html body and warn user before redirect (#744)
Parse sanitized html before rendering to detect links that are just raw text then
transform them into anchor.
Furthermore, for security purpore, we catch event when a user clicks on a link then
display a confirmation modal displaying the real link.

Co-authored-by: Valentin Regnault <valentinregnault22@gmail.com>
2026-07-09 14:12:09 +02:00
Jean-Baptiste PENRATHandGitHub 983df0fe6f 🔧(global) set frontend configuration from backend (#734)
Pass frontend configuration through backend to prevent be able to edit it
without requiring frontend application.
2026-07-07 15:13:00 +02:00
Jean-Baptiste PENRATHandGitHub ce2b8f6ab0 🚸(frontend) reset search on mailbox switch (#743)
When the user switches to anoter mailbox while it is on a search view,
we reset search params and go to to the inbox as it does not make
sens to keep search params on the new mailbox
2026-07-07 08:41:42 +02:00
Jean-Baptiste PENRATH 114e537499 👔(backend) use builtin method to generate message-id (#730)
With some mail providers, your current message-id could cause rejection
so we migrate to the standard email.utils.make_msgid method.
2026-07-06 16:20:52 +02:00
jbpenrath a1ffcf3673 🔥(frontend) remove react-email component
We are currently using react-email to generate html bodies. This
library aims to generate marketing email consistent in all mail
providers. For personal message, it generates too much custom styles
that can increase spam score of those messages.
2026-07-06 16:20:51 +02:00
jbpenrath 76dc87fe5f 👔(backend) add X-Mailer header at outbound
We miss to add X-Mailer header to our outbound messages and this
missing can increase the spam score of our messages.
2026-07-06 16:20:51 +02:00
jbpenrathandNicolas Aunai 27b56ee058 (frontend) display unread count into mailbox dropdown
Display the count of unread messages next to the mailbox name
to help to quickly identify mailbox with new unread messages.

Resolve #738

Co-authored-by: Nicolas Aunai <nicolas.aunai@lpp.polytechnique.fr>
2026-07-06 15:55:50 +02:00
Jean-Baptiste PENRATHandGitHub a7cfcea673 🐛(frontend) fix compose line break issue on chrome android (#725)
In message form, we prevent the user to press "Enter" to submit
the form by error when composing message. But this logic breaks
the line-break on chrome for android.
2026-06-24 17:11:05 +02:00
jbpenrath aab5412129 ⬆️(backend) update django-lasuite to 0.0.27
Upgrade django-lasuite to 0.0.27 and add settings to configure
forwarded params.

https://github.com/suitenumerique/django-lasuite/pull/77
2026-06-23 23:15:18 +02:00
jbpenrath 35260fe7f8 🐛(backend) set attachment name fallback
The openapi schema specifies that an attachment has always
a name but we have some case where this attribute is None.
To guarantee this contract, we use a fallback value `unnamed`
when name is None during serialization.

Also fix other issues of the same kind identified.
2026-06-23 22:49:46 +02:00
Jean-Baptiste PENRATHandGitHub f0d8306902 🔖(minor) release version 0.8.0 (#715)
Update all version files and changelog for minor release.
2026-06-18 20:34:06 +02:00
Jean-Baptiste PENRATHandGitHub 3962ff7dd6 🐛(frontend) make thread-item select checkbox non interactive (#714)
When a user clicks on the checkbox of the thread-item to select it,
the preventDefault call prevent the checkbox to update its state so
under the hood the thread was well added to the selection but the
user has a wrong state. Now we make the checkbox fully controlled
and non-interactive, in this way, user always interact with the
thread-item link and the selection state is used to set the
checkbox state
2026-06-18 12:34:03 +02:00
jbpenrath 81055813ae 🐛(frontend) fix composer issues
Fix overflow issue of composer toolbar popovers.
Upgrade to latest blocknote version
2026-06-18 00:09:21 +02:00
jbpenrath 08c47baaa9 ⬆️(frontend) bump dompurify to latest version 2026-06-17 23:22:53 +02:00
jbpenrath 37e7840c71 🐛(frontend) unpin threads on draft deletion
We recently add draft deletion but we forgot to unpin threads on
this mutation so in some they could remain in the list until a
refresh is done.
2026-06-17 23:22:53 +02:00
jbpenrath 491d05afd6 💅(frontend) wrap autoreply date column
Allow autoreply date column to wrap its content as often date range
and badge are clipped on a single line.
2026-06-15 22:40:05 +02:00
jbpenrath 1ea79ad373 (threads) allow permanently deleting drafts, and improve draft edition
Drafts had no deletion path: the only "delete" affordance was the soft
trash flag, which makes no sense for a draft that was never sent. Users
accumulated drafts they could not get rid of.

Add a generic bulk hard-delete endpoint (POST /threads/bulk-delete/)
scoped by message flag (draft/trashed), mirroring the flag endpoint's
batch + editable_by authorization pattern. It deletes only the
scope-matching messages so reply-draft threads keep their real messages,
and removes the thread only once it is emptied.

Furthermore, the draft auto save feature was too agressive and can result
to too many blank draft persisted (signature, quote insertion
triggered a save as soon as user clicks on new message / reply
or forward. Now 30s autosave is only enabled when the draft
is created and logic to trigger auto save on form change has been
improved.

Finally, the ui has been revamp to improve draft display.
Currently draft are always wrapped into parent message component
that was make sens for reply/forward but now for new message.
2026-06-15 22:40:05 +02:00
Jean-Baptiste PENRATHandGitHub ca04508b56 🔧(deps) install jmap-email from pypi (#711)
Now that jmap-email 0.1.0 is available on pypi we install it from
this registry and remove all tweaks to install the deps from local
folder. We keep the volume override for backend services in order
to be able to work on jmap-email and test it with ease in local
development environment.
2026-06-15 13:45:23 +02:00
Jean-Baptiste PENRATHandGitHub e0cb1f4f08 🚸(frontend) improve thread navigation a11y and multiselect ux (#708)
Declare the thread list as a listbox with multiselectable elements.
Now when multiselect is enable, clicking on a thread add it to the
current selection, it does not reset the selection.
Furthermore, the keyboard navigation has been improved.
2026-06-15 08:36:03 +02:00
Jean-Baptiste PENRATHandGitHub 08663a271c 🩹(frontend) remove useless perspective attribute (#709)
In previous work we forgot to remove a css property that
was a test but create a scroll issue..
2026-06-12 01:54:30 +02:00
Jean-Baptiste PENRATHandGitHub 5d12e61644 💅(frontend) refine mailbox dropdown menu (#705)
Customize mailbox dropdown menu to make it more 'interactible'.
Distinguish shared vs personal mailbox through avatar shape and
display Name + email.
2026-06-12 00:16:50 +02:00
jbpenrath ff01cf42da 🚸(frontend) improve mailbox settings
- Warn user when it updates mailbox name without saving it in general
  tab
  and it is exiting this tab
- Revamp a little bit the integration dialog
2026-06-11 11:58:45 +02:00
jbpenrath 09b966aba8 (frontend) translate template placeholder and add user_name builtin var
Since we disabled backend i18n, template placeholders were not
translated according to the active frontend language.
We revamp the logic to delegate translation of those variables
to the frontend. Furthermore, we add a new builtin variable
that allows to bind the username into template.
Last but not least we add support of style to template
variable inline elements and we render name instead of value
into the editor.
2026-06-11 11:58:45 +02:00
jbpenrath 74be53a803 🌐(frontend) internationalize missing strings
Some strings did not use `t()`. We know use that everywhere.
In order to prevent the use of literal string as text, we enable
the eslint rule `i18next/no-literal-string`. As this rule triggers
warning for all material-icons span elements we replace all of them
by Icon component provided by UI-Kit (which was technical debt)
2026-06-11 00:40:13 +02:00
jbpenrath 7bc1ba7039 ♻️(frontend) use LaGaufreV2 component
UI-Kit expose LaGaufreV2 component we can now remove our custom
implementation and use this component instead.
Note: There is currently a bug that prevent to close lagaufre when
we open a Dropdown menu. We implement a quick fix here that must be
removed once https://github.com/suitenumerique/integration/pull/55
will be merged
2026-06-11 00:40:13 +02:00
jbpenrath 9457fdacae (frontend) gather mailbox settings into dialog
Gather all mailbox settings (accesses, templates, auto-replies,
signatures and integrations) into a setting dialog. This one is
only accessible to mailbox admin users. Furthermore a general tab
has been added to allow user to edit the mailbox sender name.
2026-06-10 14:43:37 +02:00
jbpenrath 7103d1934f 🐛(backend) persist mailbox name when contact is missing
Renaming a mailbox silently no-oped whenever its Contact was missing
(`contact` is nullable and not always created): the update filtered on a
null pk and changed zero rows while still returning 200. Route the rename
through a new `Mailbox.set_display_name()` helper that creates and links a
Contact when absent, so the name is always persisted.
2026-06-10 11:18:28 +02:00
Jean-Baptiste PENRATHandGitHub 15b02f6641 🍱(frontend) new homepage illustration (#702)
Use a new homepage illustration compatible with theme variant
2026-06-09 14:48:41 +02:00
jbpenrath c77fd0d3c7 🐛(backend) manage message/delivery-status attachments at compose
DSN/bounce and read-receipt reports embed a message/delivery-status part.
A PST stores it as a flat byte blob, and reconstructing the .eml fed it to
compose_email as a message/delivery-status attachment. There, email.generator
dispatches to _handle_message_delivery_status, which assumes a structured
(list) payload: given our flat base64 string it iterated character by
character and raised "'str' object has no attribute 'policy'", aborting the
whole compose. Every PST message carrying such a report was silently dropped,
and any send/widget/autoreply with the same attachment type would fail too.

Relabel message/delivery-status to text/plain at the single choke point
(create_attachment_part) so all compose callers are covered without
duplicating the guard. The bytes are RFC822-style text, so they stay readable
and intact; no other attachment type reaches a payload-structured generator
branch, so normal mail is unaffected.

Also skip empty / whitespace-only PST attachments: DSN reports expose blank
diagnostic parts that libpff surfaces as attachments, which imported as
0-byte parts rendering as broken in the UI while carrying no information.
2026-06-04 16:22:45 +02:00
jbpenrath bd5eb113a0 🐛(backend) complete pst email folder prefixes list
Previously, we considered as email container only ones
prefixed by `IPF.Note` but it appears `IPF.Imap` can also
contains email so we can miss some mails during import.
2026-06-04 16:22:44 +02:00
Jean-Baptiste PENRATHandGitHub e58a6f323e ⬆️(backend) bump django-lasuite to 0.0.26 (#689)
Upgrade to this version to be able to use `login_hint` param
during oidc auth.
2026-06-02 15:50:07 +02:00
jbpenrath 3f200ed04d 🔖(minor) release version 0.7.0
Update all version files and changelog for minor release.
2026-05-28 18:56:07 +02:00
jbpenrath ea9f33f6ff 🐛(frontend) do not refetch thread messages on draft deletion
If a draft is the single thread message, delete it should not
trigger a request to refresh thread message list because this is
wasteful and it also display a toast error as the thread does not
exist anymore.
2026-05-28 18:00:25 +02:00
jbpenrath afdfaf938a 🚸(frontend) improve sending experience
First when the sending reach the timeout, instead to display a toast
error
with a message that lets believe the message cannot be sent, we display
a warning message mentionning that sending takes more time than
expected.

Then, once a message is sent, we optimistically update thread cache to
hide
immediately the sent draft and show instead the message in the thread
view.
2026-05-28 11:02:15 +02:00
jbpenrath 77b16e5dc6 🐛(frontend) unmount thread view immediately on unselect thread
On slow machines, a race condition can occur when unselectThread is
trigger and another action is also triggered. e.g: when user mark as
unread a thread, the thread is unselect and the request to mark it as
unread is trigger but sometimes, the request is completed before the
router navigation so the observer in charge to mark visible message has
unread is trigger again and finally, the thread is not marked as
unread...
2026-05-27 18:42:02 +02:00
jbpenrath 4907849faf (frontend) attachments preview
Use the Preview component to allow user to
preview message attachment from a thread.
2026-05-27 17:05:16 +02:00
Jean-Baptiste PENRATHandGitHub 567a73a7e4 🗃️(backend) remove _deprecated model fields (#678)
In f360570798, a
migration in 3 parts has been done. This was
a progressive migration and in order to be able
to restore data model in case of failure, we simply
deprecate some fields. Now that everything is fine in
production, we can safely remove those fields.
2026-05-27 10:06:43 +02:00
Jean-Baptiste PENRATHandGitHub 98eabf96dd (backend) add defusedxml as deps (#677)
defusedxml was not declared into dependencies. In local
environment this one should be installed as transitive
deps but during deployment this deps was not found.
2026-05-27 09:39:13 +02:00
Jean-Baptiste PENRATHandGitHub 550af75214 🔖(minor) release version 0.6.0 (#671)
Update all version files and changelog for minor release.
2026-05-26 16:21:59 +02:00
jbpenrath 1f7427044e 🐛(backend) preserve obs-id-left In-Reply-To via UnstructuredHeader
Follow-up to 6144ccb2: the graceful drop stopped the 500 on /send/,
but every reply to an Outlook/MAPI thread lost threading because
Python 3.14's MsgIDListHeader (now the default for In-Reply-To and
References) truncates obs-id-left ids with multiple '@' in the local
part at the first '@' on serialize. The pre-stdlib flanker composer
used to write those bytes through unchanged.

Route both headers to UnstructuredHeader through a dedicated
HeaderRegistry. The instance has to be dedicated: policy.clone()
shares header_factory by reference with policy.SMTP and policy.default,
so mutating in place would silently change parsing process-wide. The
msg-id regex is loosened to allow multiple '@' now that the value
goes out verbatim; the whitespace ban stays (UnstructuredHeader folds
mid-id and receivers would then truncate at the fold), as does the
graceful drop from 6144ccb2 for the cases that genuinely can't ship
(whitespace, no '@', nested brackets, CR/LF injection attempts).

The PST importer's mirror regex is loosened in sync so archive imports
preserve threading on the same kind of ids. Two parametrized tests
lock the regression surface against silent narrowing — eight real-world
shapes that must round-trip on the wire and eight that must drop.
2026-05-21 14:19:18 +02:00
Jean-Baptiste PENRATH 7690d08ef0 👔(backend) allow to delete internal message at any time (#669)
Currently, user can delete/edit an internal message while
it is within the edit timeframe defined by
`MAX_THREAD_EVENT_EDIT_DELAY`. First feedbacks raises that
this limit is not relevant for deletion.
2026-05-20 20:49:50 +02:00
jbpenrath fedc4969bb 🐛(backend) improve pst import logic
- Improve error management for pst

We get some pst that are unparsable by pypff. To help user to understand
that the issue is coming from the PST file, we improve the exception
raised by pst task and display a custom error message according to the
error format.

- Recover Exchange X.500-only senders during PST import

Sent items from shared mailboxes — and many internal Exchange messages —
expose every PR_SENDER_*/PR_SENT_REPRESENTING_* slot as an unresolvable
X.500 DN. compose_email then rejected the EML for lack of a valid From
address and pst_tasks silently dropped the message at debug level, so
entire folders disappeared from the import without a trace.

- Prevent duplicate messages on PST re-import

PST messages without transport_headers (drafts, locally composed items)
were reconstructed with no Message-ID at all, and Exchange/O365 exports
sometimes drop the header even on received items. With no mime_id to
key on, deliver_inbound_message skipped its dedup check and inserted
the same message on every import — and even twice within a single
import when the same message appeared in multiple Outlook folders.
2026-05-20 20:49:01 +02:00
Jean-Baptiste PENRATH 49fcf22438 (frontend) thread deep linking (#664)
Allow user to copy/paste a thread link with other mailbox users.
Currently, if the user copy the current url, the link is broken once
the thread has been moved from the origin folder. It is also possible
to target a message or internal message.
2026-05-20 20:48:00 +02:00
Jean-Baptiste PENRATH ebab36d577 (frontend) improve message composer
* allow to render table in email

Improve email exporter to support table elements. We do not add
blocknote tool to add explicitly table but we allow user to
copy/paste it and render it properly.

* upgrade to blocknote 0.49.0

Remove a bug that prevent to use backspace in an empty block.
https://github.com/TypeCellOS/BlockNote/pull/2610
2026-05-20 20:48:00 +02:00
Jean-Baptiste PENRATH 21255a4c4a (global) allow thread assignation (#645)
As a follow-up of the mention feature, we build upon ThreadEvent & UserEvent
models a feature to assign users to a thread.
We allow to filter mailboxe's inbox through assignation state (assigned to me, unassigned).
The thread share modal has been forked from ui-kit to be able to list users of each
mailbox and add a cta to assign them to the thread. A section above shows assigned users.
2026-05-19 14:44:26 +02:00
Jean-Baptiste PENRATHandGitHub 8e009c5972 🐛(backend) allow thread editor to destroy thread accesses (#668)
Currently, only mailbox editors can remove thread access to their
mailbox.
Actually, thread access deletion must be symmetric with creation rights.
So
any user with thread management ability should be able to delete a
thread
access.
2026-05-19 14:44:06 +02:00
jbpenrath 1b03e1d240 🌐(frontend) localized attachment separator
The `ATTACHMENT_SEPARATORS` only contains a english separator and as
this
string is displayed within other mail client, for non-english users it
can
be weird to see an english string. That's why we add new separators and
according to the sender language, we use the localized separator that
correspond to him.
2026-05-12 13:48:38 +02:00
jbpenrath 8a7cb8e0c2 (frontend) make panel sections resizable
Allow user to resize mailbox folder and mailbox label list sections.
2026-05-11 16:39:30 +02:00
jbpenrath 858e995062 🚸(frontend) show tooltip to confirm mailbox refresh
Currently when the user clicks on the refresh button, a spinner
is displayed during query is pending. Often, this query is really
fast so the user does not see the spinner and wonder if something
really happend. In order to improve ux here, we now display the
spinning icon at least for 700ms in this way, no matter the query
timing, the user will see something happend. Furthermore, we also
add a transient tooltip that display refresh state (number of
new message or Up to date).
2026-05-11 10:46:29 +02:00
Jean-Baptiste PENRATHandGitHub 43e368a501 🚸(frontend) add read/unread action on thread action bar (#659)
Currently to mark a thread as read/unread, the user have to open a
dropdown
menu then click on the action... as this action can be done often, we
put it
directly in the thread action bar.
2026-05-07 12:00:28 +02:00
Jean-Baptiste PENRATHandGitHub 6be3b9e129 ♻️(frontend) refactor thread query cache management (#642)
The thread query is an infinite one and the frontend logic is
based on the structuralSharing concept of react-query to
optimiscally update the react query cache on thread mutation in
order to improve ux. This part is a tricky one and it's easy to
introduce regression, that's why refactor it by moving the corresponding
logic into a mailbox-cache module, use a better naming (pin instead of optimistic)
and battle test it.
2026-05-06 19:39:07 +02:00
Jean-Baptiste PENRATHandGitHub ad3307e448 🐛(frontend) fix thread panel header with nested label (#658)
When the current view is filtering through a nested label, the thread
panel
title has no text because we only traverse root labels to try to find
the
one selected. Now we also recursively traverse children.
2026-05-06 18:17:48 +02:00
Jean-Baptiste PENRATHandGitHub 22a8c35140 🔧(frontend) allow to use specific channel id for home feedback widget (#655)
Add `NEXT_PUBLIC_FEEDBACK_WIDGET_HOME_CHANNEL` env var to be able to
set a specific channel id to receive feedback from unauthenticated
users.
For configuration ease and backward compatibility, if
`NEXT_PUBLIC_FEEDBACK_WIDGET_HOME_CHANNEL` is not set, the home feedback
widget fallback to `NEXT_PUBLIC_FEEDBACK_WIDGET_CHANNEL`.
2026-05-05 14:23:42 +02:00
Jean-Baptiste PENRATHandGitHub 485e4a2e66 🌐(frontend) dns add propagation delay info (#654)
DNS configuration can take up to 24 hours to propagate. To prevent
support
question, we add this explanation in the admin DNS view.
2026-05-05 11:50:56 +02:00
Jean-Baptiste PENRATHandGitHub 5ca59329ab 🔒(backend) stop flagging inbound From=To mails as is_sender (#652)
A spoofed inbound with From == To was being marked is_sender=True via
the
`sender_email == recipient_email` shortcut in
_create_message_from_inbound.
Because MessageRecipient rows from the inbound path carry no
delivery_status, those messages matched retry_messages_task's
(is_sender=True AND delivery_status IN (RETRY, NULL)) filter and went
through send_message on every 5-min beat — DKIM-signing and re-emitting
the spam to every recipient on the envelope, externals included.

Legitimate self-sends are unaffected: send_message's internal redelivery
hits the mime_id dedup in deliver_inbound_message before reaching
_create_message_from_inbound, so the shortcut was already dead code on
the legitimate path.
2026-05-04 15:54:44 +02:00
Jean-Baptiste PENRATHandGitHub 44d455c488 ♻️(frontend) support legacy and new widget attribute (#650)
The new widget loader consume `window._lasuite_widget` property to
know which widget to load. The previous version was using
`window._stmsg_header`. We refactor widget loading logic to support
both version with ease.
2026-04-30 16:18:51 +02:00
Jean-Baptiste PENRATHandGitHub b12ebbf8c6 ⬆️(frontend) update widget logic to latest version (#649)
The new widget loader consume `window._lasuite_widget` property to
know which widget to load. The previous version was using
`window._stmsg_header`.

/!\ Update NEXT_PUBLIC_LAGAUFRE_WIDGET_PATH and
NEXT_PUBLIC_FEEDBACK_WIDGET_PATH
to target the new widget version before deploying this commit.
2026-04-30 14:28:25 +02:00
jbpenrath bff7464571 🔧(backend) allow to reindex from date
Add an option `--from-date` to the `search_reindex` management command.
In this way, in case of index task failure, we are able to reindex only
resources updated in a recent timeframe.
2026-04-29 10:19:33 +02:00
jbpenrath a29b25a7c0 ️(backend) replace delete_by_query with bulk delete by _id
OpenSearch was returning 503/429 on delete_by_query under the load of
the periodic reindex. Each bulk_reindex_threads_task could fire up to
100 delete_by_query calls (one per chunk of 100 threads) to sweep
orphan messages, and bulk_delete_threads_task did one more to drop a
thread and all its children. delete_by_query holds a scroll context,
scans the index and refreshes per call — far heavier than the bulk
upserts running alongside it.

Tracking message deletes explicitly at signal time lets us replace
every hot-path delete_by_query with a bulk delete by _id:

- New search:pending_delete_messages set storing thread_id:message_id
  pairs, fed by Message.post_delete (covers cascaded deletes too).
- New bulk_delete_messages_task issuing bulk DELETE actions with the
  parent thread_id as routing.
- bulk_delete_threads_task rewritten to bulk DELETE thread parent docs
  by _id; child message docs ride the new task via cascaded signals.
- _purge_orphan_docs and the per-chunk purge in reindex_bulk_threads
  removed; reindex is now pure upsert.
2026-04-29 10:19:33 +02:00
jbpenrath 2603b2bb62 🐛(backend) retryable opensearch transport errors
Currently, we retry indexing task only on ConnectionError (socket-level)
but some error at http-level are also relevant to a retry.
So now we filter TransportError by status code: retryable (5xx + 429)
propagate so `bulk_reindex_threads_task` can autoretry with the existing
exponential backoff, 4xx stay swallowed since retrying caller bugs only
burns worker time.
2026-04-29 10:19:33 +02:00
Jean-Baptiste PENRATHandGitHub 5054daa879 🌐(frontend) force default language (#647)
Currently, when user has not its language set into local storage, we
retrieve
the default language through the navigator language. In some instance,
we would
like to enforce the default language. So we add a new env var
`NEXT_PUBLIC_FORCED_DEFAULT_LANGUAGE`, if this one is set to `true`, we
skip
the navigator.language and use the `NEXT_PUBLIC_DEFAULT_LANGUAGE` as
default
2026-04-28 19:38:14 +02:00
jbpenrath 81da914ca4 ️(backend) improve search_reindex bulk payload
`bulk_data` method was missing some options (timeout, max_retries) so
sometimes when
the payload was heavy, the request can failed because the timeout was
too slow by default
(10s) and there is no `max_retries`. Furthermore, we build bulk payload
by chunking thread
but it did not check the payload bytes size, so in case of heavy
message, the payload could
be heavy. Now a max_bytes limit is set (50 Mib by default)
2026-04-27 18:26:03 +02:00
jbpenrath 6d0eb0d234 ️(backend) defer indexation tasks
Opensearch index is updated each time a Thread, Message or MessageRecipient
is updated through signals. The current logic has performance issues has
n update of a resource will generate n celery task to update the same
resource... So this work aims to batch updates. Index is updated each
30s and resource ids is deduplicated to only update a resource once.
Furthermore, in an import context, the index will be updated only
when the import will be completed to prevent to spam the celery
worker with numerous indexation task.
2026-04-27 18:26:03 +02:00
jbpenrath a1fdca19b2 Revert "(global) allow thread assignation"
This reverts commit 267372520d.
2026-04-27 18:14:09 +02:00
jbpenrath 682530b3b7 Revert "fixup! (global) allow thread assignation"
This reverts commit b04b07a465.
2026-04-27 18:14:01 +02:00
jbpenrath b04b07a465 fixup! (global) allow thread assignation 2026-04-23 20:21:20 +02:00
jbpenrath 267372520d (global) allow thread assignation
As a follow-up of the mention feature, we build upon ThreadEvent & UserEvent
models a feature to assign users to a thread.
We allow to filter mailboxe's inbox through assignation state (assigned to me, unassigned).
The thread share modal has been forked from ui-kit to be able to list users of each
mailbox and add a cta to assign them to the thread. A section above shows assigned users.
2026-04-22 20:21:31 +02:00
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
Jean-Baptiste PENRATHandGitHub 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 PENRATHandGitHub 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
Jean-Baptiste PENRATHandGitHub 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
Jean-Baptiste PENRATHandGitHub 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 PENRATHandGitHub 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
Jean-Baptiste PENRATHandGitHub 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 PENRATHandGitHub 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
Jean-Baptiste PENRATHandGitHub 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 PENRATHandGitHub 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
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 PENRATHandGitHub 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.
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