Skip to content

Commit

Permalink
Multiple bug fixes (#751)
Browse files Browse the repository at this point in the history
  • Loading branch information
ssrahn committed Aug 4, 2023
1 parent fd18501 commit 06d2df8
Show file tree
Hide file tree
Showing 12 changed files with 56 additions and 22 deletions.
3 changes: 3 additions & 0 deletions lib/Routes/Playlist/PlaylistUpdate.php
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
7 changes: 4 additions & 3 deletions lib/Routes/Video/VideoCopyToCourse.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 6 additions & 1 deletion vueapp/components/Error.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
<template>
<div v-if="errors.length">
<div v-if="errors.length"
:class="{
'oc--messages-float': float
}">
<div class="messagebox messagebox_error"
v-for="error in errors"
v-bind:key="error">
Expand Down Expand Up @@ -45,6 +48,8 @@ import { mapGetters } from "vuex";
export default {
name: "Error",
props: ['float'],
computed: {
...mapGetters(["errors"])
},
Expand Down
11 changes: 11 additions & 0 deletions vueapp/components/SearchBar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@
</li>
<li class="oc--searchbar-token" v-if="token && token.type">
{{ token.type_name }} {{ token.compare }} {{ token.value_name }}
<studip-icon
shape="decline" role="info" class="oc--remove-filter"
@click="removeTokenSelect"
@blur="delayedHideTokenSelector"
/>
</li>
<li class="oc--searchbar-input">
<input type="text" ref="searchbar"
Expand Down Expand Up @@ -245,6 +250,12 @@ export default {
this.doSearch();
},
removeTokenSelect() {
this.token = null;
this.tokenState = 'main';
this.hideTokenSelector();
},
doSearch() {
let filters = JSON.parse(JSON.stringify(this.searchTokens));
Expand Down
6 changes: 3 additions & 3 deletions vueapp/components/UserCourseSelectable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
icon="accept"
@click.prevent="returnSelectedCourse()"
>
{{ $gettext('Kurse auswählen') }}
{{ $gettext('Kurs auswählen') }}
</StudipButton>
</footer>
</form>
Expand Down Expand Up @@ -74,7 +74,7 @@ export default {
}];
if (this.courses.length == 0) {
this.currentCourse = 0;
this.currentCourse = null;
return noCoursesFound;
}
Expand Down Expand Up @@ -108,7 +108,7 @@ export default {
}
if (Object.keys(course_list).length == 0) {
this.currentCourse = 0;
this.currentCourse = null;
return noCoursesFound;
}
Expand Down
4 changes: 4 additions & 0 deletions vueapp/components/Videos/Actions/CaptionUpload.vue
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,8 @@
<ProgressBar v-if="uploadProgress && uploadProgress.flavor == language.flavor" :progress="uploadProgress.progress" />
</div>

<Error :float="true" />

<MessageBox v-if="fileUploadError" type="error">
{{ $gettext('Sie müssen mindestens eine Datei auswählen!') }}
</MessageBox>
Expand All @@ -96,6 +98,7 @@ import { mapGetters } from 'vuex';
import StudipDialog from '@studip/StudipDialog'
import StudipButton from '@studip/StudipButton'
import MessageBox from '@/components/MessageBox'
import Error from "@/components/Error";
import ProgressBar from '@/components/ProgressBar'
import UploadService from '@/common/upload.service'
Expand All @@ -105,6 +108,7 @@ export default {
components: {
StudipDialog,
MessageBox,
Error,
StudipButton,
ProgressBar,
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ export default {
data()
{
return {
selectedUser: {},
selectedUser: null,
selectedUserPerm: null,
}
},
Expand Down Expand Up @@ -155,7 +155,7 @@ export default {
this.selectedUser.perm = this.selectedUserPerm;
this.$emit('add', this.selectedUser);
this.selectedUser = {};
this.selectedUser = null;
this.selectedUserPerm = null;
}
}
Expand Down
12 changes: 7 additions & 5 deletions vueapp/components/Videos/Actions/VideoCopyToSeminar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,13 @@ export default {
...mapGetters(['userCourses', 'cid', 'courseVideosToCopy']),
user_courses_filtered() {
let userCoursesFiltered = this.userCourses;
for (let semester_code in userCoursesFiltered) {
for (let semester in userCoursesFiltered[semester_code]) {
if (Array.isArray(userCoursesFiltered[semester_code][semester])) {
let filtered = userCoursesFiltered[semester_code][semester].filter(course => course.id != this.cid);
let userCoursesFiltered = {};
for (let semester_code in this.userCourses) {
userCoursesFiltered[semester_code] = {};
for (let semester in this.userCourses[semester_code]) {
if (Array.isArray(this.userCourses[semester_code][semester])) {
let filtered = this.userCourses[semester_code][semester].filter(
course => course.id != this.cid && !this.courses.includes(course));
userCoursesFiltered[semester_code][semester] = filtered;
}
}
Expand Down
8 changes: 3 additions & 5 deletions vueapp/components/Videos/VideoCard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -209,13 +209,11 @@ export default {
if (this.canEdit) {
return true;
}
let playlist_download = this.playlist['allow_download'];
if (playlist_download === null) {
return this.downloadSetting === 'allow';
else if (this.playlist && this.playlist['allow_download']) {
return this.playlist['allow_download'];
}
else {
return playlist_download;
return this.downloadSetting === 'allow';
}
}
return false;
Expand Down
5 changes: 4 additions & 1 deletion vueapp/components/Videos/VideoUpload.vue
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,8 @@
Medien, bei denen Urheberrechtsverstöße vorliegen, werden ohne vorherige Ankündigung umgehend gelöscht.
</MessageBox>
</form>

<Error :float="true"/>
</template>
</StudipDialog>
</div>
Expand All @@ -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'
Expand All @@ -206,6 +209,7 @@ export default {
components: {
StudipDialog,
Error,
MessageBox,
StudipButton,
VideoFilePreview,
Expand Down Expand Up @@ -329,7 +333,6 @@ export default {
}
uploadData['created'] = new Date(this.upload.recordDate).toISOString(),
delete uploadData['recordDate'];
uploadData['oc_acl'] = this.uploadService.uploadACL();
Expand Down
2 changes: 1 addition & 1 deletion vueapp/components/Videos/VideosList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
</MessageBox>
<h3 v-if="playlistForVideos">
{{ playlistForVideos.title }}
<div class="oc--tags">
<div class="oc--tags oc--tags-playlist">
<Tag v-for="tag in playlistForVideos.tags" v-bind:key="tag.id" :tag="tag.tag" />
</div>
</h3>
Expand Down
9 changes: 8 additions & 1 deletion vueapp/store/playlists.module.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
});
},

Expand Down Expand Up @@ -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;
},
Expand Down

0 comments on commit 06d2df8

Please sign in to comment.