Skip to content

Commit

Permalink
Remove stray console.log and update translations.
Browse files Browse the repository at this point in the history
Update themes endpoint and filter unmatched commits.
  • Loading branch information
insertish committed Sep 9, 2021
1 parent efbbb6f commit 048267b
Show file tree
Hide file tree
Showing 6 changed files with 204 additions and 166 deletions.
2 changes: 1 addition & 1 deletion .env
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
VITE_API_URL=https://api.revolt.chat
VITE_THEMES_URL=https://static.revolt.chat/themes
VITE_THEMES_URL=https://themes.revolt.chat
2 changes: 1 addition & 1 deletion .env.build
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
VITE_API_URL=__API_URL__
VITE_THEMES_URL=https://static.revolt.chat/themes
VITE_THEMES_URL=https://themes.revolt.chat
2 changes: 1 addition & 1 deletion external/lang
Submodule lang updated 26 files
+1 −0 .github/workflows/automate.yml
+24 −7 ar.json
+1 −699 bottom.json
+14 −2 en.json
+700 −0 en_US.json
+3 −1 eo.json
+146 −123 es.json
+6 −6 fr.json
+14 −4 hr.json
+42 −42 hu.json
+159 −4 id.json
+212 −137 it.json
+2 −2 ko.json
+1 −1 lt.json
+112 −0 lv.json
+28 −5 nb_NO.json
+30 −16 pl.json
+1 −1 pt_BR.json
+18 −18 pt_PT.json
+11 −3 ro.json
+14 −14 ru.json
+24 −1 ta.json
+117 −112 tokipona.json
+11 −11 uk.json
+9 −2 zh_Hans.json
+440 −0 zh_Hant.json
21 changes: 10 additions & 11 deletions src/components/markdown/Renderer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ if (typeof window !== "undefined") {
if (code) {
navigator.clipboard.writeText(code.textContent?.trim() ?? "");
}
} catch (e) { }
} catch (e) {}
};
}

Expand Down Expand Up @@ -150,8 +150,8 @@ export default function Renderer({ content, disallowBigEmoji }: MarkdownProps) {
`<@${element.dataset.mentionId}>`,
"mention",
);
ev.preventDefault()
return
ev.preventDefault();
return;
}
case "channel_mention": {
internalEmit(
Expand All @@ -160,8 +160,8 @@ export default function Renderer({ content, disallowBigEmoji }: MarkdownProps) {
`<#${element.dataset.mentionId}>`,
"channel_mention",
);
ev.preventDefault()
return
ev.preventDefault();
return;
}
}
}
Expand Down Expand Up @@ -194,7 +194,6 @@ export default function Renderer({ content, disallowBigEmoji }: MarkdownProps) {
element.removeAttribute("target");

const link = determineLink(element.href);
console.log(link)
switch (link.type) {
case "profile": {
element.setAttribute(
Expand All @@ -203,20 +202,20 @@ export default function Renderer({ content, disallowBigEmoji }: MarkdownProps) {
);
element.setAttribute(
"data-mention-id",
link.id
)
link.id,
);
break;
}
case "navigate": {
if (link.navigation_type === 'channel') {
if (link.navigation_type === "channel") {
element.setAttribute(
"data-type",
"channel_mention",
);
element.setAttribute(
"data-mention-id",
link.channel_id
)
link.channel_id,
);
}
break;
}
Expand Down
20 changes: 15 additions & 5 deletions src/lib/links.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
type LinkType =
| { type: "profile"; id: string }
| { type: "navigate"; path: string; navigation_type?: null }
| { type: "navigate"; path: string; navigation_type: 'channel'; channel_id: string }
| {
type: "navigate";
path: string;
navigation_type: "channel";
channel_id: string;
}
| { type: "external"; href: string; url: URL }
| { type: "none" };

Expand All @@ -12,7 +17,8 @@ const ALLOWED_ORIGINS = [
"local.revolt.chat",
];

const CHANNEL_PATH_RE = /^\/server\/[0123456789ABCDEFGHJKMNPQRSTVWXYZ]{26}\/channel\/[0123456789ABCDEFGHJKMNPQRSTVWXYZ]{26}$/
const CHANNEL_PATH_RE =
/^\/server\/[0123456789ABCDEFGHJKMNPQRSTVWXYZ]{26}\/channel\/[0123456789ABCDEFGHJKMNPQRSTVWXYZ]{26}$/;

export function determineLink(href?: string): LinkType {
let internal,
Expand All @@ -30,9 +36,13 @@ export function determineLink(href?: string): LinkType {
return { type: "profile", id };
}
} else {
console.log(path)
if(CHANNEL_PATH_RE.test(path)) {
return { type: 'navigate', path, navigation_type: 'channel', channel_id: path.slice(43) }
if (CHANNEL_PATH_RE.test(path)) {
return {
type: "navigate",
path,
navigation_type: "channel",
channel_id: path.slice(43),
};
}
return { type: "navigate", path };
}
Expand Down
Loading

0 comments on commit 048267b

Please sign in to comment.