Skip to content

Commit 1a64b02

Browse files
committed
fix: add notifications submenu actions
Signed-off-by: Maksim Sukharev <[email protected]>
1 parent 166319d commit 1a64b02

File tree

1 file changed

+69
-1
lines changed

1 file changed

+69
-1
lines changed

src/components/LeftSidebar/ConversationsList/Conversation.vue

+69-1
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,29 @@
109109
</NcActionButton>
110110

111111
<NcActionSeparator />
112+
113+
<NcActionButton v-for="level in notificationLevels"
114+
:key="level.value"
115+
:model-value="notificationLevel.toString()"
116+
:value="level.value.toString()"
117+
type="radio"
118+
@click="setNotificationLevel(level.value)">
119+
<template #icon>
120+
<component :is="notificationLevelIcon(level.value)" :size="16" />
121+
</template>
122+
{{ level.label }}
123+
</NcActionButton>
124+
125+
<NcActionSeparator />
126+
127+
<NcActionButton type="checkbox"
128+
:model-value="notifyCalls"
129+
@click="setNotificationCalls(!notifyCalls)">
130+
<template #icon>
131+
<IconPhoneRing :size="16" />
132+
</template>
133+
{{ t('spreed', 'Notify about calls') }}
134+
</NcActionButton>
112135
</template>
113136
</template>
114137

@@ -173,6 +196,7 @@
173196
import { toRefs, ref } from 'vue'
174197
import { isNavigationFailure, NavigationFailureType } from 'vue-router'
175198

199+
import IconAccount from 'vue-material-design-icons/Account.vue'
176200
import IconArchive from 'vue-material-design-icons/Archive.vue'
177201
import IconArchiveOff from 'vue-material-design-icons/ArchiveOff.vue'
178202
import IconArrowLeft from 'vue-material-design-icons/ArrowLeft.vue'
@@ -184,7 +208,10 @@ import IconDelete from 'vue-material-design-icons/Delete.vue'
184208
import IconExitToApp from 'vue-material-design-icons/ExitToApp.vue'
185209
import IconEye from 'vue-material-design-icons/Eye.vue'
186210
import IconEyeOff from 'vue-material-design-icons/EyeOff.vue'
211+
import IconPhoneRing from 'vue-material-design-icons/PhoneRing.vue'
187212
import IconStar from 'vue-material-design-icons/Star.vue'
213+
import IconVolumeHigh from 'vue-material-design-icons/VolumeHigh.vue'
214+
import IconVolumeOff from 'vue-material-design-icons/VolumeOff.vue'
188215

189216
import { showError } from '@nextcloud/dialogs'
190217
import { emit } from '@nextcloud/event-bus'
@@ -205,11 +232,18 @@ import { copyConversationLinkToClipboard } from '../../../utils/handleUrl.ts'
205232

206233
const supportsArchive = hasTalkFeature('local', 'archived-conversations-v2')
207234

235+
const notificationLevels = [
236+
{ value: PARTICIPANT.NOTIFY.ALWAYS, label: t('spreed', 'All messages') },
237+
{ value: PARTICIPANT.NOTIFY.MENTION, label: t('spreed', '@-mentions only') },
238+
{ value: PARTICIPANT.NOTIFY.NEVER, label: t('spreed', 'Off') },
239+
]
240+
208241
export default {
209242
name: 'Conversation',
210243

211244
components: {
212245
ConversationIcon,
246+
IconAccount,
213247
IconArchive,
214248
IconArchiveOff,
215249
IconArrowLeft,
@@ -221,7 +255,10 @@ export default {
221255
IconExitToApp,
222256
IconEye,
223257
IconEyeOff,
258+
IconPhoneRing,
224259
IconStar,
260+
IconVolumeHigh,
261+
IconVolumeOff,
225262
NcActionButton,
226263
NcActionSeparator,
227264
NcButton,
@@ -247,7 +284,6 @@ export default {
247284
type: 0,
248285
displayName: '',
249286
isFavorite: false,
250-
notificationLevel: 0,
251287
lastMessage: {},
252288
canDeleteConversation: false,
253289
canLeaveConversation: false,
@@ -265,13 +301,19 @@ export default {
265301
const { item, isSearchResult } = toRefs(props)
266302
const { counterType, conversationInformation } = useConversationInfo({ item, isSearchResult })
267303

304+
const notificationLevel = ref(item.value.notificationLevel)
305+
const notifyCalls = ref(item.value.notificationCalls === PARTICIPANT.NOTIFY_CALLS.ON)
306+
268307
return {
269308
supportsArchive,
270309
submenu,
271310
isLeaveDialogOpen,
272311
isDeleteDialogOpen,
273312
counterType,
274313
conversationInformation,
314+
notificationLevels,
315+
notificationLevel,
316+
notifyCalls,
275317
}
276318
},
277319

@@ -385,6 +427,18 @@ export default {
385427
this.$store.dispatch('toggleArchive', this.item)
386428
},
387429

430+
notificationLevelIcon(value) {
431+
switch (value) {
432+
case PARTICIPANT.NOTIFY.ALWAYS:
433+
return IconVolumeHigh
434+
case PARTICIPANT.NOTIFY.MENTION:
435+
return IconAccount
436+
case PARTICIPANT.NOTIFY.NEVER:
437+
default:
438+
return IconVolumeOff
439+
}
440+
},
441+
388442
/**
389443
* Set the notification level for the conversation
390444
*
@@ -395,6 +449,20 @@ export default {
395449
token: this.item.token,
396450
notificationLevel: level,
397451
})
452+
this.notificationLevel = level
453+
},
454+
455+
/**
456+
* Set the call notification level for the conversation
457+
*
458+
* @param {boolean} value Whether or not call notifications are enabled
459+
*/
460+
async setNotificationCalls(value) {
461+
await this.$store.dispatch('setNotificationCalls', {
462+
token: this.item.token,
463+
notificationCalls: value ? PARTICIPANT.NOTIFY_CALLS.ON : PARTICIPANT.NOTIFY_CALLS.OFF,
464+
})
465+
this.notifyCalls = value
398466
},
399467

400468
onClick() {

0 commit comments

Comments
 (0)