Remove remaining references to useUser(s).

Add Channel object.
This commit is contained in:
Paul
2021-07-29 16:55:07 +01:00
parent 7c119fd1a8
commit 551dc7562e
13 changed files with 126 additions and 54 deletions

View File

@@ -13,7 +13,7 @@ import { useRenderState } from "../../../../lib/renderer/Singleton";
import { useData } from "../../../../mobx/State";
import { useForceUpdate, useUser } from "../../../../context/revoltjs/hooks";
import { useClient } from "../../../../context/revoltjs/RevoltClient";
import { mapMessage, MessageObject } from "../../../../context/revoltjs/util";
import Markdown from "../../../markdown/Markdown";
@@ -124,7 +124,7 @@ export const ReplyBase = styled.div<{
`;
export const MessageReply = observer(({ index, channel, id }: Props) => {
const ctx = useForceUpdate();
const client = useClient();
const view = useRenderState(channel);
if (view?.type !== "RENDER") return null;
@@ -138,7 +138,7 @@ export const MessageReply = observer(({ index, channel, id }: Props) => {
if (m) {
setMessage(m);
} else {
ctx.client.channels
client.channels
.fetchMessage(channel, id)
.then((m) => setMessage(mapMessage(m)));
}
@@ -178,8 +178,7 @@ export const MessageReply = observer(({ index, channel, id }: Props) => {
<div
className="content"
onClick={() => {
const obj =
ctx.client.channels.get(channel);
const obj = client.channels.get(channel);
if (obj?.channel_type === "TextChannel") {
history.push(
`/server/${obj.server}/channel/${obj._id}/${message._id}`,