From e1fdfa854518ce07f26f29aa29cbda362bfffab3 Mon Sep 17 00:00:00 2001 From: srahn Date: Wed, 19 Jul 2023 17:41:45 +0200 Subject: [PATCH] Multiple bug fixes --- lib/Routes/Playlist/PlaylistUpdate.php | 3 +++ lib/Routes/Video/VideoCopyToCourse.php | 7 ++++--- vueapp/components/Error.vue | 7 ++++++- vueapp/components/SearchBar.vue | 11 +++++++++++ vueapp/components/UserCourseSelectable.vue | 6 +++--- vueapp/components/Videos/Actions/CaptionUpload.vue | 4 ++++ .../Videos/Actions/VideoAccess/ShareWithUsers.vue | 4 ++-- .../components/Videos/Actions/VideoCopyToSeminar.vue | 12 +++++++----- vueapp/components/Videos/VideoCard.vue | 8 +++----- vueapp/components/Videos/VideoUpload.vue | 5 ++++- vueapp/components/Videos/VideosList.vue | 2 +- vueapp/store/playlists.module.js | 9 ++++++++- 12 files changed, 56 insertions(+), 22 deletions(-) diff --git a/lib/Routes/Playlist/PlaylistUpdate.php b/lib/Routes/Playlist/PlaylistUpdate.php index b6410e0b3..aacbf319b 100644 --- a/lib/Routes/Playlist/PlaylistUpdate.php +++ b/lib/Routes/Playlist/PlaylistUpdate.php @@ -66,6 +66,9 @@ public function __invoke(Request $request, Response $response, $args) $playlist->setData($json); $playlist->store(); + $playlist['mkdate'] = ($playlist['mkdate'] == '0000-00-00 00:00:00') + ? 0 : \strtotime($playlist['mkdate']); + $ret_playlist = $playlist->toSanitizedArray(); $ret_playlist['users'] = [[ 'user_id' => $user->id, diff --git a/lib/Routes/Video/VideoCopyToCourse.php b/lib/Routes/Video/VideoCopyToCourse.php index fae1303c1..d9b589ed1 100644 --- a/lib/Routes/Video/VideoCopyToCourse.php +++ b/lib/Routes/Video/VideoCopyToCourse.php @@ -52,9 +52,10 @@ public function __invoke(Request $request, Response $response, $args) // if this is the courses default playlist, copy the videos to the new courses default playlist if ($playlist->is_default) { $default_playlist = Helpers::checkCoursePlaylist($course['id']); - $stmt = DBManager::get()->prepare("INSERT INTO oc_playlist_video (playlist_id, video, order) - SELECT :target, video, order, FROM oc_playlist_video - WHERE playlist_id = :source"); + $stmt = \DBManager::get()->prepare("INSERT INTO oc_playlist_video (playlist_id, video_id, `order`) + SELECT :target, video_id, `order` FROM oc_playlist_video + WHERE playlist_id = :source + AND NOT EXISTS (Select * FROM oc_playlist_video WHERE playlist_id = :target)"); $stmt->execute([ ':target' => $default_playlist->id, ':source' => $playlist->id diff --git a/vueapp/components/Error.vue b/vueapp/components/Error.vue index ed0b70fc0..c657d0baa 100644 --- a/vueapp/components/Error.vue +++ b/vueapp/components/Error.vue @@ -1,5 +1,8 @@ @@ -193,6 +195,7 @@ import { mapGetters } from 'vuex'; import StudipDialog from '@studip/StudipDialog' import StudipButton from '@studip/StudipButton' +import Error from "@/components/Error"; import MessageBox from '@/components/MessageBox' import VideoFilePreview from '@/components/Videos/VideoFilePreview' import ProgressBar from '@/components/ProgressBar' @@ -206,6 +209,7 @@ export default { components: { StudipDialog, + Error, MessageBox, StudipButton, VideoFilePreview, @@ -329,7 +333,6 @@ export default { } uploadData['created'] = new Date(this.upload.recordDate).toISOString(), - delete uploadData['recordDate']; uploadData['oc_acl'] = this.uploadService.uploadACL(); diff --git a/vueapp/components/Videos/VideosList.vue b/vueapp/components/Videos/VideosList.vue index 54fc9e39d..a10cefe2a 100644 --- a/vueapp/components/Videos/VideosList.vue +++ b/vueapp/components/Videos/VideosList.vue @@ -5,7 +5,7 @@

{{ playlistForVideos.title }} -
+

diff --git a/vueapp/store/playlists.module.js b/vueapp/store/playlists.module.js index 3c3f06de1..a217069c7 100644 --- a/vueapp/store/playlists.module.js +++ b/vueapp/store/playlists.module.js @@ -86,7 +86,7 @@ const actions = { async updatePlaylist(context, playlist) { return ApiService.put('playlists/' + playlist.token, playlist) .then(({ data }) => { - context.commit('setPlaylists', [data]); + context.commit('updatePlaylist', data); }); }, @@ -176,6 +176,13 @@ const actions = { } const mutations = { + updatePlaylist(state, playlist) { + let idx = state.playlists.findIndex(p => p.token === playlist.token); + if (idx > -1) { + state.playlists[idx] = playlist; + } + }, + setPlaylists(state, playlists) { state.playlists = playlists; },