* wip
* fix: Address review feedback on Granola integration
- Limit the size of Granola API responses
- Load the team when authorizing notes into personal collections
- Add the user's connection from granola.list to the integrations store
* feat: Connect Granola from a dialog
* fix: Accept Granola webhook test events
* Copy pass
* Copy pass
* fix: Collaborative persist can overwrite a concurrent API update
Merge the stored state into the snapshot under the row lock before deriving
content, so an API update that committed after the snapshot is kept.
* chore: Clarify collaborative updater comments
* perf: Batch user and membership lookups when a group is removed from a collection
* perf: Limit membership lookups to each batch of group users
* chore: Explain membership lookups in remove_group handler
* fix: Ignore deleted groups when checking remaining collection access
* feat: Option to include comments when duplicating a document
* refactor: Share mark walking between removeMarks and comment remapping
* fix: Copy thread roots first and notify nobody about duplicated comments
* feat: Flatten collaborative state of large documents
Replace edit history in large collaborative state with fresh state once a
document is idle with no open sessions, and when state is over the maximum
length on save. Each replacement increments a state generation that is part of
the collaboration room name, so old state never merges into the new state.
* fix: Refuse to load state of another generation and lock editor during reset
* Remove excessive tests
* fix: Reset rooms on all instances and check state generation during authentication
* refactor: Schedule state flattening only for changed rooms, from PersistenceExtension
* fix: Refuse API text updates applied to state of an earlier generation
* wip
* Route document list queries through findAllWithCtx
Add findAllWithCtx and countWithCtx on Document and Template, unsafe* methods
for system reads, and a lint rule that bans direct list queries. Remove the
cached membership list, accessibleSql and findByIds in favour of one gate.
* Remove test
* Include drafts when loading starred documents
* Scope the access gate to the user's team, move whereToSql to QueryHelper
* Move collection access to Collection.findAllWithCtx
Collection.accessibleIds keeps the cached id list inside the collection gate, and user.collectionIds() is a shortcut to it. List queries use findAllWithCtx and countWithCtx, system reads use the shared unsafe methods, and the admin listing in collections.list is explicit.
* Check permanentDelete for each document in empty_trash
Score-only updates on documents are non-HOT, so every update wrote a new
entry into the full GIN index on ownerIds even though almost all rows have
no owners. Index only rows with owners.
* fix: Remove pins when a document is trashed
Pins on trashed documents were hidden but still counted toward the pin limit and could not be removed.
* fix: Remove pins when a collection is deleted