Merge branch 'staging' into latest-broadcast

This commit is contained in:
ansuz 2021-04-01 16:19:03 +05:30
commit 57080dd5ca
4 changed files with 117 additions and 78 deletions

View file

@ -1,19 +1,34 @@
# 4.3.1 (WIP)
# WIP
* OnlyOffice
* inform OnlyOffice of userlist changes
* rename doc and slide editors
* handle different lock formats for docs and slides
* relative to sheets
* handle some cursor logic outside of sheets
* handle locks when integrating remote checkpoints in strict mode
* OnlyOffice renamed buttons in slides and docs and we need to hardcode CSS that hides them by their randomly generated IDs
* support CryptPad cursor colors in OnlyOffice by adding opacity value
* use the appropriate APIs to detect if the document is modified
* display users cursor colors in the toolbar next to their name
* handle errors when migrating in embed mode
* change the method we use to lock the whole sheet since OnlyOffice changed their internal API's behaviour
* bad channel IDs stored in your drive or accessed via bad links (corrupted somehow)
* don't try to join invalid channels
* don't try to get their metadata
* prompt premium users to cancel their subscriptions before deleting their accounts
# 4.3.1
This minor release addresses some bugs discovered after deploying and tagging 4.3.0
* better isLoggedIn() check
* fix templates in sheets
* include onlyOffice version along with checkpoint hashes
* send feedback when opening the readme
* so we can decide whether to remove it
* handle decryption errors for blobs
* prompted by a badly formed sheet checkpoint
* fix broken team creation
* CKEditor
* broken table of contents scrollTo
* show the link bubble for links inside of comments
* fix title reset in polls
* We found that some browser extensions interfered with checks to determine whether a registered user was correctly logged in, which resulted in some disabled functionality. If you are running extensions that actively delete the tokens that keep you logged your session should now stay alive until you close all its active tabs, after which you will have to log back in.
* Our 4.2.0 update introduced a new internal format for spreadsheets which broke support for spreadsheet templates using the older format. This release implements a compatibility layer.
* We fixed some minor bugs in our rich text editor. Section links in the table of contents now navigate correctly. Adding a comment to a link no longer prevents clicking on that link.
* A race condition that caused poll titles to reset occasionally has been fixed.
* We've added a little bit of telemetry to tell our server when a newly registered user opens the new user guide which is automatically added to their drive. We're considering either rewriting or removing this guide, so it's helpful to be able to determine how often people actually read it.
* An error introduced in 4.3.0 was preventing the creation of new teams. It's been fixed.
* 4.3.0 temporarily broke the sheet editor for iPad users. Migrations to a new internal format that were run while the editor was in a bad state produced some invalid data that prevented sheets from loading correctly. This release improves the platforms ability to recover from bad states like this and improves its ability to detect the kind of errors we observed.
# 4.3.0 (D)

View file

