-
Notifications
You must be signed in to change notification settings - Fork 17
fix: use actual room versions instead of defaultRoomVersion everywhere
#407
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -61,7 +61,7 @@ export const internalRequestPlugin = (app: Elysia) => { | |
| roomId: RoomID; | ||
| sender: UserID; | ||
| }; | ||
| const version = (query.version as RoomVersion | undefined) || PersistentEventFactory.defaultRoomVersion; | ||
| const version = (query.version as RoomVersion | undefined) || (await federationSDK.getRoomVersion(roomId)); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. P2: The Prompt for AI agents |
||
| switch (eventType) { | ||
| case 'm.room.member': { | ||
| const event = await federationSDK.buildEvent<'m.room.member'>( | ||
|
|
@@ -203,7 +203,7 @@ export const internalRequestPlugin = (app: Elysia) => { | |
| '/internal/event/send', | ||
| async ({ body, query }) => { | ||
| const event = body as Pdu; | ||
| const version = (query.version as RoomVersion | undefined) || PersistentEventFactory.defaultRoomVersion; | ||
| const version = (query?.version as RoomVersion | undefined) || (await federationSDK.getRoomVersion(event.room_id)); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. P2: Same regression as the template endpoint: the Prompt for AI agents |
||
| if (!PersistentEventFactory.isSupportedRoomVersion(version)) { | ||
| throw new Error(`Room version ${version} is not supported`); | ||
| } | ||
|
|
@@ -219,7 +219,7 @@ export const internalRequestPlugin = (app: Elysia) => { | |
| }, | ||
| { | ||
| body: t.Any(), | ||
| query: t.Object({ version: t.String({ default: '10' }) }), | ||
| query: t.Optional(t.Object({ version: t.Optional(t.String()) })), | ||
| detail: { | ||
| tags: ['Devtools'], | ||
| summary: 'Send an event', | ||
|
|
||
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.
🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
Repository: RocketChat/homeserver
Length of output: 46182
🏁 Script executed:
Repository: RocketChat/homeserver
Length of output: 50378
Reject mismatched room versions after
makeJoin.When
knownRoomVersionis set, comparemakeJoinResponse.room_versionto the local room version before callingsendJoin.makeJoinonly passesverto the request, so a different remote response can still be parsed with the remote version instead of the stored local room state.🤖 Prompt for AI Agents