mirror of
https://github.com/TeamPiped/Piped-Backend.git
synced 2024-08-14 23:51:41 +00:00
don't allow duplicated videos in a playlist
This commit is contained in:
parent
1261adeb31
commit
c76d1e0282
1 changed files with 5 additions and 0 deletions
|
@ -1413,6 +1413,11 @@ public class ResponseHelper {
|
|||
return mapper.writeValueAsBytes(mapper.createObjectNode()
|
||||
.put("error", "Playlist not found"));
|
||||
|
||||
for (PlaylistVideo video : playlist.getVideos()) {
|
||||
if (video.getId() == videoId) return mapper.writeValueAsBytes(mapper.createObjectNode()
|
||||
.put("error", "Playlist already contains the video"));
|
||||
};
|
||||
|
||||
if (playlist.getOwner().getId() != user.getId())
|
||||
return mapper.writeValueAsBytes(mapper.createObjectNode()
|
||||
.put("error", "You are not the owner this playlist"));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue