(core) Syncing db with data when actions are rejected

Summary:
Writing results of the undo action to a database when the undo was caused by rejecting due to ACL checks.
This ensures that DB and sanbox are in sync in case of non-deterministic formulas.

Test Plan: Updated

Reviewers: georgegevoian, dsagal

Reviewed By: georgegevoian, dsagal

Subscribers: dsagal

Differential Revision: https://phab.getgrist.com/D3695
This commit is contained in:
Jarosław Sadziński
2022-11-24 19:49:45 +01:00
parent d47cac36f5
commit 601ba58a2e
2 changed files with 144 additions and 22 deletions

View File

@@ -2709,7 +2709,7 @@ const dummyAccessCheck: IAccessCheck = {
/**
* Helper class to calculate access for a set of cells in bulk. Used for initial
* access check for a whole _grist_Cell table. Each cell can belong to a diffrent
* access check for a whole _grist_Cell table. Each cell can belong to a different
* table and row, so here we will avoid loading rows multiple times and checking
* the table access multiple time.
*/
@@ -3558,7 +3558,7 @@ export class CellData {
fail();
}
// Now receive the action, and test if we can still see the cell (as the info might be moved
// to a diffrent cell).
// to a different cell).
lastState.receiveAction(single);
cell = cellData.getCell(id)!;
if (cellData.isAttached(cell) && haveRules && !await hasAccess(cell, lastState)) {