100 Commits
Author SHA1 Message Date
Sabrina DemagnyandGitHub 4e7a2a5db1 🔊(inbound) fix duplicate recipient creation errors (#496)
Inbound messages with duplicate recipient addresses are now handled gracefully, preventing duplicate recipient links and avoiding failures during import.
2026-01-24 22:07:25 +01:00
20538a41d0 Fix SSL error and improve authentication failure (#495)
* 🐛(importer) add STARTTLS support and enforce encrypted IMAP connections

- Add STARTTLS negotiation for port 143 with use_ssl=True
- Create IMAPSecurityError exception for security violations
- Refuse to continue unencrypted when SSL is required
- Check server STARTTLS capability before attempting upgrade
- Fail fast to prevent credential leakage on security downgrade

Connection behavior:
- Port 993 + use_ssl=True → SSL direct
- Port 143 + use_ssl=True → STARTTLS (mandatory)
- Port 143 + use_ssl=False → unencrypted (explicit choice)

Fixes: SSL WRONG_VERSION_NUMBER error on port 143

* 🐛(importer) improve IMAP connection and authentication error handling

Backend improvements:
- Catch SSL handshake failures during IMAP4_SSL connection
- Provide clear error message suggesting port 143 with STARTTLS
- Add authentication failure logging with username context
- Wrap login() in try-except to log auth errors before propagating

Frontend improvements:
- Detect "IMAP authentication failed" message in error responses
- Display user-friendly credential error message in UI

This helps users understand connection failures and authentication
issues with clearer, actionable error messages.

* 🐛(imap) add tests and small fixes in the handshake

* 🐛(imap) wrap all connection login in a try/finally for cleanup

---------

Co-authored-by: Sylvain Zimmer <sylvain@sylvainzimmer.com>
2026-01-24 22:02:55 +01:00
Sabrina Demagny ec4c7efc74 🔧(settings) by default activate message template 2026-01-16 10:06:32 +01:00
Sabrina Demagny 1899fd80d7 (signature) allow to create mailbox signature 2026-01-16 10:06:32 +01:00
Sabrina DemagnyandGitHub 0cb05d9e77 (scripts) add release automation script (#472)
Add a Python script to automate the release process:
- Validates semver version format
- Calculates next version automatically based on release kind
- Updates version in pyproject.toml, package.json and package-lock.json
- Updates CHANGELOG.md with release date
- Creates release branch and commits changes

Usage:
make release
or
bin/release.py --kind m --version ...
2026-01-12 00:37:16 +01:00
Sabrina Demagny 9b41c0b016 (e2e) fix date format change since 2026 2026-01-03 01:19:20 +01:00
Sabrina Demagny c993fce5db (changelog) initialize the changelog file 2025-11-18 15:43:50 +01:00
Sabrina Demagny b27dca2f16 🐛(draft) soften logging when draft save fails 2025-11-17 15:05:48 +01:00
Sabrina Demagny f2260a177a 🐛(permissions) resolve MultipleObjectsReturned when user has access to multiple mailboxes on same thread
The has_object_permission method was failing with MultipleObjectsReturned
exception when a user had access to multiple mailboxes that both have
access to the same thread.

Changes:
- Filter thread accesses by EDITOR role and check user mailbox permissions
- Use filter().exists() instead of get() to avoid MultipleObjectsReturned
- Add test case to verify users can send messages when they have access
  to multiple mailboxes on the same thread
2025-11-13 01:02:23 +01:00
Sabrina Demagny 9407271edc (import) improve folder import from OVH mailbox 2025-11-05 17:27:45 +01:00
Sabrina Demagny 83d84284ec 🐛(import) fix delivery status of MessageRecipient during import
- set delivery status to SENT for regular message
- keep delivery status to null for draft message
2025-11-05 14:17:09 +01:00
Sabrina Demagny 4df1efa45e 🐛(backend) fix thread opensearch pagination 2025-11-05 12:23:27 +01:00
Sabrina Demagny afcced7fdf 🐛(frontend) do not display delivering status if message is still draft 2025-11-03 13:25:15 +01:00
Sabrina Demagny 23356c5837 (backend) remove i18n location lines in .po files 2025-11-03 11:54:57 +01:00
Sabrina Demagny 802acc7bd1 💚(settings) lint 2025-11-01 16:13:14 +01:00
Sabrina Demagny b8c45323d1 🩹(template) remove pylint disable
Follow best practice to not use mutable default value as an argument
2025-11-01 12:13:23 +01:00
Sabrina Demagny 4d68cb4833 (contacts) add contacts from the same domain as selected mailbox to contacts endpoint 2025-10-31 14:06:28 +01:00
Sabrina Demagny f7ee9dcc47 (template) allow to insert recipient name in reply 2025-10-29 15:54:07 +01:00
Sabrina Demagny bcb6215d93 (template) add recipient name placeholder 2025-10-29 15:54:07 +01:00
Sabrina Demagny ee857da6cd (template) insert template into message 2025-10-23 11:14:26 +02:00
Sabrina Demagny bf77b07200 (template) allow to insert variable in message template 2025-10-20 17:58:15 +02:00
Sabrina Demagny 56f3b4c2fb (template) allow to insert signature in a message template 2025-10-17 00:22:01 +02:00
Sabrina Demagny 03a52f0056 (template) add view and modal to manage message template for a mailbox 2025-10-16 20:46:08 +02:00
Sabrina Demagny 08635bee52 (template) simplify message template type 2025-10-15 23:58:59 +02:00
Sabrina Demagny 0f0e4ddb94 (import) hide import button when user is not authorized 2025-10-14 10:59:27 +02:00
Sabrina Demagny 6e1dc402ae (import) add new mailbox ability to import messages 2025-10-14 00:03:55 +02:00
Sabrina Demagny ae1d9db95a (template) add new mailbox ability to manage message templates 2025-10-13 23:16:54 +02:00
Sabrina Demagny 58bfbd38da (template) add permissions check to manage mailbox message template 2025-10-09 21:35:49 +02:00
Sabrina Demagny 895efcfb5d (template) CRUD for mailbox message templates 2025-10-08 18:08:25 +02:00
Sabrina Demagny 2491e43957 (template) allow filtering by multiple types
Used in admin view to support managing different kinds of message templates
2025-10-07 19:17:40 +02:00
Sabrina Demagny 96d8d43025 ♻️(import) fix naming after refactor 2025-10-06 22:41:42 +02:00
Sabrina Demagny bc5181b925 🐛(import) manage timeout and retry imap connection
- add retry logic
- add two new settings to manage imap connection (timeout, max retry)
2025-10-06 21:27:52 +02:00
Sabrina Demagny 935cc7bcae 🩹(Signature) remove unnecessary wrap signature in paragraph 2025-10-02 22:35:45 +02:00
Sabrina DemagnyandGitHub 99c9e6565e 🐛(admin) restrict mailboxes seen by admin to those with explicit rights 2025-10-02 22:24:33 +02:00
Sabrina Demagny c0936d8c31 (Message) prevent log errors when duplicate emails exist in recipient list 2025-10-02 21:54:47 +02:00
Sabrina Demagny b73619fb15 (Message) truncate too long subject of inbound message 2025-10-02 21:15:58 +02:00
Sabrina Demagny 9bacfd24b6 (template) allow to create and use signature
- Allow to create and manage signature in admin interface
- Allow to insert signature in message editor
- Blob model must have at least a mailbox or maildomain

This commit introduces a complete email template system with support
for both HTML and text content, flexible relationships with mailboxes
and mail domains, and a RESTful API for template management.
2025-10-01 00:31:14 +02:00
Sabrina Demagny 29415e21a0 (tests) fix test retrieve eml and update open api schema 2025-09-29 19:41:06 +02:00
Sabrina Demagny 3dc8588b29 (blob) add size_compressed
Compute and store size compressed of blob.
2025-09-22 14:10:48 +02:00
Sabrina Demagny 9c31a95689 (outbound) fix flaky test 2025-09-19 18:52:39 +02:00
Sabrina Demagny b715fa7429 (import) add new support for messages
Fix labels import from Mailcow/Sogo
2025-09-19 18:51:20 +02:00
Sabrina Demagny 318a78333b 🐛(frontend) fix label text alignment in mailbox panel
This fixes the visual issue where labels with sub-labels had their text
shifted right compared to labels without sub-labels.
2025-09-04 11:06:38 +02:00
Sabrina Demagny 67a7c4e9c0 (api) add placeholders endpoint
This endpoint will be used for Signature and other message templates.
Update Dockerfile to include gettext for i18n compilation
2025-08-20 12:10:16 +02:00
Sabrina Demagny 64b9f96aa2 🐛(imap) handle missing Yahoo drafts import 2025-07-31 11:43:17 +02:00
Sabrina Demagny c7fb77b737 (frontend) remove max_messages and folder fields on imap import
Run 'make api-update'
2025-07-28 11:18:28 +02:00
Sabrina Demagny 6d6bbea0d9 (imap) improve IMAP import code, load folders for GMAIL and ORANGE
- Load folders for GMAIL and ORANGE
- Fix read issue with Gmail IMAP import (all messages were marked as read)
- Fix IMAP encoding for Gmail import
- Refactor monolithic import_imap_messages_task into smaller, focused functions
- Add IMAPConnectionManager context manager for better resource management
- Extract helper functions with single responsibilities

This refactoring improves code maintainability, readability, and testability
while maintaining backward compatibility with existing API.
2025-07-28 11:18:28 +02:00
Sabrina Demagny 03cd72f0fb 🐛(labels) support identical label slugs across different mailboxes
- Replace single label lookup with multiple labels filter in ThreadViewSet
- Allow filtering threads by label_slug across multiple mailboxes when user has access
- Expect empty results instead of 403 errors for inaccessible labels
- Add comprehensive tests for identical labels in different mailboxes scenarios

This change enables users with access to multiple mailboxes to filter threads
by label slug across all accessible mailboxes, while maintaining proper
permission checks and supporting mailbox-specific filtering.
2025-07-24 12:47:27 +02:00
Sabrina Demagny 65af318fb5 (backend) add get_abilities for Mailbox
- Add pre-calculation of user access roles in MailboxViewSet list/retrieve methods
- Implement get_abilities method on Mailbox model for permission checking
- Add AbilitiesModelSerializer to MailboxSerializer for consistent abilities field
- Optimize database queries by reducing N+1 access lookups
- Add comprehensive test coverage for abilities and optimized queries

This optimization significantly reduces database queries when listing
mailboxes by pre-calculating user roles instead of querying for each
mailbox individually.
2025-07-22 09:34:09 +02:00
Sabrina Demagny 73d0f7476d 🐛(labels) implement cascading label rename with hierarchical tree fix
- Add cascading rename functionality to Label model save method
- Update all child labels when parent label is renamed
- Clean up orphaned parent labels that are no longer referenced
- Fix hierarchical tree construction in LabelViewSet list method
- Handle orphaned child labels by treating them as root labels
- Add comprehensive test for parent label rename scenarios

This ensures that when a parent label is renamed, all its children
are automatically updated to maintain the hierarchy, and the API
correctly displays all labels even when some parents are missing.
Fix #278
2025-07-17 17:17:49 +02:00
Sabrina Demagny 84369c9d48 (models) improve MessageRecipient string representation
Replace raw type value with human-readable display name in __str__ method
using get_type_display() for better debugging and logging output.
2025-07-16 01:34:55 +02:00
Sabrina Demagny ffa361f5f9 🐛(draft) handle MessageRecipient constraint error in draft API
Prevents 400 Bad Request error when there are simultaneous updating draft
Fixes the constraint error "Un objet Message recipient avec ces champs Message, Contact et Type existe déjà".
2025-07-16 01:34:55 +02:00
Sabrina Demagny e1940295dc (api) add dynamic abilities field to MailDomain API
- Add get_abilities() method to MailDomain model for permission-based abilities
- Update MailDomainAdminSerializer to inherit from AbilitiesModelSerializer
- Add RetrieveModelMixin to MailDomainAdminViewSet for detail endpoints
- Optimize queries with JOIN and annotation for regular users
- Add prefetch_related for superusers to avoid N+1 queries
- Add comprehensive tests for abilities functionality and query optimization
- Add new test file for MailDomain model abilities

The abilities field dynamically controls user permissions based on their role
in the mail domain, with optimized database queries to maintain performance.
2025-07-11 12:36:20 +02:00
Sabrina Demagny b1daf05da6 (api) add AbilitiesModelSerializer with exclude_abilities option
- Create AbilitiesModelSerializer base class that dynamically controls abilities field inclusion
- Refactor UserSerializer to inherit from AbilitiesModelSerializer
- Add exclude_abilities parameter to prevent abilities serialization in nested contexts
- Update MailboxAccessReadSerializer and MailboxAccessNestedUserSerializer to exclude abilities when nested
- Remove abilities from UserSerializer Meta fields as it's now handled dynamically
2025-07-10 17:18:55 +02:00
Sabrina Demagny f3b5cccf5d (api) Allow superuser+staff to view all mail domains in admin API
- Add condition in MailDomainAdminViewSet.get_queryset() to return all domains
  when user is both superuser and staff
- Add comprehensive tests covering all user permission combinations:
  * superuser + staff: can see all domains
  * superuser only: cannot see all domains (empty list)
  * staff only: cannot see all domains (empty list)
  * staff with domain access: can only see accessible domains
- Maintain existing behavior for regular users and domain admins

This change ensures that superusers with staff privileges have full
administrative access to all mail domains through the admin API,
while maintaining proper access control for other user types.
2025-07-10 15:45:44 +02:00
Sabrina Demagny d3df815d1f (backend) add user abilities system for mail domain permissions
- Add get_abilities() method to User model to determine user permissions
- Add abilities field to UserSerializer to expose permissions via API
- Implement permission logic for create_maildomains and view_maildomains
- Add comprehensive tests for User model abilities method
- Add integration tests for abilities field in users/me endpoint
- Support superuser+staff, mail domain access, and regular user scenarios

The abilities system provides granular permission control for mail domain
operations, allowing the frontend to adapt UI based on user capabilities.
2025-07-10 14:34:49 +02:00
Sabrina Demagny 3c876de608 (backend) add MailDomainAccess admin interface
Add dedicated admin interface for MailDomainAccess model to improve
domain access management in Django admin.

- Register MailDomainAccessAdmin
- Add MailDomainAccessInline for embedded editing on MailDomainAdmin
2025-07-09 16:36:55 +02:00
Sabrina Demagny c4589f2f7c 💚(lint) execute forgotten make lint command 2025-07-08 12:23:17 +02:00
Sabrina Demagny 260b27f6e0 (api) add multi-word search on contact name and email
- Add ability to search contacts by multiple keywords (AND logic)
  on name and email, in contacts endpoint.
- Adapt and enrich tests to cover multi-word search,
  case sensitivity, and name/email combination.
2025-07-08 12:23:17 +02:00
Sabrina Demagny 81f5f7c42d (backend) add comprehensive tests for label alphabetical ordering
- Add API tests for label ordering by slug in hierarchical structure
- Add model tests for Label ordering configuration and behavior
- Test ordering with numbers, accents, and mixed case scenarios
- Verify alphabetical ordering across multiple mailboxes
- Ensure consistent ordering behavior for hierarchical labels
2025-07-07 08:13:41 +02:00
Sabrina Demagny 32e821767c 🐛(backend) make message subject optional
- Add null=True, blank=True to Message and Thread subject fields
- Add comprehensive tests for empty/null/missing subjects
- Update migration 0018 to alter subject field constraints
- Fix #161: allow messages without subject field
2025-07-07 08:13:41 +02:00
Sabrina DemagnyandGitHub 76386d03e7 Merge pull request #175 from suitenumerique/sdem/fix_labels_ordering
🐛(api) correct alphabetical sorting of labels with accented characters
2025-06-24 20:05:35 +02:00
Sabrina Demagny 604f7121a2 🐛(api) correct alphabetical sorting of labels with accented characters
- Change label sorting from name-based to slug-based ordering in list view
- Use slug ordering for initial queryset to ensure consistent sorting
- Maintain name-based sorting in create method for consistency
- Fixes issue where "État civil et cimetière" appeared at the end

The slug-based sorting provides more predictable alphabetical ordering
since slugs are normalized versions of names without accents.
2025-06-24 17:31:57 +02:00
Sabrina Demagny e444b600aa 🐛(backend) parse Gmail labels with commas correctly using regex
Replace simple comma splitting with regex that respects quoted strings
to prevent labels like "Culture, associations, événements" from being
split incorrectly.
2025-06-23 11:44:23 +02:00
Sabrina Demagny 1688ef70f7 💚(lint) run make lint 2025-06-23 11:44:23 +02:00
Sabrina Demagny f3dfb24077 (backend) implement cascading deletion for labels
- Add delete() method to Label model to handle cascading deletion of child labels
- When a parent label is deleted, all child labels (e.g., "Work/Projects") are automatically deleted
- Implement proper logging for debugging deletion operations
- Add comprehensive tests for cascading deletion scenarios:
  - Deleting parent label deletes all children
  - Deleting child label doesn't affect parent
  - Deleting label without children works normally
  - Model-level deletion works independently of API

This ensures consistent deletion behavior across all interfaces (API, admin, programmatic)
and maintains referential integrity when deleting hierarchical label structures.
2025-06-20 14:41:17 +02:00
Sabrina Demagny b2b71cc405 🐛(api) fix partial update of label 2025-06-20 00:15:35 +02:00
Sabrina DemagnyandJean-Baptiste PENRATH eee7afa65c (backend) upload blob for eml and mbox import 2025-06-20 00:13:50 +02:00
Sabrina Demagny 6046988c1b (backend) import label gmail from mbox
Add comprehensive Gmail label import functionality for mbox files with
support for both English and French Gmail labels.

Features:
- Map Gmail system labels to internal message flags (is_draft, is_sender, is_starred, etc.)
- Handle read/unread status from Gmail labels (Ouvert/Opened, Non lus/Unread)
- Create user labels for non-system Gmail labels
- Support hierarchical labels with proper parent/child relationships
- Ignore Gmail system labels that shouldn't be created as user labels
- Special handling for sent/draft messages (automatically marked as read)

Test coverage:
- Label creation and flag mapping for both languages
- UTF-8 encoded label handling
- Hierarchical label structure validation
- Read/unread status verification
- Authentication and authorization requirements
- Thread statistics updates

This enables proper import of Gmail labels when processing mbox files, maintaining the
original label structure while mapping system labels to appropriate internal flags.
2025-06-19 13:54:36 +02:00
Sabrina Demagny ce945259c8 💚(lint) run make lint
A `make lint` run was forgotten in the last commit
2025-06-19 13:45:09 +02:00
Sabrina Demagny e18732bb47 ♻️(labels) move parent labels creation logic
Put the logic into Label model's save() method to guarantee the invariant always holds,
even when using the admin interfacee uses, the shell, bulk operations, or any code path.
2025-06-18 11:21:03 +02:00
Sabrina Demagny a500eadde8 💚(api): ensure consistent thread ordering in list endpoint
- Add secondary ordering by created_at to prevent flaky test results
- When threads have the same messaged_at value, order by newest created_at first
- Ensures deterministic API responses for better test reliability
2025-06-17 19:47:53 +02:00
Sabrina Demagny bc20950749 (frontend): display labels on thread list view
- Added LabelBadge component to render labels as colored badges in the thread list and thread view.
- Updated Thread and Label models to support label objects and color.
- Styled label badges and thread item label container for better visual integration.
- Integrated label display in thread list
2025-06-17 19:10:15 +02:00
Sabrina Demagny ad179ee258 (api) allow to list threads by label
Add the ability to filter threads by label slug in the thread list endpoint. This feature
enables users to view all threads associated with a specific label.

Changes:
- Add label_slug query parameter to ThreadViewSet list endpoint
- Implement label-based filtering with proper permission checks
- Add OpenAPI documentation for the new label_id parameter
- Add comprehensive test suite for label filtering

Technical details:
- Filter threads by label while ensuring user has access to the label's mailbox
- Support combining label filter with existing filters (mailbox, search, etc.)
- Add proper error handling for invalid or inaccessible labels
- Add test coverage for various filtering scenarios:
  - Single label filtering
  - Combined label and mailbox filtering
  - Invalid label handling
  - Permission checks
  - Combined filters (label + unread/starred status)
2025-06-16 15:54:41 +02:00
Sabrina Demagny 6d11b9fef5 🐛(backend) fix task response returned
Ensure consistent state reporting across import task updates
2025-06-16 14:35:27 +02:00
Sabrina Demagny b51fa58553 🐛(backend) prevent duplicate threads during message import
Avoid duplicate threads when importing the same file multiple times.

Changes:
- Moved duplicate message check to the start of deliver_inbound_message
- Maintains proper threading relationships while preventing duplicate threads

This ensures that:
- No duplicate threads are created when importing the same file multiple times

Test coverage:
- Updated existing import tests to check thread counts
- Verified that duplicate imports don't create new threads
2025-06-15 21:54:00 +02:00
Sabrina Demagny 2ff790afb1 (api) add endpoints to manage labels
This commit implements a complete label management system with the following features:

- Add CRUD operations for labels with hierarchical support (using slash-based naming)
- Implement label-thread associations (add/remove threads to/from labels)
- Add comprehensive permission checks (ADMIN/EDITOR roles required for management)
- Support hierarchical label structure with automatic parent creation
- Add color customization for labels
- Implement proper slug generation for label names
- Add extensive test coverage for all label operations

Technical details:
- New LabelViewSet with list, create, update, delete operations
- Custom actions for thread management (add-threads, remove-threads)
- Hierarchical label structure with parent-child relationships
- Automatic parent label creation when creating nested labels
- Proper permission handling based on mailbox access roles
- Comprehensive test suite covering all edge cases
- OpenAPI documentation for all endpoints
2025-06-15 18:18:31 +02:00
Sabrina Demagny 69d33de225 (backend) prevent duplicate message imports
Add duplicate message detection to prevent importing the same email multiple times
into the same mailbox. This improves data integrity and prevents unnecessary
duplication of messages.

Changes:
- Add MIME ID-based duplicate detection in deliver_inbound_message
- Skip duplicate messages gracefully with informative logging
- Allow same message to exist in different mailboxes
- Add comprehensive test suite for duplicate detection

Technical details:
- Uses message MIME ID as unique identifier for duplicate detection
- Scopes duplicate check to individual mailboxes
- Returns success for duplicate handling to maintain API consistency
- Adds tests for EML, MBOX, IMAP and cross-mailbox scenarios

This change ensures that:
- Users can't accidentally import the same email twice
- Each mailbox maintains a single copy of each message
- The same message can still exist in different mailboxes
- Import operations remain idempotent
2025-06-15 16:14:42 +02:00
Sabrina Demagny c297137bf4 (backend) improve MBOX file import compatibility
Enhance support for MBOX files from various email export tools by handling
both extensionless files and text/plain MIME type. This improves compatibility
with different export formats while maintaining security through proper
validation.

Changes:
- Add support for files named "mbox" without extension
- Allow text/plain MIME type for MBOX files (common in webmail exports)
- Keep application/mbox as the primary MIME type for MBOX files
- Update validation to check both MIME types and file extensions
- Add test cases for extensionless files and text/plain MIME type
- Update error messages to be more descriptive about supported formats

The validation now handles:
- Files with .mbox extension (application/mbox or text/plain MIME type)
- Files named "mbox" without extension
- Maintains strict validation to ensure text/plain is only accepted for MBOX files

This change improves compatibility with various email export tools and webmail
services while maintaining security through proper file validation.
2025-06-15 15:13:38 +02:00
Sabrina Demagny c7e0609263 (backend) enhance the response for all types of imports
The response should be as follows:

{
    "status": "PROGRESS|SUCCESS|FAILURE",
    "result": {
        "message_status": str,  # Descriptive status message
        "total_messages": int,  # Total number of messages to process
        "success_count": int,   # Number of successfully processed messages
        "failure_count": int,   # Number of failed messages
        "type": str,           # "mbox", "eml", or "imap"
        "current_message": int  # Current message being processed
    },
    "error": str | None       # Error message if any
}

For example:
{
    "status": "PROGRESS",
    "result": {
        "message_status": f"Processing message {i} of {total}",
        "total_messages": total,
        "success_count": success_count,
        "failure_count": failure_count,
        "type": "mbox|eml|imap",
        "current_message": i,
    },
    "error": None,
}

{
    "status": "SUCCESS",
    "result": {
        "message_status": "Completed processing messages",
        "total_messages": total,
        "success_count": success_count,
        "failure_count": failure_count,
        "type": "mbox|eml|imap",
        "current_message": current,
    },
    "error": None,
}

{
    "status": "FAILURE",
    "result": {
        "message_status": "Failed to process messages",
        "total_messages": total,
        "success_count": success_count,
        "failure_count": failure_count,
        "type": "mbox|eml|imap",
        "current_message": current,
    },
    "error": error_message,
}
2025-06-14 22:24:27 +02:00
Sabrina Demagny 33a3195b17 (backend) add task progress tracking during MBOX import
Use similar logic to IMAP import
2025-06-12 15:45:17 +02:00
Sabrina Demagny 761784e91c (backend) use a celery task for eml import
Unify the import implementations to use celery task (eml, mbox, imap)
Same returns for all import tasks.
Update openapi schema.
2025-06-11 23:53:48 +02:00
Sabrina Demagny 55c3f2a081 👽️(api) fix openapi schema for import message
Fix and re-generate schema
2025-06-11 23:32:51 +02:00
Sabrina Demagny c603350703 (api) add labels info on Thread
Add details of labels info on thread list
2025-06-11 09:38:56 +02:00
Sabrina Demagny 4dbf2a575c 🐛(manage) fix es_reindex failure
Problem:
When running python manage.py es_reindex --all, it was trying to save task progress to the database
This caused an error because there was no task ID (since it wasn't a real Celery task)
The error was: null value in column "task_id" of relation "django_celery_results_taskresult"

Fix:
We split the reindexing code into two parts:
_reindex_all_base: A regular Python function that does the actual reindexing
reindex_all: A Celery task that wraps the base function

Now:
-> When you run python manage.py es_reindex --all (synchronous):
  - It uses _reindex_all_base directly
  - Shows progress in the console like: "Progress: 50/100 threads processed (45 succeeded, 5 failed)"
  - No database updates are attempted
-> When you run python manage.py es_reindex --all --async (asynchronous):
  - It uses the Celery task reindex_all
  - Progress is saved to the database
  - You can monitor progress through Celery's task monitoring

Before: The same code was trying to work both ways, causing errors
After: We have separate code paths for synchronous and asynchronous execution
2025-06-10 17:21:19 +02:00
Sabrina Demagny 78e3740686 (backend) add Label model to organize threads
Create new model Label.
Add django admin interfaces.
2025-06-10 14:50:09 +02:00
Sabrina Demagny 55a7b1e49f (api) add endpoints to import messages
Refactor code to import messages and add endpoints to import messages
(.eml, .mbox, imap)
2025-06-05 18:23:10 +02:00
Sabrina Demagny d39932c353 💚(backend) fix lint and collectstatic needed
Fix lint failures and run collectstatic
before running tests
2025-06-02 16:47:29 +02:00
Sabrina Demagny 4cf68e94c5 🐛(backend) fix messaged_at date for import from eml file
Behavior should be identical to other imports (mbox, imap).
We should override created_at of message
2025-06-02 14:55:17 +02:00
Sabrina Demagny 1b74524ee4 (backend) allow importing messages via IMAP
Add new admin button to import messages via IMAP.
All to limit number of messages and define folder name.
2025-06-02 14:44:20 +02:00
Sabrina Demagny b801afd904 (backend) allow to upload mbox file to import messages
Allow to upload new kind of import file (.mbox) in admin interface.
2025-06-02 14:44:20 +02:00
Sabrina Demagny 17d1b0e1ac (backend) allow to upload eml file to import messages
Add new button on admin interface to upload message with eml file.
Create new message from eml.
2025-05-20 09:29:07 +02:00
Sabrina Demagny 3e98509dcc (api) add endpoint to search Mailboxes
Allow to search Mailboxes from same domain of a context Mailbox.
2025-05-20 01:25:49 +02:00
Sabrina Demagny 7d8500ac22 (backend) link a Mailbox to a Contact instance
Add FK to Contact on Mailbox model.
Display name of mailbox contact into list accesses of a thread
2025-05-19 20:24:22 +02:00
Sabrina Demagny 2c2eb3a39b Revert "(backend) enhance Mailbox model to add a display name"
This reverts commit c5d1ee220e.
2025-05-19 14:45:26 +02:00
Sabrina Demagny c5d1ee220e (backend) enhance Mailbox model to add a display name
Add an optional name field
2025-05-19 13:04:26 +02:00
Sabrina Demagny 65db4fddad (api) enhance Thread serializer to return thread accesses
Add list of thread accesses into Thread serializer
2025-05-19 12:55:05 +02:00
Sabrina Demagny eca469e666 (api) add endpoint to manage ThreadAccess
Allows creating, updating, and deleting access to threads based on
user role.
2025-05-16 12:18:14 +02:00
Sabrina Demagny a99b2a0fae 🐛(backend) fix bcc lost after updated draft
Enhance and fix check to allow bcc displaying. Fix #85
2025-05-14 20:35:49 +02:00
Sabrina Demagny 11ffc48ead 🐛(backend) update thread stats after message hard delete
Call update_stats after delete one of thread's messages. Fixes #84.
2025-05-14 18:16:10 +02:00
Sabrina DemagnyandGitHub 84f95bf52a (backend) use ThreadAccess instead of direct mailbox link (#80)
* (backend) use ThreadAccess instead of direct mailbox link

Remove the direct link to a mailbox on Thread model. It is now possible to
define two types of roles for each thread (Reader and Editor) for a mailbox.
When creating a new thread, a new access to the sender's mailbox is created
with the Editor role.
It is now possible to delegate a thread to another mailbox with the Reader or
Editor role. So it is possible to forward a thread to another internal user
and avoid mail forwarding.

* (backend) change MailboxAccess permission into roles

Enhance access on mailbox and thread with role everywhere!

* improve doc

* enhance tests

* lint
2025-05-12 21:29:06 +02:00