Fix server id not being replaced properly.

Fix links in spoilers opening when revealing.
Fix unread icon appearing for home.
Fix unreads not being acknowledged.
This commit is contained in:
Paul 2021-07-31 10:05:59 +01:00
parent 58d9744fad
commit 305243ab43
7 changed files with 23 additions and 24 deletions

2
external/lang vendored

@ -1 +1 @@
Subproject commit f3c991242044c0125111e533a94350633a681d62 Subproject commit eb880a90254df406b25caf6b969ed3aee3142f6c

View file

@ -97,7 +97,7 @@
"react-router-dom": "^5.2.0", "react-router-dom": "^5.2.0",
"react-scroll": "^1.8.2", "react-scroll": "^1.8.2",
"redux": "^4.1.0", "redux": "^4.1.0",
"revolt.js": "5.0.0-alpha.10", "revolt.js": "5.0.0-alpha.11",
"rimraf": "^3.0.2", "rimraf": "^3.0.2",
"sass": "^1.35.1", "sass": "^1.35.1",
"shade-blend-color": "^1.0.0", "shade-blend-color": "^1.0.0",

View file

@ -118,6 +118,7 @@
> * { > * {
opacity: 0; opacity: 0;
pointer-events: none;
} }
&:global(.shown) { &:global(.shown) {
@ -128,6 +129,7 @@
> * { > * {
opacity: 1; opacity: 1;
pointer-events: unset;
} }
} }
} }

View file

@ -92,9 +92,8 @@ export default function Renderer({ content, disallowBigEmoji }: MarkdownProps) {
// We replace the message with the mention at the time of render. // We replace the message with the mention at the time of render.
// We don't care if the mention changes. // We don't care if the mention changes.
const newContent = content.replace( const newContent = content
RE_MENTIONS, .replace(RE_MENTIONS, (sub: string, ...args: any[]) => {
(sub: string, ...args: any[]) => {
const id = args[0], const id = args[0],
user = client.users.get(id); user = client.users.get(id);
@ -103,20 +102,17 @@ export default function Renderer({ content, disallowBigEmoji }: MarkdownProps) {
} }
return sub; return sub;
}, })
).replace( .replace(RE_CHANNELS, (sub: string, ...args: any[]) => {
RE_CHANNELS,
(sub: string, ...args: any[]) => {
const id = args[0], const id = args[0],
channel = client.channels.get(id); channel = client.channels.get(id);
if (channel?.channel_type === 'TextChannel') { if (channel?.channel_type === "TextChannel") {
return `[#${channel.name}](/server/${channel.server}/channel/${id})`; return `[#${channel.name}](/server/${channel.server_id}/channel/${id})`;
} }
return sub; return sub;
}, });
);
const useLargeEmojis = disallowBigEmoji const useLargeEmojis = disallowBigEmoji
? false ? false

View file

@ -218,7 +218,7 @@ export const ServerListSidebar = observer(({ unreads, lastOpened }: Props) => {
if ( if (
(x.channel?.channel_type === "DirectMessage" (x.channel?.channel_type === "DirectMessage"
? x.channel?.active ? x.channel?.active
: true) && : x.channel?.channel_type === "Group") &&
x.unread x.unread
) { ) {
homeUnread = "unread"; homeUnread = "unread";

View file

@ -1,4 +1,4 @@
import { autorun } from "mobx"; import { autorun, isObservableProp, reaction } from "mobx";
import { Channel } from "revolt.js/dist/maps/Channels"; import { Channel } from "revolt.js/dist/maps/Channels";
import { useLayoutEffect } from "preact/hooks"; import { useLayoutEffect } from "preact/hooks";
@ -17,10 +17,7 @@ export function useUnreads({ channel, unreads }: UnreadProps) {
const client = useClient(); const client = useClient();
useLayoutEffect(() => { useLayoutEffect(() => {
function checkUnread( function checkUnread(target: Channel) {
target: Channel,
last_message: Channel["last_message"],
) {
if (!target) return; if (!target) return;
if (target._id !== channel._id) return; if (target._id !== channel._id) return;
if ( 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]); }, [channel, unreads]);
} }

View file

@ -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" resolved "https://registry.yarnpkg.com/revolt-api/-/revolt-api-0.5.1-alpha.10-patch.0.tgz#97d31bec7dfa4573567097443acb059c4feaac20"
integrity sha512-UyM890HkGlYNQOxpHuEpUsJHLt8Ujnjg9/zPEDGpbvS4iy0jmHX23Hh8tOCfb/ewxbNrtT3G1HpSWKOneW/vYg== integrity sha512-UyM890HkGlYNQOxpHuEpUsJHLt8Ujnjg9/zPEDGpbvS4iy0jmHX23Hh8tOCfb/ewxbNrtT3G1HpSWKOneW/vYg==
revolt.js@5.0.0-alpha.10: revolt.js@5.0.0-alpha.11:
version "5.0.0-alpha.10" version "5.0.0-alpha.11"
resolved "https://registry.yarnpkg.com/revolt.js/-/revolt.js-5.0.0-alpha.10.tgz#3fa1a8944a338134da09626278ee47b91f20ce2a" resolved "https://registry.yarnpkg.com/revolt.js/-/revolt.js-5.0.0-alpha.11.tgz#af131150ce37a39b979501c730ec2bee5a4e38a1"
integrity sha512-b5nCQDtLUei4mfXhZNkIfQiyG8WDHBnpOVRaRaJz2ZjcQtdBjxIPXxOWkBYL7N/dBJ7sn5xgLMqra9UzkwkewA== integrity sha512-aOD8IV2DM9Ebq15FVQ2GJDGBaICppk+jP06dW0KlrDeVoE3Hra5CRLHSIRtp2mJN/vh1cH+9eA78jssAlAgwAw==
dependencies: dependencies:
axios "^0.19.2" axios "^0.19.2"
eventemitter3 "^4.0.7" eventemitter3 "^4.0.7"