Avoid using deprecated exports, fields, and duplicate code (#12555)

This commit is contained in:
Michael Telatynski 2024-05-28 08:41:20 +01:00 committed by GitHub
parent 1973197eb6
commit 148a360598
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
33 changed files with 258 additions and 108 deletions

View file

@ -78,15 +78,6 @@ export interface IMatrixClientPeg {
*/
opts: IStartClientOpts;
/**
* Return the server name of the user's homeserver
* Throws an error if unable to deduce the homeserver name
* (e.g. if the user is not logged in)
*
* @returns {string} The homeserver name, if present.
*/
getHomeserverName(): string;
/**
* Get the current MatrixClient, if any
*/
@ -384,14 +375,6 @@ class MatrixClientPegClass implements IMatrixClientPeg {
logger.log(`MatrixClientPeg: MatrixClient started`);
}
public getHomeserverName(): string {
const matches = /^@[^:]+:(.+)$/.exec(this.safeGet().getSafeUserId());
if (matches === null || matches.length < 1) {
throw new Error("Failed to derive homeserver name from user ID!");
}
return matches[1];
}
private namesToRoomName(names: string[], count: number): string | undefined {
const countWithoutMe = count - 1;
if (!names.length) {