@ -79,6 +79,7 @@ define([
var toolbar;
var cursor;
var andThen = function (common) {
@ -871,17 +872,6 @@ define([
return locks;
};
var locksArrayToObject = function (arr) {
var l = {};
if (!Array.isArray(arr)) { return l; }
arr.forEach(function (lock) {
var uid = lock.block;
if (!uid) { return; }
l[uid] = lock;
});
return l;
};
// Update the userlist in onlyoffice
var handleNewIds = function (o, n) {
if (stringify(o) === stringify(n)) { return; }
@ -1297,7 +1287,6 @@ define([
if (APP.ooconfig && !force) { return void console.error('already started'); }
var url = URL.createObjectURL(blob);
var lock = !APP.history && (APP.migrate);
var type = common.getMetadataMgr().getPrivateData().ooType;
// Starting from version 3, we can use the view mode again
// defined but never used
@ -1420,7 +1409,7 @@ define([
// Migration required but read-only: continue...
if (readOnly) {
setEditable(true);
getEditor().setViewModeDisconnect();
try { getEditor().asc_setRestriction(true); } catch (e) {}
} else {
// No changes after the cp: migrate now
onMigrateRdy.fire();
@ -1445,12 +1434,9 @@ define([
return;
}
if (lock) {
getEditor().setViewModeDisconnect();
} else if (readOnly) {
try {
getEditor().asc_setRestriction(true);
} catch (e) {}
if (lock || readOnly) {
try { getEditor().asc_setRestriction(true); } catch (e) {}
//getEditor().setViewModeDisconnect(); // can't be used anymore, display an OO error popup
} else {
setEditable(true);
deleteOfflineLocks();
@ -1470,7 +1456,6 @@ define([
}
}
if (isLockedModal.modal && force) {
isLockedModal.modal.closeModal();
delete isLockedModal.modal;
@ -1480,7 +1465,8 @@ define([
}
if (APP.template) {
getEditor().setViewModeDisconnect();
try { getEditor().asc_setRestriction(true); } catch (e) {}
//getEditor().setViewModeDisconnect();
UI.removeLoadingScreen();
makeCheckpoint(true);
return;
@ -1494,7 +1480,7 @@ define([
} catch (e) {}
}
if (APP.migrate && !readOnly) {
if (lock && !readOnly) {
onMigrateRdy.fire();
}
@ -1605,9 +1591,6 @@ define([
APP.getImageURL = function(name, callback) {
if (name && /^data:image/.test(name)) {
return void callback('');
var b = Util.dataURIToBlob(name);
var url = URL.createObjectURL(blob);
return void callback(url);
}
var mediasSources = getMediasSources();
@ -2079,7 +2062,7 @@ define([
UI.removeModals();
UI.confirm(Messages.oo_uploaded, function (yes) {
try {
getEditor().setViewModeDisconnect();
getEditor().asc_setRestriction(true);
} catch (e) {}
if (!yes) { return; }
common.gotoURL();
@ -2246,7 +2229,9 @@ define([
APP.history = true;
APP.template = true;
var editor = getEditor();
if (editor) { editor.setViewModeDisconnect(); }
if (editor) {
try { getEditor().asc_setRestriction(true); } catch (e) {}
}
var content = parsed.content;
// Get checkpoint
@ -2386,7 +2371,7 @@ define([
var setHistoryMode = function (bool) {
if (bool) {
APP.history = true;
getEditor().setViewModeDisconnect();
try { getEditor().asc_setRestriction(true); } catch (e) {}
return;
}
// Cancel button: redraw from lastCp
@ -2593,7 +2578,11 @@ define([
APP.onLocal();
} else {
msg = h('div.alert.alert-warning.cp-burn-after-reading', Messages.oo_sheetMigration_anonymousEditor);
$(APP.helpMenu.menu).after(msg);
if (APP.helpMenu) {
$(APP.helpMenu.menu).after(msg);
} else {
$('#cp-app-oo-editor').prepend(msg);
}
readOnly = true;
}
} else if (content && content.version <= 3) { // V2 or V3
@ -2605,7 +2594,11 @@ define([
APP.onLocal();
} else {
msg = h('div.alert.alert-warning.cp-burn-after-reading', Messages.oo_sheetMigration_anonymousEditor);
$(APP.helpMenu.menu).after(msg);
if (APP.helpMenu) {
$(APP.helpMenu.menu).after(msg);
} else {
$('#cp-app-oo-editor').prepend(msg);
}
readOnly = true;
}
}
@ -2673,7 +2666,7 @@ define([
// Cursor update
if (!data || !data.cursor) { return; }
// Store the new cursor in memory for this user, with their netflux ID
var ooid = Util.find(data.cursor, ['messages', 0, 'user'])
var ooid = Util.find(data.cursor, ['messages', 0, 'user']);
if (ooid) { cursors[ooid] = data.id.slice(0,32); }
// Update cursor in the UI
ooChannel.send(data.cursor);

View file

@ -31,7 +31,6 @@ define([
cursor: client.cursor
};
chan.sendMsg(JSON.stringify(data));
console.error(data);
ctx.emit('MESSAGE', data, chan.clients.filter(function (cl) {
return cl !== clientId;
}));

View file

@ -469,6 +469,10 @@ define([
});
}, true);
Messages.settings_deleteWarning = "Warning: it seems you're subscribed to a premium plan (paid or given by another user). Please cancel paid subscriptions before deleting your account as you won't be able to do it yourself once the account is deleted."; // XXX
Messages.settings_deleteContinue = "Delete my account"; // XXX
Messages.settings_deleteSubscription = "Manage my subscription"; // XXX
makeBlock('delete', function(cb) { // Msg.settings_deleteHint, .settings_deleteTitle
if (!common.isLoggedIn()) { return cb(false); }
@ -488,41 +492,69 @@ define([
classes: 'btn-danger',
multiple: true
}, function() {
$button.prop('disabled', 'disabled');
var password = $form.find('#cp-settings-delete-account').val();
if (!password) {
return void UI.warn(Messages.error);
}
spinner.spin();
sframeChan.query("Q_SETTINGS_DELETE_ACCOUNT", {
password: password
}, function(err, data) {
if (data && data.error) {
spinner.hide();
$button.prop('disabled', '');
if (data.error === 'INVALID_PASSWORD') {
return void UI.warn(Messages.drive_sfPasswordError);
}
console.error(data.error);
nThen(function (waitFor) {
$button.prop('disabled', 'disabled');
var priv = metadataMgr.getPrivateData();
// Check if subscriptions are enabled and you have a premium plan
if (priv.plan && priv.plan !== "custom" && ApiConfig.allowSubscriptions) {
// Also make sure upgradeURL is defined
var url = priv.accounts && priv.accounts.upgradeURL;
if (!url) { return; }
url += '#mysubs';
var a = h('a', { href:url }, Messages.settings_deleteSubscription);
$(a).click(function (e) {
e.preventDefault();
common.openUnsafeURL(url);
});
UI.confirm(h('div', [
Messages.settings_deleteWarning, h('p', a)
]), waitFor(function (yes) {
if (!yes) {
$button.prop('disabled', '');
waitFor.abort();
}
}), {
ok: Messages.settings_deleteContinue,
okClass: 'btn.btn-danger',
cancelClass: 'btn.btn-primary'
});
}
}).nThen(function () {
var password = $form.find('#cp-settings-delete-account').val();
if (!password) {
return void UI.warn(Messages.error);
}
// Owned drive
if (data.state === true) {
sframeChan.query('Q_SETTINGS_LOGOUT', null, function() {});
UI.alert(Messages.settings_deleted, function() {
common.gotoURL('/');
});
spinner.done();
return;
}
// Not owned drive
var msg = h('div.cp-app-settings-delete-alert', [
h('p', Messages.settings_deleteModal),
h('pre', JSON.stringify(data, 0, 2))
]);
UI.alert(msg);
spinner.hide();
$button.prop('disabled', '');
spinner.spin();
sframeChan.query("Q_SETTINGS_DELETE_ACCOUNT", {
password: password
}, function(err, data) {
if (data && data.error) {
spinner.hide();
$button.prop('disabled', '');
if (data.error === 'INVALID_PASSWORD') {
return void UI.warn(Messages.drive_sfPasswordError);
}
console.error(data.error);
return void UI.warn(Messages.error);
}
// Owned drive
if (data.state === true) {
sframeChan.query('Q_SETTINGS_LOGOUT', null, function() {});
UI.alert(Messages.settings_deleted, function() {
common.gotoURL('/');
});
spinner.done();
return;
}
// Not owned drive
var msg = h('div.cp-app-settings-delete-alert', [
h('p', Messages.settings_deleteModal),
h('pre', JSON.stringify(data, 0, 2))
]);
UI.alert(msg);
spinner.hide();
$button.prop('disabled', '');
});
});
});