Skip to content

Commit

Permalink
Delete course playlist (#1121)
Browse files Browse the repository at this point in the history
  • Loading branch information
dennis531 authored Jan 13, 2025
1 parent facfc0b commit 9e8acf7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 12 deletions.
11 changes: 3 additions & 8 deletions lib/Routes/Course/CourseRemovePlaylist.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,19 +27,14 @@ public function __invoke(Request $request, Response $response, $args)
throw new \AccessDeniedException();
}

// check what permissions the current user has on the playlist and video
$perm_playlist = reset($playlist->perms->findBy('user_id', $user->id)->toArray());

if (empty($perm_playlist))
{
throw new \AccessDeniedException();
}

PlaylistSeminars::deleteBySql('playlist_id = :playlist_id AND seminar_id = :course_id',[
':playlist_id' => $playlist->id,
':course_id' => $course_id
]);

// Remove playlist completely to prevent ghost playlists because playlists are disabled in work place
$playlist->delete();

return $response->withStatus(204);
}
}
8 changes: 4 additions & 4 deletions vueapp/components/Videos/VideosTable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -143,10 +143,10 @@
<span v-if="isCourse && playlist && canEdit">
<StudipButton class="wrap-button"
v-if="playlist.is_default != '1'"
@click.prevent="removePlaylistFromCourse(playlist.token, cid)"
@click.prevent="removePlaylist(playlist.token, cid)"
>
<studip-icon shape="trash" role="clickable" />
{{ $gettext('Wiedergabeliste aus diesem Kurs entfernen') }}
{{ $gettext('Wiedergabeliste entfernen') }}
</StudipButton>
</span>
</td>
Expand Down Expand Up @@ -584,8 +584,8 @@ export default {
this.selectedEvent = null;
},
removePlaylistFromCourse(token, cid) {
if (confirm(this.$gettext('Sind sie sicher, dass sie diese Wiedergabeliste aus dem Kurs entfernen möchten?'))) {
removePlaylist(token, cid) {
if (confirm(this.$gettext('Sind Sie sicher, dass Sie diese Wiedergabeliste entfernen möchten?'))) {
this.$store.dispatch('setPlaylist', null);
this.$store.dispatch('removePlaylistFromCourse', {
token: token,
Expand Down

0 comments on commit 9e8acf7

Please sign in to comment.