diff --git a/app/client/ui/DocHistory.ts b/app/client/ui/DocHistory.ts index 55c2f1a8..30ac2ff2 100644 --- a/app/client/ui/DocHistory.ts +++ b/app/client/ui/DocHistory.ts @@ -74,12 +74,24 @@ export class DocHistory extends Disposable implements IDomComponent { docApi.getSnapshots().then(result => snapshots.isDisposed() || snapshots.set(result.snapshots)).catch(err => { snapshotsDenied.set(true); - reportError(err); + // "cannot confirm access" is what we expect if snapshots + // are denied because of access rules. + if (!String(err).match(/cannot confirm access/)) { + reportError(err); + } }); return dom( 'div', + {tabIndex: '-1'}, // Voodoo needed to allow copying text. dom.maybe(snapshotsDenied, () => cssSnapshotDenied( - t("Snapshots are unavailable."), + dom( + 'p', + t("Snapshots are unavailable."), + ), + dom( + 'p', + t("Only owners have access to snapshots for documents with access rules."), + ), testId('doc-history-error'))), // Note that most recent snapshots are first. dom.domComputed(snapshots, (snapshotList) => snapshotList.map((snapshot, index) => { @@ -128,6 +140,8 @@ const cssSnapshot = styled('div', ` const cssSnapshotDenied = styled('div', ` margin: 8px 16px; + text-align: center; + color: ${theme.text}; `); const cssSnapshotTime = styled('div', ` diff --git a/app/server/lib/ActiveDoc.ts b/app/server/lib/ActiveDoc.ts index a7eb4c30..8f23ba12 100644 --- a/app/server/lib/ActiveDoc.ts +++ b/app/server/lib/ActiveDoc.ts @@ -1715,7 +1715,7 @@ export class ActiveDoc extends EventEmitter { public async getSnapshots(docSession: OptDocSession, skipMetadataCache?: boolean): Promise { if (await this._granularAccess.hasNuancedAccess(docSession)) { - throw new Error('cannot confirm access to snapshots'); + throw new Error('cannot confirm access to snapshots because of access rules'); } return this._docManager.storageManager.getSnapshots(this.docName, skipMetadataCache); }