Files
cinny/src/app/features/room-settings/permissions/usePermissionItems.ts
T
Ajay Bura 389d121c5d feat: Add option to start video call in DM (#2745)
* add option to start video all in DM

* show speaker icon for dm's in call status name

* show call view if call is active in room

* add Atria call ringtone

* update element call and widget api

* add option to start voice/video call in dms

* only show call button if user have permission

* allow call widget to send call notification event

* show incoming call dialog and play sound

* fix call permission checks

* allow option to start call in all rooms

* send notification when starting call in non-voice rooms

* hide header call button from voice rooms

* prevent call join if call not supported and started by other party

* update call menu style

* show call not supported message on incoming call notification

* improve the incoming call layout

* video call with right click without opening menu

* allow call widget to fetch media url

* add webRTC missing error

* improve call permission label

---------

Co-authored-by: Krishan <33421343+kfiven@users.noreply.github.com>
2026-05-14 19:41:12 +10:00

229 lines
4.8 KiB
TypeScript

import { useMemo } from 'react';
import { MessageEvent, StateEvent } from '../../../../types/matrix/room';
import { PermissionGroup } from '../../common-settings/permissions';
export const usePermissionGroups = (): PermissionGroup[] => {
const groups: PermissionGroup[] = useMemo(() => {
const messagesGroup: PermissionGroup = {
name: 'Messages',
items: [
{
location: {
key: MessageEvent.RoomMessage,
},
name: 'Send Messages',
},
{
location: {
key: MessageEvent.Sticker,
},
name: 'Send Stickers',
},
{
location: {
key: MessageEvent.Reaction,
},
name: 'Send Reactions',
},
{
location: {
notification: true,
key: 'room',
},
name: 'Ping @room',
},
{
location: {
state: true,
key: StateEvent.RoomPinnedEvents,
},
name: 'Pin Messages',
},
{
location: {},
name: 'Other Message Events',
},
],
};
const callSettingsGroup: PermissionGroup = {
name: 'Calls',
items: [
{
location: {
state: true,
key: StateEvent.GroupCallMemberPrefix,
},
name: 'Start or Join Call',
},
],
};
const moderationGroup: PermissionGroup = {
name: 'Moderation',
items: [
{
location: {
action: true,
key: 'invite',
},
name: 'Invite',
},
{
location: {
action: true,
key: 'kick',
},
name: 'Kick',
},
{
location: {
action: true,
key: 'ban',
},
name: 'Ban',
},
{
location: {
action: true,
key: 'redact',
},
name: 'Delete Others Messages',
},
{
location: {
key: MessageEvent.RoomRedaction,
},
name: 'Delete Self Messages',
},
],
};
const roomOverviewGroup: PermissionGroup = {
name: 'Room Overview',
items: [
{
location: {
state: true,
key: StateEvent.RoomAvatar,
},
name: 'Room Avatar',
},
{
location: {
state: true,
key: StateEvent.RoomName,
},
name: 'Room Name',
},
{
location: {
state: true,
key: StateEvent.RoomTopic,
},
name: 'Room Topic',
},
],
};
const roomSettingsGroup: PermissionGroup = {
name: 'Settings',
items: [
{
location: {
state: true,
key: StateEvent.RoomJoinRules,
},
name: 'Change Room Access',
},
{
location: {
state: true,
key: StateEvent.RoomCanonicalAlias,
},
name: 'Publish Address',
},
{
location: {
state: true,
key: StateEvent.RoomPowerLevels,
},
name: 'Change All Permission',
},
{
location: {
state: true,
key: StateEvent.PowerLevelTags,
},
name: 'Edit Power Levels',
},
{
location: {
state: true,
key: StateEvent.RoomEncryption,
},
name: 'Enable Encryption',
},
{
location: {
state: true,
key: StateEvent.RoomHistoryVisibility,
},
name: 'History Visibility',
},
{
location: {
state: true,
key: StateEvent.RoomTombstone,
},
name: 'Upgrade Room',
},
{
location: {
state: true,
},
name: 'Other Settings',
},
],
};
const otherSettingsGroup: PermissionGroup = {
name: 'Other',
items: [
{
location: {
state: true,
key: StateEvent.PoniesRoomEmotes,
},
name: 'Manage Emojis & Stickers',
},
{
location: {
state: true,
key: StateEvent.RoomServerAcl,
},
name: 'Change Server ACLs',
},
{
location: {
state: true,
key: 'im.vector.modular.widgets',
},
name: 'Modify Widgets',
},
],
};
return [
messagesGroup,
callSettingsGroup,
moderationGroup,
roomOverviewGroup,
roomSettingsGroup,
otherSettingsGroup,
];
}, []);
return groups;
};