mirror of
https://github.com/gristlabs/grist-core.git
synced 2024-10-27 20:44:07 +00:00
(core) When saving copies, allow saving to another org; update menus for making and saving copies.
Summary: - Implemented selecting an org in some cases when using Save-Copy dialog. - Unified previous 'Save Copy' menu into an enhanced "Share" menu. - Renamed ExportMenu to ShareMenu, collect related code into it, and design the share button. - Introduced trunkAccess property for forks, to know whether "Replace Original" is available. - Simplified handling of fork() result, now that all code has been upgraded. - Replaced 'Copy as Template' menu items with a checkbox in the Save-Copy dialog - Removed copy links for examples in the DocMenu (to simplify, since not part of updated design) - Updated the UI of the copying dialog. Test Plan: Updated affected tests, added new test cases for copying when other orgs are a choice or not. Reviewers: paulfitz Reviewed By: paulfitz Differential Revision: https://phab.getgrist.com/D2561
This commit is contained in:
parent
9b02d16bff
commit
2399baaca2
@ -220,7 +220,6 @@ export interface ActiveDocAPI {
|
||||
|
||||
/**
|
||||
* Prepare a fork of the document, and return the id(s) of the fork.
|
||||
* TODO: remove string option here, it is present to ease transition.
|
||||
*/
|
||||
fork(): Promise<string | ForkResult>;
|
||||
fork(): Promise<ForkResult>;
|
||||
}
|
||||
|
@ -99,6 +99,7 @@ export interface Document extends DocumentProperties {
|
||||
id: string;
|
||||
workspace: Workspace;
|
||||
access: roles.Role;
|
||||
trunkAccess?: roles.Role|null;
|
||||
}
|
||||
|
||||
export interface PermissionDelta {
|
||||
|
@ -37,6 +37,9 @@ export class Document extends Resource {
|
||||
// fetching user has on the doc, i.e. 'owners', 'editors', 'viewers'
|
||||
public access: Role|null;
|
||||
|
||||
// Property set for forks, containing access the fetching user has on the trunk.
|
||||
public trunkAccess?: Role|null;
|
||||
|
||||
// a computed column with permissions.
|
||||
// {insert: false} makes sure typeorm doesn't try to put values into such
|
||||
// a column when creating documents.
|
||||
|
@ -958,6 +958,10 @@ export class HomeDBManager extends EventEmitter {
|
||||
if (doc.urlId) {
|
||||
doc.urlId = buildUrlId({trunkId: doc.urlId, forkId, forkUserId, snapshotId});
|
||||
}
|
||||
|
||||
// Set trunkAccess field.
|
||||
doc.trunkAccess = doc.access;
|
||||
|
||||
// Forks without a user id are editable by anyone with view access to the trunk.
|
||||
if (forkUserId === undefined && doc.access === 'viewers') { doc.access = 'editors'; }
|
||||
if (forkUserId !== undefined) {
|
||||
|
Loading…
Reference in New Issue
Block a user