1
0
mirror of https://github.com/Radarr/Radarr.git synced 2024-11-04 10:02:40 +01:00

Fixed: Allowing in use Profiles to be Deleted.

Fixes #2030
This commit is contained in:
Leonardo Galli 2018-01-30 13:11:16 +01:00
parent 931cdacf66
commit 3e2e085b6b

View File

@ -7,7 +7,7 @@ var EditProfileItemView = require('./EditProfileItemView');
var QualitySortableCollectionView = require('./QualitySortableCollectionView');
var EditProfileView = require('./EditProfileView');
var DeleteView = require('../DeleteProfileView');
var SeriesCollection = require('../../../Series/SeriesCollection');
var FullMovieCollection = require('../../../Movies/FullMovieCollection');
var Config = require('../../../Config');
var AsEditModalView = require('../../../Mixins/AsEditModalView');
@ -28,7 +28,7 @@ var view = Marionette.Layout.extend({
initialize : function(options) {
this.profileCollection = options.profileCollection;
this.itemsCollection = new Backbone.Collection(_.toArray(this.model.get('items')).reverse());
this.listenTo(SeriesCollection, 'all', this._updateDisableStatus);
this.listenTo(FullMovieCollection, 'all', this._updateDisableStatus);
},
onRender : function() {
@ -104,14 +104,14 @@ var view = Marionette.Layout.extend({
_updateDisableStatus : function() {
if (this._isQualityInUse()) {
this.ui.deleteButton.addClass('disabled');
this.ui.deleteButton.attr('title', 'Can\'t delete a profile that is attached to a series.');
this.ui.deleteButton.attr('title', 'Can\'t delete a profile that is attached to a movie.');
} else {
this.ui.deleteButton.removeClass('disabled');
}
},
_isQualityInUse : function() {
return SeriesCollection.where({ 'profileId' : this.model.id }).length !== 0;
return FullMovieCollection.where({ 'profileId' : this.model.id }).length !== 0;
}
});
module.exports = AsEditModalView.call(view);