fix changing map ownership broken

cf #780
This commit is contained in:
Yohan Boniface 2020-11-08 17:39:01 +01:00
parent 3089b71705
commit 70eec17555

View file

@ -36,11 +36,11 @@ L.U.MapPermissions = L.Class.extend({
}, },
isOwner: function () { isOwner: function () {
return this.map.options.user && this.options.owner && this.map.options.user.id == this.options.owner.id; return this.map.options.user && this.map.options.permissions.owner && this.map.options.user.id == this.map.options.permissions.owner.id;
}, },
isAnonymousMap: function () { isAnonymousMap: function () {
return !this.options.owner; return !this.map.options.permissions.owner;
}, },
getMap: function () { getMap: function () {
@ -111,6 +111,7 @@ L.U.MapPermissions = L.Class.extend({
data: formData, data: formData,
context: this, context: this,
callback: function (data) { callback: function (data) {
this.commit();
this.isDirty = false; this.isDirty = false;
this.map.continueSaving(); this.map.continueSaving();
} }
@ -133,6 +134,10 @@ L.U.MapPermissions = L.Class.extend({
owner.textContent = this.options.owner.name; owner.textContent = this.options.owner.name;
ownerContainer.appendChild(owner); ownerContainer.appendChild(owner);
} }
},
commit: function () {
L.Util.extend(this.map.options.permissions, this.options);
} }
}); });