diff --git a/src/components/ConversationSettings/ConversationSettingsDialog.vue b/src/components/ConversationSettings/ConversationSettingsDialog.vue index 782e9b86917..ef9bc0fa792 100644 --- a/src/components/ConversationSettings/ConversationSettingsDialog.vue +++ b/src/components/ConversationSettings/ConversationSettingsDialog.vue @@ -37,6 +37,7 @@ + @@ -113,6 +114,7 @@ import ListableSettings from './ListableSettings.vue' import LobbySettings from './LobbySettings.vue' import LockingSettings from './LockingSettings.vue' import MatterbridgeSettings from './Matterbridge/MatterbridgeSettings.vue' +import MentionsSettings from './MentionsSettings.vue' import NotificationsSettings from './NotificationsSettings.vue' import RecordingConsentSettings from './RecordingConsentSettings.vue' import SipSettings from './SipSettings.vue' @@ -137,6 +139,7 @@ export default { LobbySettings, LockingSettings, MatterbridgeSettings, + MentionsSettings, NcAppSettingsDialog, NcAppSettingsSection, NcCheckboxRadioSwitch, diff --git a/src/components/ConversationSettings/MentionsSettings.vue b/src/components/ConversationSettings/MentionsSettings.vue new file mode 100644 index 00000000000..486bc3386a2 --- /dev/null +++ b/src/components/ConversationSettings/MentionsSettings.vue @@ -0,0 +1,136 @@ + + + + + + + diff --git a/src/constants.js b/src/constants.js index 6d617d5736b..992c77bc3bb 100644 --- a/src/constants.js +++ b/src/constants.js @@ -56,6 +56,11 @@ export const CONVERSATION = { ALL: 2, }, + MENTION_PERMISSIONS: { + EVERYONE: 0, + MODERATORS: 1, + }, + TYPE: { ONE_TO_ONE: 1, GROUP: 2, diff --git a/src/services/conversationsService.js b/src/services/conversationsService.js index c2fc37cf0a8..b565f942566 100644 --- a/src/services/conversationsService.js +++ b/src/services/conversationsService.js @@ -306,6 +306,12 @@ const changeListable = async function(token, listable) { }) } +const setMentionPermissions = async function(token, mentionPermissions) { + return axios.put(generateOcsUrl('apps/spreed/api/v4/room/{token}/mention-permissions', { token }), { + mentionPermissions, + }) +} + /** * Set the default permissions for participants in a conversation. * @@ -375,4 +381,5 @@ export { setConversationPermissions, setCallPermissions, setMessageExpiration, + setMentionPermissions, } diff --git a/src/store/conversationsStore.js b/src/store/conversationsStore.js index febdd3db5c9..295ec7d94cf 100644 --- a/src/store/conversationsStore.js +++ b/src/store/conversationsStore.js @@ -46,6 +46,7 @@ import { setConversationPassword, createPublicConversation, createPrivateConversation, + setMentionPermissions, } from '../services/conversationsService.js' import { clearConversationHistory, @@ -75,6 +76,7 @@ const DUMMY_CONVERSATION = { participantType: PARTICIPANT.TYPE.USER, readOnly: CONVERSATION.STATE.READ_ONLY, listable: CONVERSATION.LISTABLE.NONE, + mentions: CONVERSATION.MENTION_PERMISSIONS.EVERYONE, hasCall: false, canStartCall: false, lobbyState: WEBINAR.LOBBY.NONE, @@ -228,6 +230,10 @@ const mutations = { Vue.set(state.conversations[token], 'callPermissions', permissions) }, + setMentionPermissions(state, { token, mentionPermissions }) { + Vue.set(state.conversations[token], 'mentionPermissions', mentionPermissions) + }, + setCallRecording(state, { token, callRecording }) { Vue.set(state.conversations[token], 'callRecording', callRecording) }, @@ -975,6 +981,15 @@ const actions = { } }, + async setMentionPermissions(context, { token, mentionPermissions }) { + try { + await setMentionPermissions(token, mentionPermissions) + context.commit('setMentionPermissions', { token, mentionPermissions }) + } catch (error) { + console.error('Error while updating mention permissions: ', error) + } + }, + async startCallRecording(context, { token, callRecording }) { try { await startCallRecording(token, callRecording) diff --git a/src/types/openapi/openapi-backend-sipbridge.ts b/src/types/openapi/openapi-backend-sipbridge.ts index 37500bdd847..f0bb20a832d 100644 --- a/src/types/openapi/openapi-backend-sipbridge.ts +++ b/src/types/openapi/openapi-backend-sipbridge.ts @@ -293,6 +293,8 @@ export type components = { lobbyState: number; /** Format: int64 */ lobbyTimer: number; + /** Format: int64 */ + mentionPermissions: number; /** Format: int64 */ messageExpiration: number; name: string; diff --git a/src/types/openapi/openapi-federation.ts b/src/types/openapi/openapi-federation.ts index 10f6282a268..a360543f968 100644 --- a/src/types/openapi/openapi-federation.ts +++ b/src/types/openapi/openapi-federation.ts @@ -336,6 +336,8 @@ export type components = { lobbyState: number; /** Format: int64 */ lobbyTimer: number; + /** Format: int64 */ + mentionPermissions: number; /** Format: int64 */ messageExpiration: number; name: string; diff --git a/src/types/openapi/openapi-full.ts b/src/types/openapi/openapi-full.ts index 43e07580a23..4eaae3079ab 100644 --- a/src/types/openapi/openapi-full.ts +++ b/src/types/openapi/openapi-full.ts @@ -1182,6 +1182,23 @@ export type paths = { head?: never; patch?: never; trace?: never; + }; + "/ocs/v2.php/apps/spreed/api/{apiVersion}/room/{token}/mention-permissions": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + /** Update the mention permissions for a room */ + put: operations["room-set-mention-permissions"]; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; }; "/ocs/v2.php/apps/spreed/api/{apiVersion}/settings/user": { parameters: { @@ -2084,6 +2101,8 @@ export type components = { lobbyState: number; /** Format: int64 */ lobbyTimer: number; + /** Format: int64 */ + mentionPermissions: number; /** Format: int64 */ messageExpiration: number; name: string; @@ -7325,6 +7344,54 @@ export interface operations { }; }; }; + }; + "room-set-mention-permissions": { + parameters: { + query: { + /** @description New mention permissions */ + mentionPermissions: 0 | 1; + }; + header: { + /** @description Required to be true for the API request to pass */ + "OCS-APIRequest": boolean; + }; + path: { + apiVersion: "v4"; + token: string; + }; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description Permissions updated successfully */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + ocs: { + meta: components["schemas"]["OCSMeta"]; + data: components["schemas"]["Room"]; + }; + }; + }; + }; + /** @description Updating permissions is not possible */ + 400: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + ocs: { + meta: components["schemas"]["OCSMeta"]; + data: unknown; + }; + }; + }; + }; + }; }; "settings-set-user-setting": { parameters: { diff --git a/src/types/openapi/openapi.ts b/src/types/openapi/openapi.ts index 1487919d2cf..931e70789b9 100644 --- a/src/types/openapi/openapi.ts +++ b/src/types/openapi/openapi.ts @@ -1184,6 +1184,23 @@ export type paths = { head?: never; patch?: never; trace?: never; + }; + "/ocs/v2.php/apps/spreed/api/{apiVersion}/room/{token}/mention-permissions": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + /** Update the mention permissions for a room */ + put: operations["room-set-mention-permissions"]; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; }; "/ocs/v2.php/apps/spreed/api/{apiVersion}/settings/user": { parameters: { @@ -1569,6 +1586,8 @@ export type components = { lobbyState: number; /** Format: int64 */ lobbyTimer: number; + /** Format: int64 */ + mentionPermissions: number; /** Format: int64 */ messageExpiration: number; name: string; @@ -6903,6 +6922,54 @@ export interface operations { }; }; }; + }; + "room-set-mention-permissions": { + parameters: { + query: { + /** @description New mention permissions */ + mentionPermissions: 0 | 1; + }; + header: { + /** @description Required to be true for the API request to pass */ + "OCS-APIRequest": boolean; + }; + path: { + apiVersion: "v4"; + token: string; + }; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description Permissions updated successfully */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + ocs: { + meta: components["schemas"]["OCSMeta"]; + data: components["schemas"]["Room"]; + }; + }; + }; + }; + /** @description Updating permissions is not possible */ + 400: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + ocs: { + meta: components["schemas"]["OCSMeta"]; + data: unknown; + }; + }; + }; + }; + }; }; "settings-set-user-setting": { parameters: {