Added create category context menu when right clicking in channel list

This commit is contained in:
Ryan Alexander
2021-08-17 06:31:25 +10:00
parent 24050a8e05
commit 49d54ee05a
3 changed files with 78 additions and 1 deletions

View File

@@ -102,6 +102,7 @@ type Action =
| { action: "set_status" }
| { action: "clear_status" }
| { action: "create_channel"; target: Server }
| { action: "create_category"; target: Server }
| {
action: "create_invite";
target: Channel;
@@ -400,6 +401,7 @@ function ContextMenus(props: Props) {
case "delete_server":
case "delete_message":
case "create_channel":
case "create_category":
case "create_invite":
// Typescript flattens the case types into a single type and type structure and specifity is lost
openScreen({
@@ -508,11 +510,16 @@ function ContextMenus(props: Props) {
const server = client.servers.get(server_list)!;
const permissions = server.permission;
if (server) {
if (permissions & ServerPermission.ManageChannels)
if (permissions & ServerPermission.ManageChannels) {
generateAction({
action: "create_category",
target: server,
});
generateAction({
action: "create_channel",
target: server,
});
}
if (permissions & ServerPermission.ManageServer)
generateAction({
action: "open_server_settings",
@@ -860,6 +867,15 @@ function ContextMenus(props: Props) {
}
if (sid && server) {
if (server.channels[0] !== undefined)
generateAction(
{
action: "create_invite",
target: server.channels[0],
},
"create_invite",
);
if (
serverPermissions &
ServerPermission.ChangeNickname ||