Merge pull request #12 from archem-team/feature/dm_non_friend

Feature/dm non friend
pull/1073/head
teamabron 2025-01-11 10:07:53 +03:30 committed by GitHub
commit 16393f1cb9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 19 additions and 16 deletions

2
.env
View File

@ -1,2 +1,2 @@
VITE_API_URL=https://peptide.chat/api VITE_API_URL=https://test.peptide.chat/api
# VITE_API_URL=http://local.revolt.chat:8000 # VITE_API_URL=http://local.revolt.chat:8000

View File

@ -45,6 +45,7 @@ import AutoComplete, { useAutoComplete } from "../AutoComplete";
import { PermissionTooltip } from "../Tooltip"; import { PermissionTooltip } from "../Tooltip";
import FilePreview from "./bars/FilePreview"; import FilePreview from "./bars/FilePreview";
import ReplyBar from "./bars/ReplyBar"; import ReplyBar from "./bars/ReplyBar";
import { User } from "@styled-icons/boxicons-regular";
type Props = { type Props = {
channel: Channel; channel: Channel;
@ -256,8 +257,8 @@ export default observer(({ channel }: Props) => {
</Base> </Base>
); );
} }
console.log(channel)
if (!channel.havePermission("SendMessage")) { if (!channel.havePermission("SendMessage") && channel.recipient?.relationship == "Blocked" || channel.recipient?.relationship == "BlockedOther"){
return ( return (
<Base> <Base>
<Blocked> <Blocked>
@ -275,7 +276,6 @@ export default observer(({ channel }: Props) => {
</Base> </Base>
); );
} }
// Push message content to draft. // Push message content to draft.
const setMessage = useCallback( const setMessage = useCallback(
(content?: string) => { (content?: string) => {
@ -627,7 +627,7 @@ export default observer(({ channel }: Props) => {
)} )}
</FloatingLayer> </FloatingLayer>
<Base> <Base>
{channel.havePermission("UploadFiles") ? ( {/* {channel.havePermission("UploadFiles") ? ( */}
<FileAction> <FileAction>
<FileUploader <FileUploader
size={24} size={24}
@ -664,9 +664,9 @@ export default observer(({ channel }: Props) => {
}} }}
/> />
</FileAction> </FileAction>
) : ( {/* ) : (
<ThisCodeWillBeReplacedAnywaysSoIMightAsWellJustDoItThisWay__Padding /> <ThisCodeWillBeReplacedAnywaysSoIMightAsWellJustDoItThisWay__Padding />
)} )} */}
<TextAreaAutoSize <TextAreaAutoSize
autoFocus autoFocus
hideBorder hideBorder

View File

@ -7,10 +7,10 @@ import { ModalForm } from "@revoltchat/ui";
import { noopAsync } from "../../../lib/js"; import { noopAsync } from "../../../lib/js";
import { IS_REVOLT } from "../../../version";
import { takeError } from "../../client/jsx/error"; import { takeError } from "../../client/jsx/error";
import { modalController } from "../ModalController"; import { modalController } from "../ModalController";
import { ModalProps } from "../types"; import { ModalProps } from "../types";
import { IS_REVOLT } from "../../../version";
/** /**
* Code block which displays invite * Code block which displays invite
@ -37,6 +37,7 @@ export default function CreateInvite({
}: ModalProps<"create_invite">) { }: ModalProps<"create_invite">) {
const [processing, setProcessing] = useState(false); const [processing, setProcessing] = useState(false);
const [code, setCode] = useState("abcdef"); const [code, setCode] = useState("abcdef");
const [url, setUrl] = useState("abcdef");
// Generate an invite code // Generate an invite code
useEffect(() => { useEffect(() => {
@ -44,7 +45,10 @@ export default function CreateInvite({
target target
.createInvite() .createInvite()
.then(({ _id }) => setCode(_id)) .then((res) => {
setUrl(res.url || "default_url");
setCode(res._id || "default_code");
})
.catch((err) => .catch((err) =>
modalController.push({ type: "error", error: takeError(err) }), modalController.push({ type: "error", error: takeError(err) }),
) )
@ -65,7 +69,7 @@ export default function CreateInvite({
) : ( ) : (
<Invite> <Invite>
<Text id="app.special.modals.prompt.create_invite_created" /> <Text id="app.special.modals.prompt.create_invite_created" />
<code>{code}</code> <code style="font-size:14px">{url}</code>
</Invite> </Invite>
), ),
}, },
@ -79,9 +83,7 @@ export default function CreateInvite({
children: <Text id="app.context_menu.copy_link" />, children: <Text id="app.context_menu.copy_link" />,
onClick: () => onClick: () =>
modalController.writeText( modalController.writeText(
IS_REVOLT `${url}`
? `https://rvlt.gg/${code}`
: `https://${window.location.host}/invite/${code}`,
), ),
}, },
]} ]}

View File

@ -207,7 +207,8 @@ export const UserProfile = observer(
</Button> </Button>
</Link> </Link>
)} )}
{(user.relationship === "Friend" || user.bot) && ( {(user.relationship === "Friend" || user.relationship === "None" || user.relationship === "Outgoing" || user.relationship === "Incoming" || user.bot ) && (
<Localizer> <Localizer>
<Tooltip <Tooltip
content={ content={

View File

@ -99,7 +99,7 @@ export const Channel = observer(
const client = useClient(); const client = useClient();
const state = useApplicationState(); const state = useApplicationState();
if (!client.channels.exists(id)) { if (!client.channels.exists(id) && client.servers.get(server_id)) {
if (server_id) { if (server_id) {
const server = client.servers.get(server_id); const server = client.servers.get(server_id);
if (server && server.channel_ids.length > 0) { if (server && server.channel_ids.length > 0) {
@ -110,7 +110,7 @@ export const Channel = observer(
target_id = last_id; target_id = last_id;
} }
} }
return ( return (
<Redirect <Redirect
to={`/server/${server_id}/channel/${target_id}`} to={`/server/${server_id}/channel/${target_id}`}