Skip to content

Commit

Permalink
prevent showing wrong episode in certain circumstances
Browse files Browse the repository at this point in the history
  • Loading branch information
kkuepper committed Nov 5, 2024
1 parent 0f82989 commit 6ae2b74
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions admin/app/scripts/controllers/next_episode.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,10 @@ angular.module('bmmApp')

if (oldEpisodesIndex < minOldEpisodes && episodes.length == maxEpisodes) {
// In case all the episodes are unpublished episodes we load the next 30 episodes
var preserveIndex = $scope.episodeShowedIndex;
init(offset);
if (preserveIndex !== 0)
$scope.episodeShowedIndex = preserveIndex;
}
};

Expand Down Expand Up @@ -192,8 +195,10 @@ angular.module('bmmApp')
$scope.podcast = podcast;

_api.podcastTracksGet($routeParams.id, {size: maxEpisodes, from: offset, unpublished: 'show'}).then(function(episodes) {
getNextEpisodesIds(episodes);
getEpisodeInformation();
if (episodes.length > 0) {
getNextEpisodesIds(episodes);
getEpisodeInformation();
}
});

}).fail(function() {
Expand Down

0 comments on commit 6ae2b74

Please sign in to comment.