diff --git a/external/lang b/external/lang index f3c99124..eb880a90 160000 --- a/external/lang +++ b/external/lang @@ -1 +1 @@ -Subproject commit f3c991242044c0125111e533a94350633a681d62 +Subproject commit eb880a90254df406b25caf6b969ed3aee3142f6c diff --git a/package.json b/package.json index 6c92c720..406bd011 100644 --- a/package.json +++ b/package.json @@ -97,7 +97,7 @@ "react-router-dom": "^5.2.0", "react-scroll": "^1.8.2", "redux": "^4.1.0", - "revolt.js": "5.0.0-alpha.10", + "revolt.js": "5.0.0-alpha.11", "rimraf": "^3.0.2", "sass": "^1.35.1", "shade-blend-color": "^1.0.0", diff --git a/src/components/markdown/Markdown.module.scss b/src/components/markdown/Markdown.module.scss index de057a56..eb0113c0 100644 --- a/src/components/markdown/Markdown.module.scss +++ b/src/components/markdown/Markdown.module.scss @@ -118,6 +118,7 @@ > * { opacity: 0; + pointer-events: none; } &:global(.shown) { @@ -128,6 +129,7 @@ > * { opacity: 1; + pointer-events: unset; } } } diff --git a/src/components/markdown/Renderer.tsx b/src/components/markdown/Renderer.tsx index cbbd188b..c7283aba 100644 --- a/src/components/markdown/Renderer.tsx +++ b/src/components/markdown/Renderer.tsx @@ -92,9 +92,8 @@ export default function Renderer({ content, disallowBigEmoji }: MarkdownProps) { // We replace the message with the mention at the time of render. // We don't care if the mention changes. - const newContent = content.replace( - RE_MENTIONS, - (sub: string, ...args: any[]) => { + const newContent = content + .replace(RE_MENTIONS, (sub: string, ...args: any[]) => { const id = args[0], user = client.users.get(id); @@ -103,20 +102,17 @@ export default function Renderer({ content, disallowBigEmoji }: MarkdownProps) { } return sub; - }, - ).replace( - RE_CHANNELS, - (sub: string, ...args: any[]) => { + }) + .replace(RE_CHANNELS, (sub: string, ...args: any[]) => { const id = args[0], channel = client.channels.get(id); - if (channel?.channel_type === 'TextChannel') { - return `[#${channel.name}](/server/${channel.server}/channel/${id})`; + if (channel?.channel_type === "TextChannel") { + return `[#${channel.name}](/server/${channel.server_id}/channel/${id})`; } return sub; - }, - ); + }); const useLargeEmojis = disallowBigEmoji ? false diff --git a/src/components/navigation/left/ServerListSidebar.tsx b/src/components/navigation/left/ServerListSidebar.tsx index a00897e1..53ea0e1d 100644 --- a/src/components/navigation/left/ServerListSidebar.tsx +++ b/src/components/navigation/left/ServerListSidebar.tsx @@ -218,7 +218,7 @@ export const ServerListSidebar = observer(({ unreads, lastOpened }: Props) => { if ( (x.channel?.channel_type === "DirectMessage" ? x.channel?.active - : true) && + : x.channel?.channel_type === "Group") && x.unread ) { homeUnread = "unread"; diff --git a/src/components/navigation/left/common.ts b/src/components/navigation/left/common.ts index 4f085d82..1416b63f 100644 --- a/src/components/navigation/left/common.ts +++ b/src/components/navigation/left/common.ts @@ -1,4 +1,4 @@ -import { autorun } from "mobx"; +import { autorun, isObservableProp, reaction } from "mobx"; import { Channel } from "revolt.js/dist/maps/Channels"; import { useLayoutEffect } from "preact/hooks"; @@ -17,10 +17,7 @@ export function useUnreads({ channel, unreads }: UnreadProps) { const client = useClient(); useLayoutEffect(() => { - function checkUnread( - target: Channel, - last_message: Channel["last_message"], - ) { + function checkUnread(target: Channel) { if (!target) return; if (target._id !== channel._id) return; if ( @@ -50,7 +47,11 @@ export function useUnreads({ channel, unreads }: UnreadProps) { } } - return autorun(() => checkUnread(channel!, channel!.last_message)); + checkUnread(channel); + return reaction( + () => channel.last_message, + () => checkUnread(channel), + ); }, [channel, unreads]); } diff --git a/yarn.lock b/yarn.lock index 4b366512..80442694 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3570,10 +3570,10 @@ revolt-api@0.5.1-alpha.10-patch.0: resolved "https://registry.yarnpkg.com/revolt-api/-/revolt-api-0.5.1-alpha.10-patch.0.tgz#97d31bec7dfa4573567097443acb059c4feaac20" integrity sha512-UyM890HkGlYNQOxpHuEpUsJHLt8Ujnjg9/zPEDGpbvS4iy0jmHX23Hh8tOCfb/ewxbNrtT3G1HpSWKOneW/vYg== -revolt.js@5.0.0-alpha.10: - version "5.0.0-alpha.10" - resolved "https://registry.yarnpkg.com/revolt.js/-/revolt.js-5.0.0-alpha.10.tgz#3fa1a8944a338134da09626278ee47b91f20ce2a" - integrity sha512-b5nCQDtLUei4mfXhZNkIfQiyG8WDHBnpOVRaRaJz2ZjcQtdBjxIPXxOWkBYL7N/dBJ7sn5xgLMqra9UzkwkewA== +revolt.js@5.0.0-alpha.11: + version "5.0.0-alpha.11" + resolved "https://registry.yarnpkg.com/revolt.js/-/revolt.js-5.0.0-alpha.11.tgz#af131150ce37a39b979501c730ec2bee5a4e38a1" + integrity sha512-aOD8IV2DM9Ebq15FVQ2GJDGBaICppk+jP06dW0KlrDeVoE3Hra5CRLHSIRtp2mJN/vh1cH+9eA78jssAlAgwAw== dependencies: axios "^0.19.2" eventemitter3 "^4.0.7"