diff --git a/client/pages/config/users/_id/sessions.vue b/client/pages/config/users/_id/sessions.vue
index c8797b04..c01786bb 100644
--- a/client/pages/config/users/_id/sessions.vue
+++ b/client/pages/config/users/_id/sessions.vue
@@ -42,7 +42,7 @@
{{ $elapsedPretty(session.timeListening) }}
|
-
+ |
{{ $secondsToTimestamp(session.currentTime) }}
|
@@ -85,7 +85,8 @@ export default {
listeningSessions: [],
numPages: 0,
total: 0,
- currentPage: 0
+ currentPage: 0,
+ processingGoToTimestamp: false
}
},
computed: {
@@ -97,6 +98,41 @@ export default {
}
},
methods: {
+ async clickCurrentTime(session) {
+ if (this.processingGoToTimestamp) return
+ this.processingGoToTimestamp = true
+ const libraryItem = await this.$axios.$get(`/api/items/${session.libraryItemId}`).catch((error) => {
+ console.error('Failed to get library item', error)
+ return null
+ })
+
+ if (!libraryItem) {
+ this.$toast.error('Failed to get library item')
+ this.processingGoToTimestamp = false
+ return
+ }
+ if (session.episodeId && !libraryItem.media.episodes.find((ep) => ep.id === session.episodeId)) {
+ this.$toast.error('Failed to get podcast episode')
+ this.processingGoToTimestamp = false
+ return
+ }
+
+ const payload = {
+ message: `Start playback for "${session.displayTitle}" at ${this.$secondsToTimestamp(session.currentTime)}?`,
+ callback: (confirmed) => {
+ if (confirmed) {
+ this.$eventBus.$emit('play-item', {
+ libraryItemId: libraryItem.id,
+ episodeId: session.episodeId || null,
+ startTime: session.currentTime
+ })
+ }
+ this.processingGoToTimestamp = false
+ },
+ type: 'yesNo'
+ }
+ this.$store.commit('globals/setConfirmPrompt', payload)
+ },
prevPage() {
this.loadSessions(this.currentPage - 1)
},
|