Skip to content

feat(api): sync dialog list interfaces (last_message, participants, search)#4

Merged
lxnewayfarer merged 3 commits into
masterfrom
feat/list-by-object-archived-filter
Jun 8, 2026
Merged

feat(api): sync dialog list interfaces (last_message, participants, search)#4
lxnewayfarer merged 3 commits into
masterfrom
feat/list-by-object-archived-filter

Conversation

@lxnewayfarer
Copy link
Copy Markdown
Collaborator

@lxnewayfarer lxnewayfarer commented Jun 8, 2026

Summary

Synchronizes the response shape of the two dialog-list endpoints —
GET /api/v1/dialogs and GET /api/v1/dialogs/by-object/{type}/{id}/list — so
both expose the same per-dialog data, and adds a search filter to the
by-object list endpoint to match GET /api/v1/dialogs.

Both endpoints now return a full last_message object and a full participants
list (previously only last_message_at timestamp and participants_count).

Security note: last_message contains message content, so it is returned
only for dialogs the user participates in. For available/can-join
dialogs it is omitted, preserving the v0.3.7 "no reading before join" rule.
participants is not sensitive and is returned for can-join dialogs too.

Verification note: Backend cargo fmt/clippy/test were not run
Rust/cargo is unavailable in the dev environment used for this change. The
backend was verified by close code review only (verdict: compiles, clippy-clean).
Please rely on CI for the authoritative cargo checks. Frontend npm run typecheck passed and vitest is green (77/77).

Changes

  • Add last_message (full object: id, content, sender_id, sender_name,
    sent_at, message_type) and participants (user_id, display_name,
    company) to DialogResponse, populated in list_dialogs,
    list_dialogs_by_object, and get_dialog_by_object.
  • Gate last_message on participation: hidden for available/can-join dialogs.
  • Add search query param to the by-object /list endpoint (dialog title OR
    participant company, case-insensitive ILIKE).
  • New batch repository methods get_last_message_batch (DialogRepository) and
    list_by_dialogs_batch (ParticipantRepository) to avoid N+1.
    find_all_by_object_for_user gains archived + search parameters.
  • Retain last_message_at and participants_count for backward compatibility.
  • Frontend SDK: DialogListItem gains last_message/participants (new
    LastMessage / ParticipantSummary interfaces); getDialogsByObject accepts
    an optional search argument.
  • Integration tests: last_message/participants presence on both endpoints,
    by-object search filter, and a can-join content-hiding security boundary test.
  • Documentation (en + ru) and CLAUDE.md changelog updated.

Related Issues

N/A

Checklist

  • Code follows existing style conventions
  • cargo fmt and cargo clippy pass (backend changes) — not run locally (cargo unavailable); verified by review, relying on CI
  • npm run typecheck and npm run build pass (frontend changes)
  • Tests added or updated for new functionality
  • Documentation updated if applicable
  • Commit messages follow Conventional Commits format

…earch)

Synchronize the response shape of GET /api/v1/dialogs and
GET /api/v1/dialogs/by-object/{type}/{id}/list so both expose the same
per-dialog data, and add a search filter to the by-object list endpoint.

- Add full `last_message` object and `participants` list to DialogResponse,
  populated in list_dialogs, list_dialogs_by_object, and get_dialog_by_object.
- `last_message` (message content) is returned only to actual participants;
  hidden for available/can-join dialogs to preserve the v0.3.7 "no reading
  before join" rule. `participants` is not sensitive and is always returned.
- Add `search` query param to the by-object /list endpoint (title OR
  participant company, case-insensitive), matching GET /api/v1/dialogs.
- New batch repo methods get_last_message_batch and list_by_dialogs_batch
  avoid N+1; find_all_by_object_for_user gains archived + search params.
- Frontend SDK: DialogListItem gains last_message/participants (new
  LastMessage/ParticipantSummary types); getDialogsByObject accepts search.
- Integration tests for last_message, participants, search, and the
  can-join content-hiding security boundary. Docs (en/ru) + changelog.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@lxnewayfarer lxnewayfarer requested a review from pohodnya June 8, 2026 14:59
Andrey Dolgikh and others added 2 commits June 8, 2026 19:42
Add optional type=participating|available query param to
GET /api/v1/dialogs/by-object/{type}/{id}/list, mirroring
GET /api/v1/dialogs. Omitted returns both branches (unchanged,
backward compatible); invalid value returns 400. type=available
ignores the archived filter since potential dialogs have no
per-user archived state.

find_all_by_object_for_user gains a dialog_type param toggling the
participant / potential EXISTS branches via two bound flags, keeping
the single-query no-N+1 shape. SDK getDialogsByObject accepts an
optional type argument.

Also reformats the existing list-by-object tests via cargo fmt to
fix the Rust Format CI check.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Adding the dialog_type param pushed the arg count past clippy's
threshold. Apply the same #[allow(clippy::too_many_arguments)] used
elsewhere in the codebase (e.g. create_test_dialog).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@lxnewayfarer lxnewayfarer merged commit e1f69c2 into master Jun 8, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant