Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
leaflet: fixed incorrect info shown on the comment reply vex dialog
instead of the current author and date,
it showed the date and author of the original comment we are replying to.
It caused many problems in the development of comment wizard.

Signed-off-by: Pranam Lashkari <lpranam@collabora.com>
Change-Id: Iad3cc8dd8b3053c73ce1f575ff5d50ba3c666c70
  • Loading branch information
lpranam committed Nov 16, 2020
1 parent b3ce314 commit d28567b
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 3 deletions.
16 changes: 15 additions & 1 deletion loleaflet/src/layer/AnnotationManager.js
Expand Up @@ -638,7 +638,21 @@ L.AnnotationManager = L.AnnotationManagerBase.extend({

reply: function (annotation) {
if (window.mode.isMobile() || window.mode.isTablet()) {
this._doclayer.newAnnotationVex(annotation, annotation._onReplyClick,/* isMod */ true, '');
var avatar = undefined;
var author = this._map.getViewName(this._map._docLayer._viewId);
if (author in this._map._viewInfoByUserName) {
avatar = this._map._viewInfoByUserName[author].userextrainfo.avatar;
}
var replyAnnotation = {
text: '',
textrange: '',
author: author,
dateTime: new Date().toDateString(),
id: annotation._data.id,
avatar: avatar,
parent: annotation._data.parent
};
this._doclayer.newAnnotationVex(replyAnnotation, annotation._onReplyClick,/* isMod */ false, '');
}
else {
annotation.reply();
Expand Down
16 changes: 15 additions & 1 deletion loleaflet/src/layer/AnnotationManagerImpress.js
Expand Up @@ -131,7 +131,21 @@ L.AnnotationManagerImpress = L.AnnotationManagerBase.extend({
this.onAnnotationCancel();
this._selectedAnnotation = annotation._data.id;
if (window.mode.isMobile() || window.mode.isTablet()) {
this._doclayer.newAnnotationVex(annotation, annotation._onReplyClick,/* isMod */ true, '');
var avatar = undefined;
var author = this._map.getViewName(this._map._docLayer._viewId);
if (author in this._map._viewInfoByUserName) {
avatar = this._map._viewInfoByUserName[author].userextrainfo.avatar;
}
var replyAnnotation = {
text: '',
textrange: '',
author: author,
dateTime: new Date().toDateString(),
id: annotation._data.id,
avatar: avatar,
parent: annotation._data.parent
};
this._doclayer.newAnnotationVex(replyAnnotation, annotation._onReplyClick,/* isMod */ false, '');
} else {
annotation.reply();
this.scrollUntilAnnotationIsVisible(annotation);
Expand Down
2 changes: 1 addition & 1 deletion loleaflet/src/layer/marker/Annotation.js
Expand Up @@ -377,7 +377,7 @@ L.Annotation = L.Layer.extend({
_onReplyClick: function (e) {
L.DomEvent.stopPropagation(e);
if (window.mode.isMobile() || window.mode.isTablet()) {
e.annotation._data.reply = e.annotation.text;
e.annotation._data.reply = e.annotation._data.text;
e.annotation.show();
e.annotation._checkBounds();
this._map.fire('AnnotationReply', {annotation: e.annotation});
Expand Down

0 comments on commit d28567b

Please sign in to comment.