forked from abner/for-legacy-web
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:
@@ -118,6 +118,7 @@
|
||||
|
||||
> * {
|
||||
opacity: 0;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
&:global(.shown) {
|
||||
@@ -128,6 +129,7 @@
|
||||
|
||||
> * {
|
||||
opacity: 1;
|
||||
pointer-events: unset;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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";
|
||||
|
||||
@@ -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]);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user