forked from abner/for-legacy-web
Start migration to revolt.js@5.0.0.
200 error milestone
This commit is contained in:
@@ -1,10 +1,8 @@
|
||||
import { Client } from "revolt.js";
|
||||
import { Message } from "revolt.js/dist/api/objects";
|
||||
import { Channel } from "revolt.js/dist/maps/Channels";
|
||||
|
||||
import { Text } from "preact-i18n";
|
||||
|
||||
import { Channel } from "../../mobx";
|
||||
|
||||
import { Children } from "../../types/Preact";
|
||||
|
||||
export function takeError(error: any): string {
|
||||
@@ -25,7 +23,6 @@ export function takeError(error: any): string {
|
||||
}
|
||||
|
||||
export function getChannelName(
|
||||
client: Client,
|
||||
channel: Channel,
|
||||
prefixType?: boolean,
|
||||
): Children {
|
||||
@@ -33,11 +30,10 @@ export function getChannelName(
|
||||
return <Text id="app.navigation.tabs.saved" />;
|
||||
|
||||
if (channel.channel_type === "DirectMessage") {
|
||||
const uid = client.channels.getRecipient(channel._id);
|
||||
return (
|
||||
<>
|
||||
{prefixType && "@"}
|
||||
{client.users.get(uid)?.username}
|
||||
{channel.recipient!.username}
|
||||
</>
|
||||
);
|
||||
}
|
||||
@@ -48,12 +44,3 @@ export function getChannelName(
|
||||
|
||||
return <>{channel.name}</>;
|
||||
}
|
||||
|
||||
export type MessageObject = Omit<Message, "edited"> & { edited?: string };
|
||||
export function mapMessage(message: Partial<Message>) {
|
||||
const { edited, ...msg } = message;
|
||||
return {
|
||||
...msg,
|
||||
edited: edited?.$date,
|
||||
} as MessageObject;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user