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

View File

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

View File

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

View File

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

View File

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