-
Notifications
You must be signed in to change notification settings - Fork 20
chore: state management DTOs and update profiles controller types #195
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
Merged
Merged
Changes from all commits
Commits
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| import { type Static, t } from 'elysia'; | ||
| import { RoomIdDto } from '../common/validation.dto'; | ||
|
|
||
| export const GetStateIdsParamsDto = t.Object({ | ||
| roomId: RoomIdDto, | ||
| }); | ||
|
|
||
| export const GetStateIdsQueryDto = t.Object({ | ||
| event_id: t.String({ description: 'Event ID to get state at' }), | ||
| }); | ||
|
|
||
| export const GetStateIdsResponseDto = t.Object({ | ||
| pdu_ids: t.Array(t.String(), { description: 'List of state event IDs' }), | ||
| auth_chain_ids: t.Array(t.String(), { | ||
| description: 'List of auth chain event IDs', | ||
| }), | ||
| }); | ||
|
|
||
| export type GetStateIdsParams = Static<typeof GetStateIdsParamsDto>; | ||
| export type GetStateIdsQuery = Static<typeof GetStateIdsQueryDto>; | ||
| export type GetStateIdsResponse = Static<typeof GetStateIdsResponseDto>; |
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,23 @@ | ||
| import { type Static, t } from 'elysia'; | ||
| import { RoomIdDto } from '../common/validation.dto'; | ||
|
|
||
| export const GetStateParamsDto = t.Object({ | ||
| roomId: RoomIdDto, | ||
| }); | ||
|
|
||
| export const GetStateQueryDto = t.Object({ | ||
| event_id: t.String({ description: 'Event ID to get state at' }), | ||
| }); | ||
|
|
||
| export const GetStateResponseDto = t.Object({ | ||
| pdus: t.Array(t.Record(t.String(), t.Any()), { | ||
| description: 'List of state event objects', | ||
| }), | ||
| auth_chain: t.Array(t.Record(t.String(), t.Any()), { | ||
| description: 'List of auth chain event objects', | ||
| }), | ||
| }); | ||
|
|
||
| export type GetStateParams = Static<typeof GetStateParamsDto>; | ||
| export type GetStateQuery = Static<typeof GetStateQueryDto>; | ||
| export type GetStateResponse = Static<typeof GetStateResponseDto>; |
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
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.
💡 Verification agent
🧩 Analysis chain
Don’t widen membership for make_join; it should be 'join' only
The event template returned by make_join must carry membership 'join'. Allowing other values here weakens validation.
Apply this diff (keep MembershipDto for other contexts, but restrict this field):
Also applies to: 91-91
🌐 Web query:
💡 Result:
Yes. The make_join response's event.template content.membership is required to be "join". See the Server‑Server API /make_join response which specifies the event.content.membership must be the value "join". [1][2]
Sources:
[1] Matrix spec — Server‑Server API, GET /_matrix/federation/v1/make_join (response “event” / Membership Event Content). [2] Matrix legacy federation doc — /make_join (shows example and membership = "join").
Don’t widen membership for make_join; restrict to 'join'
Matrix /make_join requires event.template.content.membership === "join" — restrict the DTO accordingly.
File: packages/homeserver/src/dtos/federation/profiles.dto.ts (lines 79-86; also applies to line 91)
Apply this diff (keep MembershipDto for other contexts, but restrict this field):
🤖 Prompt for AI Agents