diff options
Diffstat (limited to 'src/client/documents/Documents.ts')
-rw-r--r-- | src/client/documents/Documents.ts | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/src/client/documents/Documents.ts b/src/client/documents/Documents.ts index 159771145..d7c9af1a3 100644 --- a/src/client/documents/Documents.ts +++ b/src/client/documents/Documents.ts @@ -236,6 +236,8 @@ class EmptyBox { export namespace Docs { + export let newAccount: boolean = false; + export namespace Prototypes { type LayoutSource = { LayoutString: (key: string) => string }; @@ -392,7 +394,7 @@ export namespace Docs { // non-guid string ids for each document prototype const prototypeIds = Object.values(DocumentType).filter(type => type !== DocumentType.NONE).map(type => type + suffix); // fetch the actual prototype documents from the server - const actualProtos = await DocServer.GetRefFields(prototypeIds); + const actualProtos = Docs.newAccount ? {} : await DocServer.GetRefFields(prototypeIds); // update this object to include any default values: DocumentOptions for all prototypes prototypeIds.map(id => { @@ -895,8 +897,8 @@ export namespace Docs { export namespace DocUtils { export function Excluded(d: Doc, docFilters: string[]) { const filterFacets: { [key: string]: { [value: string]: string } } = {}; // maps each filter key to an object with value=>modifier fields - for (let i = 0; i < docFilters.length; i++) { - const fields = docFilters[i].split(":"); + docFilters.forEach(filter => { + const fields = filter.split(":"); const key = fields[0]; const value = fields[1]; const modifiers = fields[2]; @@ -904,7 +906,7 @@ export namespace DocUtils { filterFacets[key] = {}; } filterFacets[key][value] = modifiers; - } + }); if (d.z) return false; for (const facetKey of Object.keys(filterFacets)) { @@ -921,8 +923,8 @@ export namespace DocUtils { const childDocs = viewSpecScript ? docs.filter(d => viewSpecScript.script.run({ doc: d }, console.log).result) : docs; const filterFacets: { [key: string]: { [value: string]: string } } = {}; // maps each filter key to an object with value=>modifier fields - for (let i = 0; i < docFilters.length; i++) { - const fields = docFilters[i].split(":"); + docFilters.forEach(filter => { + const fields = filter.split(":"); const key = fields[0]; const value = fields[1]; const modifiers = fields[2]; @@ -930,7 +932,7 @@ export namespace DocUtils { filterFacets[key] = {}; } filterFacets[key][value] = modifiers; - } + }); const filteredDocs = docFilters.length ? childDocs.filter(d => { if (d.z) return true; |