|
4 | 4 | */ |
5 | 5 |
|
6 | 6 | import { isCancel } from '@nextcloud/axios' |
7 | | -import { showError, showSuccess } from '@nextcloud/dialogs' |
| 7 | +import { showError, showInfo, showSuccess } from '@nextcloud/dialogs' |
8 | 8 | import { emit } from '@nextcloud/event-bus' |
9 | 9 | import { t } from '@nextcloud/l10n' |
10 | 10 | import Hex from 'crypto-js/enc-hex.js' |
11 | 11 | import SHA1 from 'crypto-js/sha1.js' |
12 | | -import { ATTENDEE, PARTICIPANT } from '../constants.ts' |
| 12 | +import { ATTENDEE, CONVERSATION, PARTICIPANT } from '../constants.ts' |
13 | 13 | import { banActor } from '../services/banService.ts' |
14 | 14 | import { |
15 | 15 | joinCall, |
@@ -1250,14 +1250,35 @@ const actions = { |
1250 | 1250 | context.commit('setPhoneState', { callid }) |
1251 | 1251 | }, |
1252 | 1252 |
|
1253 | | - processTransientCallStatus(context, { value }) { |
| 1253 | + async processTransientCallStatus(context, { value }) { |
1254 | 1254 | context.commit('setPhoneState', { callid: value.callid, value }) |
1255 | 1255 |
|
1256 | 1256 | if (value.status === 'cleared' || value.status === 'rejected') { |
1257 | 1257 | setTimeout(() => { |
1258 | 1258 | context.commit('deletePhoneState', value.callid) |
1259 | 1259 | }, 5000) |
1260 | 1260 | } |
| 1261 | + |
| 1262 | + // Special handling for dial-out rooms, if a call was rejected |
| 1263 | + if (value.status === 'rejected') { |
| 1264 | + const conversation = context.rootGetters.conversation(tokenStore.token) |
| 1265 | + const isConversationPhoneRoom = [ |
| 1266 | + CONVERSATION.OBJECT_TYPE.PHONE_LEGACY, |
| 1267 | + CONVERSATION.OBJECT_TYPE.PHONE_PERSISTENT, |
| 1268 | + CONVERSATION.OBJECT_TYPE.PHONE_TEMPORARY, |
| 1269 | + ].includes(conversation.objectType) |
| 1270 | + && conversation.objectId === CONVERSATION.OBJECT_ID.PHONE_OUTGOING |
| 1271 | + |
| 1272 | + if (isConversationPhoneRoom) { |
| 1273 | + const actorStore = useActorStore() |
| 1274 | + await context.dispatch('leaveCall', { |
| 1275 | + token: tokenStore.token, |
| 1276 | + participantIdentifier: actorStore.participantIdentifier, |
| 1277 | + all: true, |
| 1278 | + }) |
| 1279 | + showInfo(t('spreed', 'Call rejected')) |
| 1280 | + } |
| 1281 | + } |
1261 | 1282 | }, |
1262 | 1283 |
|
1263 | 1284 | addPhonesStates(context, { phoneStates }) { |
|
0 commit comments