Enable @typescript-eslint/explicit-member-accessibility on /src (#9785)
* Enable `@typescript-eslint/explicit-member-accessibility` on /src * Prettier
This commit is contained in:
@@ -22,7 +22,7 @@ import PermalinkConstructor, { PermalinkParts } from "./PermalinkConstructor";
|
||||
export default class ElementPermalinkConstructor extends PermalinkConstructor {
|
||||
private elementUrl: string;
|
||||
|
||||
constructor(elementUrl: string) {
|
||||
public constructor(elementUrl: string) {
|
||||
super();
|
||||
this.elementUrl = elementUrl;
|
||||
|
||||
@@ -31,19 +31,19 @@ export default class ElementPermalinkConstructor extends PermalinkConstructor {
|
||||
}
|
||||
}
|
||||
|
||||
forEvent(roomId: string, eventId: string, serverCandidates: string[]): string {
|
||||
public forEvent(roomId: string, eventId: string, serverCandidates: string[]): string {
|
||||
return `${this.elementUrl}/#/room/${roomId}/${eventId}${this.encodeServerCandidates(serverCandidates)}`;
|
||||
}
|
||||
|
||||
forRoom(roomIdOrAlias: string, serverCandidates?: string[]): string {
|
||||
public forRoom(roomIdOrAlias: string, serverCandidates?: string[]): string {
|
||||
return `${this.elementUrl}/#/room/${roomIdOrAlias}${this.encodeServerCandidates(serverCandidates)}`;
|
||||
}
|
||||
|
||||
forUser(userId: string): string {
|
||||
public forUser(userId: string): string {
|
||||
return `${this.elementUrl}/#/user/${userId}`;
|
||||
}
|
||||
|
||||
forEntity(entityId: string): string {
|
||||
public forEntity(entityId: string): string {
|
||||
if (entityId[0] === "!" || entityId[0] === "#") {
|
||||
return this.forRoom(entityId);
|
||||
} else if (entityId[0] === "@") {
|
||||
@@ -51,12 +51,12 @@ export default class ElementPermalinkConstructor extends PermalinkConstructor {
|
||||
} else throw new Error("Unrecognized entity");
|
||||
}
|
||||
|
||||
isPermalinkHost(testHost: string): boolean {
|
||||
public isPermalinkHost(testHost: string): boolean {
|
||||
const parsedUrl = new URL(this.elementUrl);
|
||||
return testHost === (parsedUrl.host || parsedUrl.hostname); // one of the hosts should match
|
||||
}
|
||||
|
||||
encodeServerCandidates(candidates?: string[]) {
|
||||
public encodeServerCandidates(candidates?: string[]) {
|
||||
if (!candidates || candidates.length === 0) return "";
|
||||
return `?via=${candidates.map((c) => encodeURIComponent(c)).join("&via=")}`;
|
||||
}
|
||||
@@ -64,7 +64,7 @@ export default class ElementPermalinkConstructor extends PermalinkConstructor {
|
||||
// Heavily inspired by/borrowed from the matrix-bot-sdk (with permission):
|
||||
// https://github.com/turt2live/matrix-js-bot-sdk/blob/7c4665c9a25c2c8e0fe4e509f2616505b5b66a1c/src/Permalinks.ts#L33-L61
|
||||
// Adapted for Element's URL format
|
||||
parsePermalink(fullUrl: string): PermalinkParts {
|
||||
public parsePermalink(fullUrl: string): PermalinkParts {
|
||||
if (!fullUrl || !fullUrl.startsWith(this.elementUrl)) {
|
||||
throw new Error("Does not appear to be a permalink");
|
||||
}
|
||||
@@ -79,7 +79,7 @@ export default class ElementPermalinkConstructor extends PermalinkConstructor {
|
||||
* @param {string} route The app route
|
||||
* @returns {PermalinkParts}
|
||||
*/
|
||||
static parseAppRoute(route: string): PermalinkParts {
|
||||
public static parseAppRoute(route: string): PermalinkParts {
|
||||
const parts = route.split("/");
|
||||
|
||||
if (parts.length < 2) {
|
||||
|
||||
Reference in New Issue
Block a user