mirror of
https://github.com/revoltchat/revite.git
synced 2024-12-24 22:52:09 -05:00
parent
fb1de01edd
commit
67834309b1
5 changed files with 28 additions and 18 deletions
|
@ -146,12 +146,12 @@ const Message = observer(
|
||||||
{head && (
|
{head && (
|
||||||
<span className="detail">
|
<span className="detail">
|
||||||
<Username
|
<Username
|
||||||
override={message.masquerade?.name}
|
|
||||||
className="author"
|
|
||||||
user={user}
|
user={user}
|
||||||
onContextMenu={userContext}
|
className="author"
|
||||||
onClick={handleUserClick}
|
|
||||||
showServerIdentity
|
showServerIdentity
|
||||||
|
onClick={handleUserClick}
|
||||||
|
onContextMenu={userContext}
|
||||||
|
masquerade={message.masquerade!}
|
||||||
/>
|
/>
|
||||||
<MessageDetail
|
<MessageDetail
|
||||||
message={message}
|
message={message}
|
||||||
|
|
|
@ -182,9 +182,10 @@ export const MessageReply = observer(
|
||||||
<>
|
<>
|
||||||
<div className="user">
|
<div className="user">
|
||||||
<UserShort
|
<UserShort
|
||||||
user={message.author}
|
|
||||||
size={16}
|
size={16}
|
||||||
showServerIdentity
|
showServerIdentity
|
||||||
|
user={message.author}
|
||||||
|
masquerade={message.masquerade!}
|
||||||
prefixAt={parent_mentions.includes(
|
prefixAt={parent_mentions.includes(
|
||||||
message.author_id,
|
message.author_id,
|
||||||
)}
|
)}
|
||||||
|
|
|
@ -9,13 +9,10 @@ import { Text } from "preact-i18n";
|
||||||
import { StateUpdater, useEffect } from "preact/hooks";
|
import { StateUpdater, useEffect } from "preact/hooks";
|
||||||
|
|
||||||
import { internalSubscribe } from "../../../../lib/eventEmitter";
|
import { internalSubscribe } from "../../../../lib/eventEmitter";
|
||||||
import { getRenderer } from "../../../../lib/renderer/Singleton";
|
|
||||||
|
|
||||||
import { dispatch, getState } from "../../../../redux";
|
import { dispatch, getState } from "../../../../redux";
|
||||||
import { Reply } from "../../../../redux/reducers/queue";
|
import { Reply } from "../../../../redux/reducers/queue";
|
||||||
|
|
||||||
import { useClient } from "../../../../context/revoltjs/RevoltClient";
|
|
||||||
|
|
||||||
import IconButton from "../../../ui/IconButton";
|
import IconButton from "../../../ui/IconButton";
|
||||||
|
|
||||||
import Markdown from "../../../markdown/Markdown";
|
import Markdown from "../../../markdown/Markdown";
|
||||||
|
@ -133,9 +130,10 @@ export default observer(({ channel, replies, setReplies }: Props) => {
|
||||||
<ReplyIcon size={22} />
|
<ReplyIcon size={22} />
|
||||||
<div class="username">
|
<div class="username">
|
||||||
<UserShort
|
<UserShort
|
||||||
user={message.author}
|
|
||||||
size={16}
|
size={16}
|
||||||
showServerIdentity
|
showServerIdentity
|
||||||
|
user={message.author}
|
||||||
|
masquerade={message.masquerade!}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div class="message">
|
<div class="message">
|
||||||
|
|
|
@ -2,8 +2,10 @@ import { MicrophoneOff } from "@styled-icons/boxicons-regular";
|
||||||
import { VolumeMute } from "@styled-icons/boxicons-solid";
|
import { VolumeMute } from "@styled-icons/boxicons-solid";
|
||||||
import { observer } from "mobx-react-lite";
|
import { observer } from "mobx-react-lite";
|
||||||
import { useParams } from "react-router-dom";
|
import { useParams } from "react-router-dom";
|
||||||
|
import { Masquerade } from "revolt-api/types/Channels";
|
||||||
import { Presence } from "revolt-api/types/Users";
|
import { Presence } from "revolt-api/types/Users";
|
||||||
import { User } from "revolt.js/dist/maps/Users";
|
import { User } from "revolt.js/dist/maps/Users";
|
||||||
|
import { Nullable } from "revolt.js/dist/util/null";
|
||||||
import styled, { css } from "styled-components";
|
import styled, { css } from "styled-components";
|
||||||
|
|
||||||
import { useContext } from "preact/hooks";
|
import { useContext } from "preact/hooks";
|
||||||
|
@ -17,9 +19,9 @@ import IconBase, { IconBaseProps } from "../IconBase";
|
||||||
|
|
||||||
type VoiceStatus = "muted" | "deaf";
|
type VoiceStatus = "muted" | "deaf";
|
||||||
interface Props extends IconBaseProps<User> {
|
interface Props extends IconBaseProps<User> {
|
||||||
mask?: string;
|
|
||||||
status?: boolean;
|
status?: boolean;
|
||||||
voice?: VoiceStatus;
|
voice?: VoiceStatus;
|
||||||
|
masquerade?: Masquerade;
|
||||||
showServerIdentity?: boolean;
|
showServerIdentity?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -74,11 +76,14 @@ export default observer(
|
||||||
mask,
|
mask,
|
||||||
hover,
|
hover,
|
||||||
showServerIdentity,
|
showServerIdentity,
|
||||||
|
masquerade,
|
||||||
...svgProps
|
...svgProps
|
||||||
} = props;
|
} = props;
|
||||||
|
|
||||||
let { url } = props;
|
let { url } = props;
|
||||||
if (!url) {
|
if (masquerade?.avatar) {
|
||||||
|
url = masquerade.avatar;
|
||||||
|
} else if (!url) {
|
||||||
let override;
|
let override;
|
||||||
if (target && showServerIdentity) {
|
if (target && showServerIdentity) {
|
||||||
const { server } = useParams<{ server?: string }>();
|
const { server } = useParams<{ server?: string }>();
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
import { observer } from "mobx-react-lite";
|
import { observer } from "mobx-react-lite";
|
||||||
import { useParams } from "react-router-dom";
|
import { useParams } from "react-router-dom";
|
||||||
|
import { Masquerade } from "revolt-api/types/Channels";
|
||||||
import { User } from "revolt.js/dist/maps/Users";
|
import { User } from "revolt.js/dist/maps/Users";
|
||||||
|
import { Nullable } from "revolt.js/dist/util/null";
|
||||||
import styled from "styled-components";
|
import styled from "styled-components";
|
||||||
|
|
||||||
import { Text } from "preact-i18n";
|
import { Text } from "preact-i18n";
|
||||||
|
@ -29,16 +31,16 @@ const BotBadge = styled.div`
|
||||||
|
|
||||||
type UsernameProps = JSX.HTMLAttributes<HTMLElement> & {
|
type UsernameProps = JSX.HTMLAttributes<HTMLElement> & {
|
||||||
user?: User;
|
user?: User;
|
||||||
override?: string;
|
|
||||||
prefixAt?: boolean;
|
prefixAt?: boolean;
|
||||||
|
masquerade?: Masquerade;
|
||||||
showServerIdentity?: boolean | "both";
|
showServerIdentity?: boolean | "both";
|
||||||
};
|
};
|
||||||
|
|
||||||
export const Username = observer(
|
export const Username = observer(
|
||||||
({
|
({
|
||||||
user,
|
user,
|
||||||
override,
|
|
||||||
prefixAt,
|
prefixAt,
|
||||||
|
masquerade,
|
||||||
showServerIdentity,
|
showServerIdentity,
|
||||||
...otherProps
|
...otherProps
|
||||||
}: UsernameProps) => {
|
}: UsernameProps) => {
|
||||||
|
@ -83,7 +85,7 @@ export const Username = observer(
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<span {...otherProps} style={{ color }}>
|
<span {...otherProps} style={{ color }}>
|
||||||
{override ?? username ?? (
|
{masquerade?.name ?? username ?? (
|
||||||
<Text id="app.main.channel.unknown_user" />
|
<Text id="app.main.channel.unknown_user" />
|
||||||
)}
|
)}
|
||||||
</span>
|
</span>
|
||||||
|
@ -97,7 +99,7 @@ export const Username = observer(
|
||||||
return (
|
return (
|
||||||
<span {...otherProps} style={{ color }}>
|
<span {...otherProps} style={{ color }}>
|
||||||
{prefixAt ? "@" : undefined}
|
{prefixAt ? "@" : undefined}
|
||||||
{override ?? username ?? (
|
{masquerade?.name ?? username ?? (
|
||||||
<Text id="app.main.channel.unknown_user" />
|
<Text id="app.main.channel.unknown_user" />
|
||||||
)}
|
)}
|
||||||
</span>
|
</span>
|
||||||
|
@ -109,11 +111,13 @@ export default function UserShort({
|
||||||
user,
|
user,
|
||||||
size,
|
size,
|
||||||
prefixAt,
|
prefixAt,
|
||||||
|
masquerade,
|
||||||
showServerIdentity,
|
showServerIdentity,
|
||||||
}: {
|
}: {
|
||||||
user?: User;
|
user?: User;
|
||||||
size?: number;
|
size?: number;
|
||||||
prefixAt?: boolean;
|
prefixAt?: boolean;
|
||||||
|
masquerade?: Masquerade;
|
||||||
showServerIdentity?: boolean;
|
showServerIdentity?: boolean;
|
||||||
}) {
|
}) {
|
||||||
const { openScreen } = useIntermediate();
|
const { openScreen } = useIntermediate();
|
||||||
|
@ -132,16 +136,18 @@ export default function UserShort({
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<UserIcon
|
<UserIcon
|
||||||
size={size ?? 24}
|
|
||||||
target={user}
|
target={user}
|
||||||
|
size={size ?? 24}
|
||||||
|
masquerade={masquerade}
|
||||||
onClick={handleUserClick}
|
onClick={handleUserClick}
|
||||||
showServerIdentity={showServerIdentity}
|
showServerIdentity={showServerIdentity}
|
||||||
/>
|
/>
|
||||||
<Username
|
<Username
|
||||||
user={user}
|
user={user}
|
||||||
showServerIdentity={showServerIdentity}
|
|
||||||
onClick={handleUserClick}
|
|
||||||
prefixAt={prefixAt}
|
prefixAt={prefixAt}
|
||||||
|
masquerade={masquerade}
|
||||||
|
onClick={handleUserClick}
|
||||||
|
showServerIdentity={showServerIdentity}
|
||||||
/>
|
/>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
|
|
Loading…
Reference in a new issue