Apply prettier formatting
This commit is contained in:
parent
1cac306093
commit
526645c791
1576 changed files with 65385 additions and 62478 deletions
|
@ -48,8 +48,8 @@ export default class MatrixToPermalinkConstructor extends PermalinkConstructor {
|
|||
}
|
||||
|
||||
encodeServerCandidates(candidates: string[]) {
|
||||
if (!candidates || candidates.length === 0) return '';
|
||||
return `?via=${candidates.map(c => encodeURIComponent(c)).join("&via=")}`;
|
||||
if (!candidates || candidates.length === 0) return "";
|
||||
return `?via=${candidates.map((c) => encodeURIComponent(c)).join("&via=")}`;
|
||||
}
|
||||
|
||||
// Heavily inspired by/borrowed from the matrix-bot-sdk (with permission):
|
||||
|
@ -62,20 +62,21 @@ export default class MatrixToPermalinkConstructor extends PermalinkConstructor {
|
|||
const parts = fullUrl.substring(`${baseUrl}/#/`.length).split("/");
|
||||
|
||||
const entity = parts[0];
|
||||
if (entity[0] === '@') {
|
||||
if (entity[0] === "@") {
|
||||
// Probably a user, no further parsing needed.
|
||||
return PermalinkParts.forUser(entity);
|
||||
} else if (entity[0] === '#' || entity[0] === '!') {
|
||||
if (parts.length === 1) { // room without event permalink
|
||||
const [roomId, query=""] = entity.split("?");
|
||||
const via = query.split(/&?via=/g).filter(p => !!p);
|
||||
} else if (entity[0] === "#" || entity[0] === "!") {
|
||||
if (parts.length === 1) {
|
||||
// room without event permalink
|
||||
const [roomId, query = ""] = entity.split("?");
|
||||
const via = query.split(/&?via=/g).filter((p) => !!p);
|
||||
return PermalinkParts.forRoom(roomId, via);
|
||||
}
|
||||
|
||||
// rejoin the rest because v3 events can have slashes (annoyingly)
|
||||
const eventIdAndQuery = parts.length > 1 ? parts.slice(1).join('/') : "";
|
||||
const [eventId, query=""] = eventIdAndQuery.split("?");
|
||||
const via = query.split(/&?via=/g).filter(p => !!p);
|
||||
const eventIdAndQuery = parts.length > 1 ? parts.slice(1).join("/") : "";
|
||||
const [eventId, query = ""] = eventIdAndQuery.split("?");
|
||||
const via = query.split(/&?via=/g).filter((p) => !!p);
|
||||
|
||||
return PermalinkParts.forEvent(entity, eventId, via);
|
||||
} else {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue