(core) attribute Calculate to grist rather than user

Summary:
when a document is opened, and Calculate results in
a change, that change is not attributed to 'grist' rather than
to the user's email.

Some minor tweaks included to freshen some related dev scripts.

Test Plan: added test

Reviewers: dsagal

Reviewed By: dsagal

Differential Revision: https://phab.getgrist.com/D2679
This commit is contained in:
Paul Fitzpatrick 2020-12-07 11:22:57 -05:00
parent 0289e3ea17
commit 3519d0efce

View File

@ -217,6 +217,12 @@ export class Sharing {
const isCalculate = (userActions.length === 1 &&
userActions[0][0] === 'Calculate');
const trivial = isCalculate && sandboxActionBundle.stored.length === 0;
// For Calculate "user" actions, don't attribute any changes to the user who
// happens to have opened the document.
const attribution = {
...info,
...isCalculate ? { user: 'grist' } : undefined,
};
const actionNum = trivial ? 0 :
(branch === Branch.Shared ? this._actionHistory.getNextHubActionNum() :
@ -226,7 +232,7 @@ export class Sharing {
const localActionBundle: LocalActionBundle = {
actionNum,
// The ActionInfo should go into the envelope that includes all recipients.
info: [findOrAddAllEnvelope(sandboxActionBundle.envelopes), info],
info: [findOrAddAllEnvelope(sandboxActionBundle.envelopes), attribution],
envelopes: sandboxActionBundle.envelopes,
stored: sandboxActionBundle.stored,
calc: sandboxActionBundle.calc,