mirror of https://github.com/lidarr/Lidarr
Moved reqres for GetEpisodeFileById outside of the collection fetches
This commit is contained in:
parent
09c8504157
commit
e7052aebe4
|
@ -31,7 +31,7 @@ define(
|
||||||
var hasAired = Moment(this.model.get('airDateUtc')).isBefore(Moment());
|
var hasAired = Moment(this.model.get('airDateUtc')).isBefore(Moment());
|
||||||
var hasFile = this.model.get('hasFile');
|
var hasFile = this.model.get('hasFile');
|
||||||
|
|
||||||
if (hasFile) {
|
if (hasFile && reqres.hasHandler(reqres.Requests.GetEpisodeFileById)) {
|
||||||
var episodeFile = reqres.request(reqres.Requests.GetEpisodeFileById, this.model.get('episodeFileId'));
|
var episodeFile = reqres.request(reqres.Requests.GetEpisodeFileById, this.model.get('episodeFileId'));
|
||||||
|
|
||||||
this.listenTo(episodeFile, 'change', this._refresh);
|
this.listenTo(episodeFile, 'change', this._refresh);
|
||||||
|
|
|
@ -186,6 +186,10 @@ define(
|
||||||
this.episodeCollection = new EpisodeCollection({ seriesId: this.model.id }).bindSignalR();
|
this.episodeCollection = new EpisodeCollection({ seriesId: this.model.id }).bindSignalR();
|
||||||
this.episodeFileCollection = new EpisodeFileCollection({ seriesId: this.model.id }).bindSignalR();
|
this.episodeFileCollection = new EpisodeFileCollection({ seriesId: this.model.id }).bindSignalR();
|
||||||
|
|
||||||
|
reqres.setHandler(reqres.Requests.GetEpisodeFileById, function (episodeFileId) {
|
||||||
|
return self.episodeFileCollection.get(episodeFileId);
|
||||||
|
});
|
||||||
|
|
||||||
$.when(this.episodeCollection.fetch(), this.episodeFileCollection.fetch()).done(function () {
|
$.when(this.episodeCollection.fetch(), this.episodeFileCollection.fetch()).done(function () {
|
||||||
var seasonCollectionView = new SeasonCollectionView({
|
var seasonCollectionView = new SeasonCollectionView({
|
||||||
collection : self.seasonCollection,
|
collection : self.seasonCollection,
|
||||||
|
@ -193,10 +197,6 @@ define(
|
||||||
series : self.model
|
series : self.model
|
||||||
});
|
});
|
||||||
|
|
||||||
reqres.setHandler(reqres.Requests.GetEpisodeFileById, function (episodeFileId) {
|
|
||||||
return self.episodeFileCollection.get(episodeFileId);
|
|
||||||
});
|
|
||||||
|
|
||||||
self.seasons.show(seasonCollectionView);
|
self.seasons.show(seasonCollectionView);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in New Issue