Skip to content

Commit

Permalink
feat(Call): allow moderators to download current attendance list
Browse files Browse the repository at this point in the history
Signed-off-by: DorraJaouad <[email protected]>
  • Loading branch information
DorraJaouad committed Oct 15, 2024
1 parent 7759320 commit 565a2f5
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 1 deletion.
32 changes: 31 additions & 1 deletion src/components/TopBar/TopBarMenu.vue
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,15 @@
</template>
{{ t('spreed', 'Conversation settings') }}
</NcActionButton>

<NcActionButton v-if="isInCall && canModerate"
close-after-click
@click="downloadAttendanceList">
<template #icon>
<IconDownload :size="20" />
</template>
{{ t('spreed', ' Download attendance list') }}
</NcActionButton>
</NcActions>
</div>
</template>
Expand All @@ -147,6 +156,7 @@
import Cog from 'vue-material-design-icons/Cog.vue'
import DotsCircle from 'vue-material-design-icons/DotsCircle.vue'
import DotsHorizontal from 'vue-material-design-icons/DotsHorizontal.vue'
import IconDownload from 'vue-material-design-icons/Download.vue'
import File from 'vue-material-design-icons/File.vue'
import Fullscreen from 'vue-material-design-icons/Fullscreen.vue'
import FullscreenExit from 'vue-material-design-icons/FullscreenExit.vue'
Expand All @@ -158,7 +168,7 @@ import VideoIcon from 'vue-material-design-icons/Video.vue'
import PromotedView from 'vue-material-design-icons/ViewGallery.vue'
import GridView from 'vue-material-design-icons/ViewGrid.vue'
import { showWarning } from '@nextcloud/dialogs'
import { showError, showWarning } from '@nextcloud/dialogs'
import { emit } from '@nextcloud/event-bus'
import { t } from '@nextcloud/l10n'
Expand All @@ -179,6 +189,7 @@ import {
} from '../../composables/useDocumentFullscreen.ts'
import { useIsInCall } from '../../composables/useIsInCall.js'
import { CALL, CONVERSATION, PARTICIPANT } from '../../constants.js'
import { callDownloadParticipants } from '../../services/callsService.js'
import { getTalkConfig } from '../../services/CapabilitiesManager.ts'
import { useBreakoutRoomsStore } from '../../stores/breakoutRooms.ts'
import { useCallViewStore } from '../../stores/callView.js'
Expand Down Expand Up @@ -208,6 +219,7 @@ export default {
FullscreenExit,
GridView,
HandBackLeft,
IconDownload,
MicrophoneOff,
PromotedView,
RecordCircle,
Expand Down Expand Up @@ -492,6 +504,24 @@ export default {
token: this.token,
})
},
async downloadAttendanceList() {
try {
const reponse = await callDownloadParticipants(this.token)
// Create a link and click it to download the file
const url = window.URL.createObjectURL(new Blob([reponse.data]))
const link = document.createElement('a')
link.href = url
link.setAttribute('download', 'Attendance list.csv')
document.body.appendChild(link)
link.click()
// Cleanup: remove the link
link.remove()
} catch (error) {
console.error('Error downloading attendance list', error)
showError(t('spreed', 'Error downloading attendance list'))
}
}
},
}
</script>
Expand Down
5 changes: 5 additions & 0 deletions src/services/callsService.js
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,10 @@ const callSIPSendCallMessage = async function(sessionId, data) {
}
}

const callDownloadParticipants = async function(token, options) {
return await axios.get(generateOcsUrl('apps/spreed/api/v4/call/{token}/download', { token }), options)
}

export {
joinCall,
leaveCall,
Expand All @@ -142,4 +146,5 @@ export {
callSIPUnmutePhone,
callSIPHoldPhone,
callSIPSendDTMF,
callDownloadParticipants,
}

0 comments on commit 565a2f5

Please sign in to comment.