From bc19071d5b20baea93de5693d1001d46ad5cc6e9 Mon Sep 17 00:00:00 2001 From: ansuz Date: Wed, 31 Mar 2021 12:34:56 +0530 Subject: [PATCH 01/12] 4.3.1 changelog --- CHANGELOG.md | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c1f716e26..b4cb031c9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,18 +2,13 @@ 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) From 2775006830bb36dd3564dbc18aef0e92e285710a Mon Sep 17 00:00:00 2001 From: ansuz Date: Wed, 31 Mar 2021 13:45:56 +0530 Subject: [PATCH 02/12] remove WIP from changelog title for 4.3.1 --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b4cb031c9..324c03785 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,4 @@ -# 4.3.1 (WIP) +# 4.3.1 This minor release addresses some bugs discovered after deploying and tagging 4.3.0 From 1fc162649c73baca0e4b8b65ffd411781d0a0f0d Mon Sep 17 00:00:00 2001 From: ansuz Date: Wed, 31 Mar 2021 13:45:56 +0530 Subject: [PATCH 03/12] remove WIP from changelog title for 4.3.1 --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b4cb031c9..324c03785 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,4 @@ -# 4.3.1 (WIP) +# 4.3.1 This minor release addresses some bugs discovered after deploying and tagging 4.3.0 From 7731cb603f967b1641a753f5b3f40e60ee628e39 Mon Sep 17 00:00:00 2001 From: yflory Date: Wed, 31 Mar 2021 11:35:13 +0200 Subject: [PATCH 04/12] Add a warning when a premium user is deleting their account --- www/settings/inner.js | 98 ++++++++++++++++++++++++++++--------------- 1 file changed, 65 insertions(+), 33 deletions(-) diff --git a/www/settings/inner.js b/www/settings/inner.js index 38969f823..5404d399c 100644 --- a/www/settings/inner.js +++ b/www/settings/inner.js @@ -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); - 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('/'); + 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' }); - 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', ''); + }).nThen(function () { + 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); + 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', ''); + }); }); }); From f7a98cc92770711829ccf2e376c00f65cf7e8fdd Mon Sep 17 00:00:00 2001 From: yflory Date: Wed, 31 Mar 2021 12:23:46 +0200 Subject: [PATCH 05/12] lint compliance --- www/common/onlyoffice/inner.js | 18 ++---------------- 1 file changed, 2 insertions(+), 16 deletions(-) diff --git a/www/common/onlyoffice/inner.js b/www/common/onlyoffice/inner.js index 656ddf9f1..486fcb3af 100644 --- a/www/common/onlyoffice/inner.js +++ b/www/common/onlyoffice/inner.js @@ -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 @@ -1605,9 +1594,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(); @@ -2673,7 +2659,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); From 0d079e0082c51d21f5e333ef50fc20f07769e9ff Mon Sep 17 00:00:00 2001 From: yflory Date: Wed, 31 Mar 2021 12:27:20 +0200 Subject: [PATCH 06/12] Remove debugging logs --- www/common/outer/cursor.js | 1 - 1 file changed, 1 deletion(-) diff --git a/www/common/outer/cursor.js b/www/common/outer/cursor.js index 5d40ea2b2..95b2b34c6 100644 --- a/www/common/outer/cursor.js +++ b/www/common/outer/cursor.js @@ -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; })); From 4b343ca5a2ad8e9fb7ce74e02c88152aa050dbff Mon Sep 17 00:00:00 2001 From: ansuz Date: Wed, 31 Mar 2021 16:33:16 +0530 Subject: [PATCH 07/12] WIP CHANGELOG --- CHANGELOG.md | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 324c03785..70160b03c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,21 @@ +# 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 +* 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 From 8aed4ccfd50fd199a930fdec80d723e4415151fd Mon Sep 17 00:00:00 2001 From: ansuz Date: Wed, 31 Mar 2021 16:33:16 +0530 Subject: [PATCH 08/12] WIP CHANGELOG --- CHANGELOG.md | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 324c03785..70160b03c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,21 @@ +# 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 +* 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 From b732666ed090aaf089aa3a31d2787fdb8d6268e6 Mon Sep 17 00:00:00 2001 From: yflory Date: Thu, 1 Apr 2021 10:34:02 +0200 Subject: [PATCH 09/12] Fix OO migration banner in embed mode --- www/common/onlyoffice/inner.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/www/common/onlyoffice/inner.js b/www/common/onlyoffice/inner.js index 2fec3682b..6962d0a73 100644 --- a/www/common/onlyoffice/inner.js +++ b/www/common/onlyoffice/inner.js @@ -2491,7 +2491,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 @@ -2503,7 +2507,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; } } From b709b7a31bb39f0a177f3d021ad39a800e879b16 Mon Sep 17 00:00:00 2001 From: yflory Date: Thu, 1 Apr 2021 10:53:55 +0200 Subject: [PATCH 10/12] Fix OO error modal in switch to read-only --- www/common/onlyoffice/inner.js | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/www/common/onlyoffice/inner.js b/www/common/onlyoffice/inner.js index 6962d0a73..6c2d9332f 100644 --- a/www/common/onlyoffice/inner.js +++ b/www/common/onlyoffice/inner.js @@ -1375,12 +1375,11 @@ define([ return; } - if (lock) { - getEditor().setViewModeDisconnect(); - } else if (readOnly) { + 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(); @@ -1400,7 +1399,6 @@ define([ } } - if (isLockedModal.modal && force) { isLockedModal.modal.closeModal(); delete isLockedModal.modal; @@ -1424,7 +1422,7 @@ define([ } catch (e) {} } - if (APP.migrate && !readOnly) { + if (lock && !readOnly) { onMigrateRdy.fire(); } From 657b9e347b6ebc6890a202d1d9d28f38ead591e4 Mon Sep 17 00:00:00 2001 From: yflory Date: Thu, 1 Apr 2021 10:58:14 +0200 Subject: [PATCH 11/12] Stop using setViewModeDisconnect in OO --- www/common/onlyoffice/inner.js | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/www/common/onlyoffice/inner.js b/www/common/onlyoffice/inner.js index 6c2d9332f..ef43b06b0 100644 --- a/www/common/onlyoffice/inner.js +++ b/www/common/onlyoffice/inner.js @@ -1350,7 +1350,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(); @@ -1376,9 +1376,7 @@ define([ } if (lock || readOnly) { - try { - getEditor().asc_setRestriction(true); - } catch (e) {} + try { getEditor().asc_setRestriction(true); } catch (e) {} //getEditor().setViewModeDisconnect(); // can't be used anymore, display an OO error popup } else { setEditable(true); @@ -1408,7 +1406,8 @@ define([ } if (APP.template) { - getEditor().setViewModeDisconnect(); + try { getEditor().asc_setRestriction(true); } catch (e) {} + //getEditor().setViewModeDisconnect(); UI.removeLoadingScreen(); makeCheckpoint(true); return; @@ -1977,7 +1976,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(); @@ -2143,7 +2142,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 @@ -2282,7 +2283,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 From 341a704b4cc7b79db27a8a1d5025046d4f01791c Mon Sep 17 00:00:00 2001 From: ansuz Date: Thu, 1 Apr 2021 14:50:59 +0530 Subject: [PATCH 12/12] WIP changelog --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 70160b03c..f7a78c0fc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,8 @@ * 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