forgot to check editable status on the chain opn

This commit is contained in:
2025-03-14 18:00:45 -07:00
parent 852c907d35
commit ef3a055c06
2 changed files with 27 additions and 8 deletions

View File

@@ -687,6 +687,19 @@ const populateChain: RequestHandler = async (req, res) => {
// (although that's a challenge of its own)
const newGraph = new myGraph(playlistIDs, allLinks);
const affectedPlaylists = newGraph.getAllHeads(rootPl.id);
const editableStatuses = await Promise.all(
affectedPlaylists.map((pl) => {
return checkPlaylistEditable({
authHeaders,
playlistID: pl,
userID: uID,
});
})
);
if (editableStatuses.some((statusObj) => statusObj.status === false))
return null;
const affectedPlaylistsTracks = await Promise.all(
affectedPlaylists.map((pl) => {
return _getPlaylistTracks({ res, authHeaders, playlistID: pl });