[Libreoffice-commits] online.git: loleaflet/src

Jan Holesovsky kendy at collabora.com
Thu Jun 1 20:08:41 UTC 2017


 loleaflet/src/layer/AnnotationManager.js |    6 +++---
 loleaflet/src/map/Map.js                 |    4 +++-
 2 files changed, 6 insertions(+), 4 deletions(-)

New commits:
commit 0033607f01e623fb121b8a47fc5299a141ce4698
Author: Jan Holesovsky <kendy at collabora.com>
Date:   Thu Jun 1 21:56:21 2017 +0200

    loleaflet: Many of the WOPI impls. do not provide avatars yet.
    
    Change-Id: If72a6be9102cb96fe1a6b31f85c0e47bb0622558

diff --git a/loleaflet/src/layer/AnnotationManager.js b/loleaflet/src/layer/AnnotationManager.js
index a32ed91c..0c5ffb26 100644
--- a/loleaflet/src/layer/AnnotationManager.js
+++ b/loleaflet/src/layer/AnnotationManager.js
@@ -123,7 +123,7 @@ L.AnnotationManager = L.Class.extend({
 		for (var index in comments) {
 			comment = comments[index];
 			this.adjustComment(comment);
-			if (this._map._viewInfoByUser[comment.author]) {
+			if (comment.author in this._map._viewInfoByUser) {
 				comment.avatar = this._map._viewInfoByUser[comment.author].userextrainfo.avatar;
 			}
 			this._items.push(L.annotation(this._map.options.maxBounds.getSouthEast(), comment).addTo(this._map));
@@ -151,7 +151,7 @@ L.AnnotationManager = L.Class.extend({
 				// something wrong in this redline, skip this one
 				continue;
 			}
-			if (this._map._viewInfoByUser[changecomment.author]) {
+			if (changecomment.author in this._map._viewInfoByUser) {
 				changecomment.avatar = this._map._viewInfoByUser[changecomment.author].userextrainfo.avatar;
 			}
 			this._items.push(L.annotation(this._map.options.maxBounds.getSouthEast(), changecomment).addTo(this._map));
@@ -525,7 +525,7 @@ L.AnnotationManager = L.Class.extend({
 		var id;
 		var changetrack = obj.redline ? true : false;
 		var action = changetrack ? obj.redline.action : obj.comment.action;
-		if (this._map._viewInfoByUser[obj.comment.author]) {
+		if (obj.comment.author in this._map._viewInfoByUser) {
 			obj.comment.avatar = this._map._viewInfoByUser[obj.comment.author].userextrainfo.avatar;
 		}
 
diff --git a/loleaflet/src/map/Map.js b/loleaflet/src/map/Map.js
index 32b07f73..f969cd4a 100644
--- a/loleaflet/src/map/Map.js
+++ b/loleaflet/src/map/Map.js
@@ -161,7 +161,9 @@ L.Map = L.Evented.extend({
 
 	addView: function(viewInfo) {
 		this._viewInfo[viewInfo.id] = viewInfo;
-		this._viewInfoByUser[viewInfo.userid] = viewInfo;
+		if (viewInfo.userextrainfo !== undefined && viewInfo.userextrainfo.avatar !== undefined) {
+			this._viewInfoByUser[viewInfo.userid] = viewInfo;
+		}
 		this.fire('postMessage', {msgId: 'View_Added', args: {ViewId: viewInfo.id, UserId: viewInfo.userid, UserName: viewInfo.username, UserExtraInfo: viewInfo.userextrainfo, Color: L.LOUtil.rgbToHex(viewInfo.color), ReadOnly: viewInfo.readonly}});
 
 		// Fire last, otherwise not all events are handled correctly.


More information about the Libreoffice-commits mailing list