mirror of
https://github.com/stoatchat/for-legacy-web.git
synced 2026-03-06 17:11:55 +00:00
Add queued messages back.
Fix various code issues. i18n invite menu.
This commit is contained in:
@@ -2,6 +2,7 @@ import { X } from "@styled-icons/boxicons-regular";
|
||||
import { RelationshipStatus } from "revolt-api/types/Users";
|
||||
import { SYSTEM_USER_ID } from "revolt.js";
|
||||
import { Message as MessageObject } from "revolt.js/dist/maps/Messages";
|
||||
import { Message as MessageI } from "revolt.js/dist/maps/Messages";
|
||||
import styled from "styled-components";
|
||||
import { decodeTime } from "ulid";
|
||||
|
||||
@@ -16,7 +17,7 @@ import { connectState } from "../../../redux/connector";
|
||||
import { QueuedMessage } from "../../../redux/reducers/queue";
|
||||
|
||||
import RequiresOnline from "../../../context/revoltjs/RequiresOnline";
|
||||
import { AppContext } from "../../../context/revoltjs/RevoltClient";
|
||||
import { AppContext, useClient } from "../../../context/revoltjs/RevoltClient";
|
||||
|
||||
import Message from "../../../components/common/messaging/Message";
|
||||
import { SystemMessage } from "../../../components/common/messaging/SystemMessage";
|
||||
@@ -48,7 +49,7 @@ const BlockedMessage = styled.div`
|
||||
function MessageRenderer({ id, state, queue, highlight }: Props) {
|
||||
if (state.type !== "RENDER") return null;
|
||||
|
||||
const client = useContext(AppContext);
|
||||
const client = useClient();
|
||||
const userId = client.user!._id;
|
||||
|
||||
const [editing, setEditing] = useState<string | undefined>(undefined);
|
||||
@@ -148,7 +149,6 @@ function MessageRenderer({ id, state, queue, highlight }: Props) {
|
||||
/>,
|
||||
);
|
||||
} else {
|
||||
// ! FIXME: temp solution
|
||||
if (message.author?.relationship === RelationshipStatus.Blocked) {
|
||||
blocked++;
|
||||
} else {
|
||||
@@ -190,23 +190,24 @@ function MessageRenderer({ id, state, queue, highlight }: Props) {
|
||||
|
||||
previous = {
|
||||
_id: msg.id,
|
||||
data: { author: userId! },
|
||||
author_id: userId!,
|
||||
} as any;
|
||||
}
|
||||
|
||||
// ! FIXME: add queued messages back
|
||||
/* render.push(
|
||||
render.push(
|
||||
<Message
|
||||
message={{
|
||||
...msg.data,
|
||||
replies: msg.data.replies.map((x) => x.id),
|
||||
}}
|
||||
message={
|
||||
new MessageI(client, {
|
||||
...msg.data,
|
||||
replies: msg.data.replies.map((x) => x.id),
|
||||
})
|
||||
}
|
||||
key={msg.id}
|
||||
queued={msg}
|
||||
head={head}
|
||||
attachContext
|
||||
/>,
|
||||
); */
|
||||
);
|
||||
}
|
||||
} else {
|
||||
render.push(
|
||||
|
||||
@@ -4,9 +4,11 @@ import { useHistory, useParams } from "react-router-dom";
|
||||
import { RetrievedInvite } from "revolt-api/types/Invites";
|
||||
|
||||
import styles from "./Invite.module.scss";
|
||||
import { Text } from "preact-i18n";
|
||||
import { useContext, useEffect, useState } from "preact/hooks";
|
||||
|
||||
import { defer } from "../../lib/defer";
|
||||
import { TextReact } from "../../lib/i18n";
|
||||
|
||||
import RequiresOnline from "../../context/revoltjs/RequiresOnline";
|
||||
import {
|
||||
@@ -90,12 +92,20 @@ export default function Invite() {
|
||||
<h1>{invite.server_name}</h1>
|
||||
<h2>#{invite.channel_name}</h2>
|
||||
<h3>
|
||||
Invited by{" "}
|
||||
<UserIcon
|
||||
size={24}
|
||||
attachment={invite.user_avatar}
|
||||
/>{" "}
|
||||
{invite.user_name}
|
||||
<TextReact
|
||||
id="app.special.invite.invited_by"
|
||||
fields={{
|
||||
user: (
|
||||
<>
|
||||
<UserIcon
|
||||
size={24}
|
||||
attachment={invite.user_avatar}
|
||||
/>{" "}
|
||||
{invite.user_name}
|
||||
</>
|
||||
),
|
||||
}}
|
||||
/>
|
||||
</h3>
|
||||
<Overline type="error" error={error} />
|
||||
<Button
|
||||
@@ -140,9 +150,11 @@ export default function Invite() {
|
||||
setProcessing(false);
|
||||
}
|
||||
}}>
|
||||
{status === ClientStatus.READY
|
||||
? "Login to Revolt"
|
||||
: "Accept Invite"}
|
||||
{status === ClientStatus.READY ? (
|
||||
<Text id="app.special.invite.login" />
|
||||
) : (
|
||||
<Text id="app.special.invite.accept" />
|
||||
)}
|
||||
</Button>
|
||||
</>
|
||||
)}
|
||||
|
||||
@@ -1,25 +1,18 @@
|
||||
import { observer } from "mobx-react-lite";
|
||||
import { ChannelPermission } from "revolt.js/dist/api/permissions";
|
||||
import {
|
||||
ChannelPermission,
|
||||
DEFAULT_PERMISSION_DM,
|
||||
} from "revolt.js/dist/api/permissions";
|
||||
import { Channel } from "revolt.js/dist/maps/Channels";
|
||||
|
||||
import { useContext, useEffect, useState } from "preact/hooks";
|
||||
import { useEffect, useState } from "preact/hooks";
|
||||
|
||||
import { AppContext, useClient } from "../../../context/revoltjs/RevoltClient";
|
||||
import { useClient } from "../../../context/revoltjs/RevoltClient";
|
||||
|
||||
import Button from "../../../components/ui/Button";
|
||||
import Checkbox from "../../../components/ui/Checkbox";
|
||||
import Tip from "../../../components/ui/Tip";
|
||||
|
||||
// ! FIXME: export from revolt.js
|
||||
const DEFAULT_PERMISSION_DM =
|
||||
ChannelPermission.View +
|
||||
ChannelPermission.SendMessage +
|
||||
ChannelPermission.ManageChannel +
|
||||
ChannelPermission.VoiceCall +
|
||||
ChannelPermission.InviteOthers +
|
||||
ChannelPermission.EmbedLinks +
|
||||
ChannelPermission.UploadFiles;
|
||||
|
||||
interface Props {
|
||||
channel: Channel;
|
||||
}
|
||||
@@ -27,7 +20,6 @@ interface Props {
|
||||
// ! FIXME: bad code :)
|
||||
export default observer(({ channel }: Props) => {
|
||||
const [selected, setSelected] = useState("default");
|
||||
const client = useClient();
|
||||
|
||||
type R = { name: string; permissions: number };
|
||||
const roles: { [key: string]: R } = {};
|
||||
|
||||
Reference in New Issue
Block a user