Implement minimum amount for a working matrix.to

This commit is contained in:
Jorik Schellekens
2020-08-17 17:48:13 +01:00
parent f8fe32ffbc
commit 1ad11ed25f
28 changed files with 703 additions and 99 deletions
+4 -2
View File
@@ -20,7 +20,7 @@ export const roomVerifiers: Verifier<LinkKind.Alias | LinkKind.RoomId>[] = [
[/^!([^/:]+?):(.+)$/, LinkKind.RoomId],
];
export const verifiers: Verifier<LinkKind>[] = [
[/^[!#]([^/:]+?):(.+?)\/\$([^/:]+?):(.+?)$/, LinkKind.Permalink],
[/^[!#]([^/:]+?):(.+?)\/\$([^/:]+?)$/, LinkKind.Permalink],
[/^@([^/:]+?):(.+)$/, LinkKind.UserId],
[/^\+([^/:]+?):(.+)$/, LinkKind.GroupId],
...roomVerifiers,
@@ -56,7 +56,9 @@ export function identifyTypeFromRegex<T, F>(
* Parses a permalink.
* Assumes the permalink is correct.
*/
export function parsePermalink(identifier: string): Permalink {
export function parsePermalink(
identifier: string
): Pick<Permalink, "roomKind" | "roomLink" | "eventId"> {
const [roomLink, eventId] = identifier.split("/");
const roomKind = identifyTypeFromRegex(
roomLink,