Fix a race condition in teams
This commit is contained in:
parent
f341ac2637
commit
50e39f9945
@ -38,7 +38,9 @@ define([
|
|||||||
// Also pin the onlyoffice channels if they exist
|
// Also pin the onlyoffice channels if they exist
|
||||||
if (n.rtChannel) { toPin.push(n.rtChannel); }
|
if (n.rtChannel) { toPin.push(n.rtChannel); }
|
||||||
if (n.lastVersion) { toPin.push(n.lastVersion); }
|
if (n.lastVersion) { toPin.push(n.lastVersion); }
|
||||||
team.pin(toPin, function (obj) { console.error(obj); });
|
team.pin(toPin, function (obj) {
|
||||||
|
if (obj && obj.error) { console.error(obj.error); }
|
||||||
|
});
|
||||||
}
|
}
|
||||||
// Unpin the deleted pads (deleted <=> changed to undefined)
|
// Unpin the deleted pads (deleted <=> changed to undefined)
|
||||||
if (p[0] === UserObject.FILES_DATA && typeof(o) === "object" && o.channel && !n) {
|
if (p[0] === UserObject.FILES_DATA && typeof(o) === "object" && o.channel && !n) {
|
||||||
@ -51,7 +53,9 @@ define([
|
|||||||
// Also unpin the onlyoffice channels if they exist
|
// Also unpin the onlyoffice channels if they exist
|
||||||
if (o.rtChannel) { toUnpin.push(o.rtChannel); }
|
if (o.rtChannel) { toUnpin.push(o.rtChannel); }
|
||||||
if (o.lastVersion) { toUnpin.push(o.lastVersion); }
|
if (o.lastVersion) { toUnpin.push(o.lastVersion); }
|
||||||
team.unpin(toUnpin, function (obj) { console.error(obj); });
|
team.unpin(toUnpin, function (obj) {
|
||||||
|
if (obj && obj.error) { console.error(obj); }
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -692,7 +696,7 @@ define([
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
if ((!member || member.role !== 'OWNER') && teamData.owner) {
|
if (!member && teamData.owner) {
|
||||||
var removeOwnership = function (chan) {
|
var removeOwnership = function (chan) {
|
||||||
ctx.Store.setPadMetadata(null, {
|
ctx.Store.setPadMetadata(null, {
|
||||||
channel: chan,
|
channel: chan,
|
||||||
@ -764,6 +768,7 @@ define([
|
|||||||
var onError = function (res) {
|
var onError = function (res) {
|
||||||
var err = res && res.error;
|
var err = res && res.error;
|
||||||
if (err) {
|
if (err) {
|
||||||
|
console.error(err);
|
||||||
waitFor.abort();
|
waitFor.abort();
|
||||||
return void cb({error:err});
|
return void cb({error:err});
|
||||||
}
|
}
|
||||||
@ -822,6 +827,7 @@ define([
|
|||||||
var onError = function (res) {
|
var onError = function (res) {
|
||||||
var err = res && res.error;
|
var err = res && res.error;
|
||||||
if (err) {
|
if (err) {
|
||||||
|
console.error(err);
|
||||||
waitFor.abort();
|
waitFor.abort();
|
||||||
return void cb(err);
|
return void cb(err);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -452,7 +452,8 @@ define([
|
|||||||
// Name
|
// Name
|
||||||
var name = h('span.cp-team-member-name', data.displayName);
|
var name = h('span.cp-team-member-name', data.displayName);
|
||||||
if (data.pendingOwner) {
|
if (data.pendingOwner) {
|
||||||
$(name).append(h('em', " PENDING"));
|
$(name).append(h('em', " PENDING")); // XXX
|
||||||
|
// + XXX ability to demote yourself as owner if there is another owner
|
||||||
}
|
}
|
||||||
// Status
|
// Status
|
||||||
var status = h('span.cp-team-member-status'+(data.online ? '.online' : ''));
|
var status = h('span.cp-team-member-status'+(data.online ? '.online' : ''));
|
||||||
@ -468,9 +469,9 @@ define([
|
|||||||
title: Messages.team_rosterPromoteOwner
|
title: Messages.team_rosterPromoteOwner
|
||||||
});
|
});
|
||||||
$(promoteOwner).click(function () {
|
$(promoteOwner).click(function () {
|
||||||
$(promoteOwner).hide();
|
|
||||||
UI.confirm(Messages.team_ownerConfirm, function (yes) {
|
UI.confirm(Messages.team_ownerConfirm, function (yes) {
|
||||||
if (!yes) { return; }
|
if (!yes) { return; }
|
||||||
|
$(promoteOwner).hide();
|
||||||
APP.module.execCommand('OFFER_OWNERSHIP', {
|
APP.module.execCommand('OFFER_OWNERSHIP', {
|
||||||
teamId: APP.team,
|
teamId: APP.team,
|
||||||
curvePublic: data.curvePublic
|
curvePublic: data.curvePublic
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user