Sort comments in the popover by ascending creation time
This commit is contained in:
parent
5636a4d266
commit
5a3f316bfe
|
@ -147,7 +147,7 @@ define([
|
||||||
|
|
||||||
this.popoverComments = new Common.Collections.Comments();
|
this.popoverComments = new Common.Collections.Comments();
|
||||||
if (this.popoverComments) {
|
if (this.popoverComments) {
|
||||||
this.popoverComments.comparator = function (collection) { return -collection.get('time'); };
|
this.popoverComments.comparator = function (collection) { return collection.get('time'); };
|
||||||
}
|
}
|
||||||
|
|
||||||
this.view = this.createView('Common.Views.Comments', { store: this.collection });
|
this.view = this.createView('Common.Views.Comments', { store: this.collection });
|
||||||
|
@ -831,9 +831,8 @@ define([
|
||||||
saveTxtReplyId = '',
|
saveTxtReplyId = '',
|
||||||
comment = null,
|
comment = null,
|
||||||
text = '',
|
text = '',
|
||||||
animate = true;
|
animate = true,
|
||||||
|
comments = [];
|
||||||
this.popoverComments.reset();
|
|
||||||
|
|
||||||
for (i = 0; i < uids.length; ++i) {
|
for (i = 0; i < uids.length; ++i) {
|
||||||
saveTxtId = uids[i];
|
saveTxtId = uids[i];
|
||||||
|
@ -871,11 +870,15 @@ define([
|
||||||
this.isSelectedComment = !hint || !this.hintmode;
|
this.isSelectedComment = !hint || !this.hintmode;
|
||||||
this.uids = _.clone(uids);
|
this.uids = _.clone(uids);
|
||||||
|
|
||||||
this.popoverComments.push(comment);
|
comments.push(comment);
|
||||||
if (!this._dontScrollToComment)
|
if (!this._dontScrollToComment)
|
||||||
this.view.commentsView.scrollToRecord(comment);
|
this.view.commentsView.scrollToRecord(comment);
|
||||||
this._dontScrollToComment = false;
|
this._dontScrollToComment = false;
|
||||||
}
|
}
|
||||||
|
comments.sort(function (a, b) {
|
||||||
|
return a.get('time') - b.get('time');
|
||||||
|
});
|
||||||
|
this.popoverComments.reset(comments);
|
||||||
|
|
||||||
if (popover.isVisible()) {
|
if (popover.isVisible()) {
|
||||||
popover.hide();
|
popover.hide();
|
||||||
|
@ -937,9 +940,7 @@ define([
|
||||||
if (this.isModeChanged)
|
if (this.isModeChanged)
|
||||||
this.onApiShowComment(uids, posX, posY, leftX);
|
this.onApiShowComment(uids, posX, posY, leftX);
|
||||||
if (0 === this.popoverComments.length) {
|
if (0 === this.popoverComments.length) {
|
||||||
|
var comments = [];
|
||||||
this.popoverComments.reset();
|
|
||||||
|
|
||||||
for (i = 0; i < uids.length; ++i) {
|
for (i = 0; i < uids.length; ++i) {
|
||||||
saveTxtId = uids[i];
|
saveTxtId = uids[i];
|
||||||
saveTxtReplyId = uids[i] + '-R';
|
saveTxtReplyId = uids[i] + '-R';
|
||||||
|
@ -956,8 +957,12 @@ define([
|
||||||
text = this.subEditStrings[saveTxtReplyId];
|
text = this.subEditStrings[saveTxtReplyId];
|
||||||
}
|
}
|
||||||
|
|
||||||
this.popoverComments.push(comment);
|
comments.push(comment);
|
||||||
}
|
}
|
||||||
|
comments.sort(function (a, b) {
|
||||||
|
return a.get('time') - b.get('time');
|
||||||
|
});
|
||||||
|
this.popoverComments.reset(comments);
|
||||||
|
|
||||||
useAnimation = true;
|
useAnimation = true;
|
||||||
this.getPopover().showComments(useAnimation, undefined, undefined, text);
|
this.getPopover().showComments(useAnimation, undefined, undefined, text);
|
||||||
|
|
Loading…
Reference in a new issue