Consolidate Synpase admin room details schema. (#907)

Change comes from mps-for-bot-sdk. We're not trusting the room list
or the room details endpoint anymore.
This commit is contained in:
Gnuxie authored and GitHub committed 2025-06-19 18:14:00 +01:00
1 parent f72c7fc0c8
commit 1cc6a9162b
4 files changed
+25 -8

No files matched your search

+1 -1
View File
@@ -64,7 +64,7 @@
"matrix-appservice-bridge": "^10.3.1",
"matrix-bot-sdk": "npm:@vector-im/matrix-bot-sdk@^0.7.1-element.6",
"matrix-protection-suite": "npm:@gnuxie/matrix-protection-suite@3.6.1",
"matrix-protection-suite-for-matrix-bot-sdk": "npm:@gnuxie/matrix-protection-suite-for-matrix-bot-sdk@3.6.2",
"matrix-protection-suite-for-matrix-bot-sdk": "npm:@gnuxie/matrix-protection-suite-for-matrix-bot-sdk@3.6.3",
"pg": "^8.8.0",
"yaml": "^2.3.2"
},
@@ -31,7 +31,7 @@ export class SynapseAdminRoomDetailsProvider implements RoomDetailsProvider {
} else {
return Ok({
name: detailsResponse.ok?.name ?? undefined,
creator: detailsResponse.ok?.creator,
creator: detailsResponse.ok?.creator ?? undefined,
avatar: detailsResponse.ok?.avatar ?? undefined,
topic: detailsResponse.ok?.topic ?? undefined,
joined_members: detailsResponse.ok?.joined_members ?? undefined,
@@ -4,8 +4,8 @@
import { isError, Ok, Result } from "@gnuxie/typescript-result";
import {
roomIDServerName,
StringRoomID,
userServerName,
} from "@the-draupnir-project/matrix-basic-types";
import {
Logger,
@@ -23,6 +23,23 @@ export type RoomToCheck = {
details?: RoomBasicDetails | undefined;
};
/**
* Currently the store is polluted because of https://github.com/element-hq/synapse/issues/18563
* Because of the fallout of this bug, there will be room details polluted in the following way:
*
* 1. empty string for `server`.
* 2. empty string for `creator`.
*
* To cleanup, we probably need to destroy the details table entirely
* and create a table for the server responsible for creating the room derived
* from the room_id.
* Then later if we find a way of obtaining the creator, we can store that
* instead.
*
* The reason why this didn't happen in the first place is because we thought
* that the creator would always be available and we would always derive the
* server from the creator.
*/
export class StandardDiscoveredRoomStore
extends EventEmitter
implements RoomDiscovery
@@ -62,7 +79,7 @@ export class StandardDiscoveredRoomStore
const storeResult = await this.hashStore.storeRoomIdentification({
creator: details.creator,
roomID: details.room_id,
server: userServerName(details.creator),
server: roomIDServerName(details.room_id),
});
if (isError(storeResult)) {
log.error(
+4 -4
View File
@@ -2598,10 +2598,10 @@ matrix-appservice@^2.0.0:
request-promise "^4.2.6"
sanitize-html "^2.11.0"
"matrix-protection-suite-for-matrix-bot-sdk@npm:@gnuxie/matrix-protection-suite-for-matrix-bot-sdk@3.6.2":
version "3.6.2"
resolved "https://registry.yarnpkg.com/@gnuxie/matrix-protection-suite-for-matrix-bot-sdk/-/matrix-protection-suite-for-matrix-bot-sdk-3.6.2.tgz#c412ff58483c80ccc5c36a19054e8278163a4426"
integrity sha512-C9CtXXFYszUNJUR6rgEu6z9oyH56x12OYkce4/KKNUVMAaBAGQJmFI7yaRm+wA2XfIINJibJsHh1ddoBl7y/4A==
"matrix-protection-suite-for-matrix-bot-sdk@npm:@gnuxie/matrix-protection-suite-for-matrix-bot-sdk@3.6.3":
version "3.6.3"
resolved "https://registry.yarnpkg.com/@gnuxie/matrix-protection-suite-for-matrix-bot-sdk/-/matrix-protection-suite-for-matrix-bot-sdk-3.6.3.tgz#4c99dcde1762e6f4887dc3cf1ff9473f50f56f00"
integrity sha512-2ZTaD2pBOHjXnxHXTeU33YkxR3J3eC8d7Jj+h1hvCIhGCvSWJml48MIovYlR7/z3J0KWZLS/87s3/YsUV7uJPw==
dependencies:
"@gnuxie/typescript-result" "^1.0.0"
await-lock "^2.2.2"