Fix and prettier incoming changes from PR #119.

Cherry pick PR #130: don't show add friend button on banned / deleted accounts.
Also account for this in context menu.
This commit is contained in:
Paul 2021-09-03 10:43:48 +01:00
parent a08ad7aa0b
commit a1cb72046c
3 changed files with 34 additions and 14 deletions

View file

@ -196,6 +196,8 @@ export const UserProfile = observer(
</IconButton>
)}
{!user.bot &&
flags != 2 &&
flags != 4 &&
(user.relationship ===
RelationshipStatus.Incoming ||
user.relationship ===
@ -315,10 +317,14 @@ export const UserProfile = observer(
content={
<Text id="app.special.popovers.user_profile.badges.translator" />
}>
<img src="/assets/badges/translator.svg"
onClick={() => {
window.open("https://weblate.insrt.uk/projects/revolt/web-app/", "_blank")
}}
<img
src="/assets/badges/translator.svg"
onClick={() => {
window.open(
"https://weblate.insrt.uk/projects/revolt/web-app/",
"_blank",
);
}}
/>
</Tooltip>
) : (
@ -343,7 +349,10 @@ export const UserProfile = observer(
size={32}
color="#efab44"
onClick={() => {
window.open("https://insrt.uk/donate", "_blank")
window.open(
"https://insrt.uk/donate",
"_blank",
);
}}
/>
</Tooltip>

View file

@ -619,7 +619,14 @@ function ContextMenus(props: Props) {
break;
case RelationshipStatus.None:
default:
actions = ["add_friend", "block_user"];
if (
(user.flags && 2) ||
(user.flags && 4)
) {
actions = ["block_user"];
} else {
actions = ["add_friend", "block_user"];
}
}
if (userPermissions & UserPermission.ViewProfile) {

View file

@ -1,8 +1,12 @@
import { Form } from "./Form";
import { detect } from "detect-browser";
import { useHistory } from "react-router-dom";
import { useContext } from "preact/hooks";
import { OperationsContext } from "../../../context/revoltjs/RevoltClient";
import { Form } from "./Form";
export function FormLogin() {
const { login } = useContext(OperationsContext);
const history = useHistory();
@ -10,7 +14,7 @@ export function FormLogin() {
return (
<Form
page="login"
callback={async data => {
callback={async (data) => {
const browser = detect();
let device_name;
if (browser) {
@ -19,12 +23,12 @@ export function FormLogin() {
if (window.isNative) {
device_name = `Revolt Desktop on ${os}`;
} else {
if(name === "ios") {
name = "safari";
}else if(name === "fxios") {
name = "firefox";
}
device_name = `${name} on ${os}`;
if (name === "ios") {
name = "safari";
} else if (name === "fxios") {
name = "firefox";
}
device_name = `${name} on ${os}`;
}
} else {
device_name = "Unknown Device";