-
Notifications
You must be signed in to change notification settings - Fork 29
✨ Expand thread-list rows to show per-message summaries #757
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
nicolasaunai
wants to merge
15
commits into
suitenumerique:main
Choose a base branch
from
nicolasaunai:feature/thread-dropdown-expand
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
9b5ecee
✨(backend) expose message_count on Thread
nicolasaunai 0f19382
✨(backend) add Message.snippet field
nicolasaunai d4eda4f
✨(inbound) persist a per-message snippet at creation
nicolasaunai 1fa98af
✨(outbound) persist a per-message snippet on send
nicolasaunai 6acfb1d
🐛(autoreply) persist the snippet computed by compose_and_sign_mime
nicolasaunai cd5645c
🐛(autoreply) assert the exact snippet value, not just non-emptiness
nicolasaunai e20adee
✨(backend) add MessageSummarySerializer
nicolasaunai 1caea4c
✨(backend) add ?summary=true to the messages list endpoint
nicolasaunai de4bea3
✨(frontend) add expand/collapse chevron to thread-list rows
nicolasaunai 3425969
✨(frontend) add useMessageSummaries hook
nicolasaunai 83a7851
✨(frontend) render per-message summary rows in the expand dropdown
nicolasaunai 6c8dcc2
🐛(thread-view) re-run hash deep-link scroll on hash change, not just …
nicolasaunai 111207c
🧪(thread-view) assert scroll call count, not a highlight class, in th…
nicolasaunai 8b67ea9
🎨(backend) fix lint findings from make lint-back
nicolasaunai 06bf1d0
🐛(frontend) preserve active filters when navigating from a message su…
nicolasaunai File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| # Generated by Django 5.2.11 on 2026-07-20 21:23 | ||
|
|
||
| from django.db import migrations, models | ||
|
|
||
|
|
||
| class Migration(migrations.Migration): | ||
|
|
||
| dependencies = [ | ||
| ('core', '0032_inboundmessage_blob_envelope'), | ||
| ] | ||
|
|
||
| operations = [ | ||
| migrations.AddField( | ||
| model_name='message', | ||
| name='snippet', | ||
| field=models.TextField(blank=True, verbose_name='snippet'), | ||
| ), | ||
| ] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
54 changes: 54 additions & 0 deletions
54
src/backend/core/tests/api/test_message_summary_serializer.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,54 @@ | ||
| """Test MessageSummarySerializer.""" | ||
|
|
||
| import pytest | ||
|
|
||
| from core import factories | ||
| from core.api.serializers import MessageSummarySerializer | ||
|
|
||
|
|
||
| @pytest.mark.django_db | ||
| class TestMessageSummarySerializer: | ||
| """MessageSummarySerializer must expose only the lightweight summary fields.""" | ||
|
|
||
| def test_serializes_expected_fields(self): | ||
| """Only id/sender/sent_at/is_unread/has_attachments/snippet are exposed.""" | ||
| message = factories.MessageFactory( | ||
| snippet="Hello preview", | ||
| has_attachments=True, | ||
| ) | ||
|
|
||
| data = MessageSummarySerializer(message).data | ||
|
|
||
| assert set(data.keys()) == { | ||
| "id", | ||
| "sender", | ||
| "sent_at", | ||
| "is_unread", | ||
| "is_draft", | ||
| "has_attachments", | ||
| "snippet", | ||
| } | ||
| assert data["id"] == str(message.id) | ||
| assert data["snippet"] == "Hello preview" | ||
| assert data["has_attachments"] is True | ||
| assert data["sender"]["email"] == message.sender.email | ||
|
|
||
| def test_is_unread_defaults_false_without_annotation(self): | ||
| """Falls back to False when the queryset wasn't annotated with _is_unread.""" | ||
| message = factories.MessageFactory() | ||
|
|
||
| data = MessageSummarySerializer(message).data | ||
|
|
||
| assert data["is_unread"] is False | ||
|
|
||
| def test_does_not_touch_blob_storage(self, monkeypatch): | ||
| """Serializing must never call get_parsed_data() (blob fetch + MIME parse).""" | ||
| message = factories.MessageFactory(snippet="Already computed") | ||
|
|
||
| def fail_if_called(*args, **kwargs): | ||
| raise AssertionError("MessageSummarySerializer must not parse the blob") | ||
|
|
||
| monkeypatch.setattr(type(message), "get_parsed_data", fail_if_called) | ||
|
|
||
| serialized = MessageSummarySerializer(message).data # must not raise | ||
| assert serialized["snippet"] == "Already computed" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win
Avoid storing English UI text in the database.
Using
"(No snippet available)"bakes localized UI text directly into the database, making it impossible for the frontend to translate this fallback state for non-English users. It's also inconsistent withoutbound.py, which correctly falls back to"".Consider falling back to an empty string
""and letting the frontend display the appropriate localized text when a snippet is missing.♻️ Proposed fix
snippet=thread_snippet( parsed_email, - fallback=subject or "(No snippet available)", + fallback=subject or "", ),📝 Committable suggestion
🤖 Prompt for AI Agents