Fix favorites

This commit is contained in:
Julia Radzhabova 2020-12-15 17:28:12 +03:00
parent 04d02d051b
commit 2c5e7f8d00
4 changed files with 5 additions and 5 deletions

View file

@ -477,7 +477,7 @@ define([
$html.find('#slot-btn-back').hide();
}
if ( this.options.favorite !== undefined ) {
if ( this.options.favorite !== undefined && this.options.favorite!==null) {
me.btnFavorite.render($html.find('#slot-btn-favorite'));
me.btnFavorite.changeIcon(!!me.options.favorite ? {next: 'btn-in-favorite'} : {curr: 'btn-in-favorite'});
me.btnFavorite.updateHint(!me.options.favorite ? me.textAddFavorite : me.textRemoveFavorite);
@ -606,7 +606,7 @@ define([
setFavorite: function (value) {
this.options.favorite = value;
this.btnFavorite[value!==undefined ? 'show' : 'hide']();
this.btnFavorite[value!==undefined && value!==null ? 'show' : 'hide']();
this.btnFavorite.changeIcon(!!value ? {next: 'btn-in-favorite'} : {curr: 'btn-in-favorite'});
this.btnFavorite.updateHint(!value ? this.textAddFavorite : this.textRemoveFavorite);

View file

@ -442,7 +442,7 @@ define([
this.permissions.edit = this.permissions.review = false;
}
this.appOptions.canFavorite = data.doc.info && (data.doc.info.favorite!==undefined);
this.appOptions.canFavorite = data.doc.info && (data.doc.info.favorite!==undefined && data.doc.info.favorite!==null);
}
this.api.asc_registerCallback('asc_onGetEditorPermissions', _.bind(this.onEditorPermissions, this));

View file

@ -393,7 +393,7 @@ define([
enable = !this.editorConfig.customization || (this.editorConfig.customization.plugins!==false);
docInfo.asc_putIsEnabledPlugins(!!enable);
this.appOptions.canFavorite = data.doc.info && (data.doc.info.favorite!==undefined);
this.appOptions.canFavorite = data.doc.info && (data.doc.info.favorite!==undefined && data.doc.info.favorite!==null);
}
this.api.asc_registerCallback('asc_onGetEditorPermissions', _.bind(this.onEditorPermissions, this));

View file

@ -446,7 +446,7 @@ define([
docInfo.asc_putIsEnabledPlugins(!!enable);
this.headerView && this.headerView.setDocumentCaption(data.doc.title);
this.appOptions.canFavorite = data.doc.info && (data.doc.info.favorite!==undefined);
this.appOptions.canFavorite = data.doc.info && (data.doc.info.favorite!==undefined && data.doc.info.favorite!==null);
this.appOptions.canFavorite && this.headerView && this.headerView.setFavorite(data.doc.info.favorite);
Common.Utils.InternalSettings.set("sse-doc-info-key", data.doc.key);