mirror of
https://github.com/gristlabs/grist-core.git
synced 2024-10-27 20:44:07 +00:00
546096fcc9
Summary: Firstly I just wanted some more consistency and less repetition in places where Documents are retrieved from the DB, so it's more obvious when code differs from the norm. Main changes for that part: - Let HomeDBManager accept a `Request` directly and convert it to a `Scope`, and use this in a few places. - `getScope` tries `req.docAuth.docId` if `req.params` doesn't have a docId. I also refactored how `_createActiveDoc` gets the document URL, separating out getting the document from getting a URL for it. This is because I want to use that document object in a future diff, but I also just find it cleaner. Notable changes for that: - Extracted a new method `HomeDBManager.getRawDocById` as an alternative to `getDoc` that's explicitly for when you only have a document ID. - Removed the interface method `GristServer.getDocUrl` and its two implementations because it wasn't used elsewhere and it didn't really add anything on top of getting a doc (now done by `getRawDocById`) and `getResourceUrl`. - Between `cachedDoc` and `getRawDocById` (which represent previously existing code paths) also try `getDoc(getScope(docSession.req))`, which is new, because it seems better to only `getRawDocById` as a last resort. Test Plan: Existing tests Reviewers: georgegevoian Reviewed By: georgegevoian Differential Revision: https://phab.getgrist.com/D3328 |
||
---|---|---|
.. | ||
DocApiForwarder.ts | ||
DocWorkerMap.ts | ||
Doom.ts | ||
HomeDBManager.ts | ||
Housekeeper.ts | ||
Permissions.ts | ||
scrubUserFromOrg.ts | ||
TypeORMPatches.ts | ||
Usage.ts | ||
values.ts |