mirror of
https://github.com/stoatchat/for-legacy-web.git
synced 2026-04-28 08:10:36 +00:00
merge: branch 'master' into production
This commit is contained in:
@@ -25,6 +25,8 @@ import {
|
||||
import { state, useApplicationState } from "../../../mobx/State";
|
||||
import { Reply } from "../../../mobx/stores/MessageQueue";
|
||||
|
||||
import { dayjs } from "../../../context/Locale";
|
||||
|
||||
import { emojiDictionary } from "../../../assets/emojis";
|
||||
import {
|
||||
clientController,
|
||||
@@ -226,6 +228,34 @@ export default observer(({ channel }: Props) => {
|
||||
|
||||
const renderer = getRenderer(channel);
|
||||
|
||||
if (channel.server?.member?.timeout) {
|
||||
return (
|
||||
<Base>
|
||||
<Blocked>
|
||||
<Action>
|
||||
<PermissionTooltip
|
||||
permission="SendMessages"
|
||||
placement="top">
|
||||
<ShieldX size={22} />
|
||||
</PermissionTooltip>
|
||||
</Action>
|
||||
<div className="text">
|
||||
<Text
|
||||
id="app.main.channel.misc.timed_out"
|
||||
fields={{
|
||||
// TODO: make this reactive
|
||||
time: dayjs().to(
|
||||
channel.server.member.timeout,
|
||||
true,
|
||||
),
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
</Blocked>
|
||||
</Base>
|
||||
);
|
||||
}
|
||||
|
||||
if (!channel.havePermission("SendMessage")) {
|
||||
return (
|
||||
<Base>
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { TimeFive } from "@styled-icons/boxicons-regular";
|
||||
import { observer } from "mobx-react-lite";
|
||||
import { useParams } from "react-router-dom";
|
||||
import { User, API } from "revolt.js";
|
||||
@@ -8,8 +9,11 @@ import { Text } from "preact-i18n";
|
||||
|
||||
import { internalEmit } from "../../../lib/eventEmitter";
|
||||
|
||||
import { dayjs } from "../../../context/Locale";
|
||||
|
||||
import { useClient } from "../../../controllers/client/ClientController";
|
||||
import { modalController } from "../../../controllers/modals/ModalController";
|
||||
import Tooltip from "../Tooltip";
|
||||
import UserIcon from "./UserIcon";
|
||||
|
||||
const BotBadge = styled.div`
|
||||
@@ -64,6 +68,7 @@ export const Username = observer(
|
||||
}: UsernameProps) => {
|
||||
let username = user?.username;
|
||||
let color = masquerade?.colour;
|
||||
let timed_out: Date | undefined;
|
||||
|
||||
if (user && showServerIdentity) {
|
||||
const { server } = useParams<{ server?: string }>();
|
||||
@@ -83,6 +88,10 @@ export const Username = observer(
|
||||
}
|
||||
}
|
||||
|
||||
if (member.timeout) {
|
||||
timed_out = member.timeout;
|
||||
}
|
||||
|
||||
if (!color) {
|
||||
for (const [_, { colour }] of member.orderedRoles) {
|
||||
if (colour) {
|
||||
@@ -95,12 +104,31 @@ export const Username = observer(
|
||||
}
|
||||
|
||||
const el = (
|
||||
<Name {...otherProps} ref={innerRef} colour={color}>
|
||||
{prefixAt ? "@" : undefined}
|
||||
{masquerade?.name ?? username ?? (
|
||||
<Text id="app.main.channel.unknown_user" />
|
||||
<>
|
||||
<Name {...otherProps} ref={innerRef} colour={color}>
|
||||
{prefixAt ? "@" : undefined}
|
||||
{masquerade?.name ?? username ?? (
|
||||
<Text id="app.main.channel.unknown_user" />
|
||||
)}
|
||||
</Name>
|
||||
|
||||
{timed_out && (
|
||||
<Tooltip
|
||||
content={
|
||||
<Text
|
||||
id="app.main.channel.user_timed_out"
|
||||
fields={{
|
||||
time: dayjs(timed_out).fromNow(true),
|
||||
}}
|
||||
/>
|
||||
}>
|
||||
<TimeFive
|
||||
size={16}
|
||||
color="var(--secondary-foreground)"
|
||||
/>
|
||||
</Tooltip>
|
||||
)}
|
||||
</Name>
|
||||
</>
|
||||
);
|
||||
|
||||
if (user?.bot) {
|
||||
|
||||
@@ -189,6 +189,11 @@ const RE_QUOTE = /(^(?:>\s?){5})[>\s?]+(.*$)/gm;
|
||||
*/
|
||||
const RE_HTML_TAGS = /^(<\/?[a-zA-Z0-9]+>)(.*$)/gm;
|
||||
|
||||
/**
|
||||
* Regex for matching empty lines
|
||||
*/
|
||||
const RE_EMPTY_LINE = /^\s*?$/gm;
|
||||
|
||||
/**
|
||||
* Sanitise Markdown input before rendering
|
||||
* @param content Input string
|
||||
@@ -204,6 +209,11 @@ function sanitise(content: string) {
|
||||
// This is to avoid inconsistencies in rendering Markdown inside/after HTML tags
|
||||
// https://github.com/revoltchat/revite/issues/733
|
||||
.replace(RE_HTML_TAGS, (match) => `\u200E${match}`)
|
||||
|
||||
// Replace empty lines with non-breaking space
|
||||
// because remark renderer is collapsing empty
|
||||
// or otherwise whitespace-only lines of text
|
||||
.replace(RE_EMPTY_LINE, "")
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@ import { useApplicationState } from "../../../mobx/State";
|
||||
|
||||
import { useClient } from "../../../controllers/client/ClientController";
|
||||
import { modalController } from "../../../controllers/modals/ModalController";
|
||||
import { IS_REVOLT } from "../../../version";
|
||||
|
||||
/**
|
||||
* Server list sidebar shim component
|
||||
@@ -35,6 +36,7 @@ export default observer(() => {
|
||||
home={state.layout.getLastHomePath}
|
||||
servers={state.ordering.orderedServers}
|
||||
reorder={state.ordering.reorderServer}
|
||||
showDiscovery={IS_REVOLT}
|
||||
/>
|
||||
);
|
||||
});
|
||||
|
||||
@@ -14,6 +14,7 @@ import WaveSVG from "../../settings/assets/wave.svg";
|
||||
|
||||
import { clientController } from "../../../controllers/client/ClientController";
|
||||
import { takeError } from "../../../controllers/client/jsx/error";
|
||||
import { IS_REVOLT } from "../../../version";
|
||||
import FormField from "../FormField";
|
||||
import { CaptchaBlock, CaptchaProps } from "./CaptchaBlock";
|
||||
import { MailProvider } from "./MailProvider";
|
||||
@@ -247,25 +248,23 @@ export const Form = observer(({ page, callback }: Props) => {
|
||||
<Text id="login.resend" />
|
||||
</Link>
|
||||
</span>
|
||||
{import.meta.env.VITE_API_URL &&
|
||||
import.meta.env.VITE_API_URL !=
|
||||
"https://api.revolt.chat" && (
|
||||
<>
|
||||
<br />
|
||||
<Tip palette="primary">
|
||||
<span>
|
||||
<Text id="login.unofficial_instance" />{" "}
|
||||
<a
|
||||
href="https://developers.revolt.chat/faq/instances#what-is-a-third-party-instance"
|
||||
style={{ color: "var(--accent)" }}
|
||||
target="_blank"
|
||||
rel="noreferrer">
|
||||
<Text id="general.learn_more" />
|
||||
</a>
|
||||
</span>
|
||||
</Tip>
|
||||
</>
|
||||
)}
|
||||
{!IS_REVOLT && (
|
||||
<>
|
||||
<br />
|
||||
<Tip palette="primary">
|
||||
<span>
|
||||
<Text id="login.unofficial_instance" />{" "}
|
||||
<a
|
||||
href="https://developers.revolt.chat/faq/instances#what-is-a-third-party-instance"
|
||||
style={{ color: "var(--accent)" }}
|
||||
target="_blank"
|
||||
rel="noreferrer">
|
||||
<Text id="general.learn_more" />
|
||||
</a>
|
||||
</span>
|
||||
</Tip>
|
||||
</>
|
||||
)}
|
||||
</>
|
||||
)}
|
||||
{(page === "reset" ||
|
||||
|
||||
@@ -1 +1,6 @@
|
||||
export const APP_VERSION = "__APP_VERSION__";
|
||||
export const IS_REVOLT =
|
||||
import.meta.env.VITE_API_URL === "https://api.revolt.chat" ||
|
||||
// future proofing
|
||||
import.meta.env.VITE_API_URL === "https://app.revolt.chat/api" ||
|
||||
import.meta.env.VITE_API_URL === "https://revolt.chat/api";
|
||||
|
||||
Reference in New Issue
Block a user