[SSE] Comment: Bug 36927. Don't render comments when left comments panel is closed.

This commit is contained in:
Julia Radzhabova 2018-02-14 12:14:22 +03:00
parent 104ce55de4
commit 42949a67aa

View file

@ -571,6 +571,16 @@ define([
}, },
onUpdateFilter: function (filter, applyOnly) { onUpdateFilter: function (filter, applyOnly) {
if (filter && !this.view.isVisible()) {
this.view.needUpdateFilter = filter;
this.filter = {
property : filter.property,
value : filter.value
};
return;
}
this.view.needUpdateFilter = false;
if (filter) { if (filter) {
this.filter = { this.filter = {
@ -589,11 +599,11 @@ define([
this.collection.each(function (model) { this.collection.each(function (model) {
var prop = model.get(t.filter.property); var prop = model.get(t.filter.property);
if (prop) { if (prop) {
model.set('hide', (null === prop.match(t.filter.value))); model.set('hide', (null === prop.match(t.filter.value)), {silent: !!applyOnly});
} }
if (model.get('last')) { if (model.get('last')) {
model.set('last', false); model.set('last', false, {silent:!!applyOnly});
} }
if (!model.get('hide')) { if (!model.get('hide')) {
@ -602,8 +612,10 @@ define([
}); });
if (endComment) { if (endComment) {
endComment.set('last', true); endComment.set('last', true, {silent: !!applyOnly});
} }
if (!applyOnly)
this.view.update();
} }
}, },
onAppAddComment: function (sender, to_doc) { onAppAddComment: function (sender, to_doc) {
@ -956,6 +968,12 @@ define([
// internal // internal
updateComments: function (needRender, disableSort) { updateComments: function (needRender, disableSort) {
if (needRender && !this.view.isVisible()) {
this.view.needRender = needRender;
return;
}
this.view.needRender = false;
var me = this; var me = this;
me.updateCommentsTime = new Date(); me.updateCommentsTime = new Date();
if (me.timerUpdateComments===undefined) if (me.timerUpdateComments===undefined)
@ -1291,7 +1309,10 @@ define([
if ('none' !== panel.css('display')) { if ('none' !== panel.css('display')) {
this.view.txtComment.focus(); this.view.txtComment.focus();
} }
if (this.view.needRender)
this.updateComments(true);
else if (this.view.needUpdateFilter)
this.onUpdateFilter(this.view.needUpdateFilter);
this.view.update(); this.view.update();
} }
} }