Commit Graph
3673 Commits
Author SHA1 Message Date
Tom Moor 46fc485a89 perf: Make documents ownerIds index partial (#14776)
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.
2026-11-27 08:49:07 -05:00
Tom Moor a840b553f6 fix: shares.create publishes an existing share and keeps its creator (#14749)
* fix: shares.create publishes an existing share and keeps its creator

* fix: apply supplied expiresAt when publishing a reused share
2026-11-26 20:24:30 -05:00
Tom Moor 66254a8239 fix: documents.drafts collectionId filter includes unfiled drafts (#14772) 2026-11-26 19:45:51 -05:00
Tom Moor 0d80559f8d fix: Show public shares of draft documents in Shared Links (#14775)
* fix: Include draft document shares in shares.list

* perf: Exclude document content from shares.list
2026-11-26 19:45:40 -05:00
Tom Moor 7cda6670ac fix: Remove pins when a document is trashed (#14765)
* 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
2026-11-26 19:38:49 -05:00
Tom Moor 36163dddd8 fix: Prevent removing inherited group access from child documents (#14774) 2026-11-26 19:38:29 -05:00
Tom Moor bba2c8393d fix: Scope admin share fields to the owning team (#14770) 2026-11-26 19:38:17 -05:00
Tom Moor 454c9e1b13 fix: Respect limit query parameter in cron endpoints (#14767) 2026-11-26 19:33:21 -05:00
Tom Moor 4649ac3e09 fix: Read Word documents with the shared zip reader (#14744)
* fix: Read Word documents with the shared zip reader

* fix: Bound total bytes read from Word documents
2026-11-26 19:27:40 -05:00
Tom Moor 0db2c71099 fix: documents.list total and DESC paging for sort=index (#14771) 2026-11-26 19:25:05 -05:00
Tom Moor 373b098dfe fix: Resolve document and collection slugs to ids before writing them (#14763) 2026-11-26 19:18:34 -05:00
Tom Moor ff9735f573 fix: Align empty trash scope with trash listing (#14769) 2026-11-26 19:18:20 -05:00
Tom Moor 63de3fcd37 fix: Delete emoji attachment row in transaction and prevent shared attachments (#14768) 2026-11-26 19:16:40 -05:00
Tom Moor de93d83041 fix: groups.list drops userId filter when source is a provider (#14757) 2026-11-26 19:07:03 -05:00
Tom Moor c996691411 fix: Require an enabled authentication provider before disabling email sign-in (#14761)
* fix: Require an enabled authentication provider before disabling email sign-in

* test: Cover teams with only disabled providers
2026-11-27 00:05:08 +00:00
Tom Moor 2df9f245df fix: Reject non-import integrations in imports.create (#14764) 2026-11-26 19:04:29 -05:00
Tom Moor fbe06d0624 fix: Match existing users by case-insensitive email on invite (#14762)
* fix: Match existing users by case-insensitive email on invite

* test: Cover case-insensitive User.findByEmail lookup
2026-11-27 00:03:43 +00:00
Tom Moor d2ab9e7e3f fix: Validate collection when creating a pin (#14758) 2026-11-26 19:02:44 -05:00
Tom Moor 9d39e07a7d fix: documents.duplicate returns 403 for an unknown collectionId (#14750) 2026-11-26 19:01:36 -05:00
Tom Moor 12862f5c18 fix: Return an error from attachments.createFromUrl when the download fails (#14756) 2026-11-26 18:59:08 -05:00
Tom Moor dd25d6ab62 chore: Remove unused document schemas (#14746) 2026-11-26 18:58:15 -05:00
Tom Moor 6fb22008ee fix: Return 404 from integrations.update for an unknown id (#14745) 2026-11-26 18:58:10 -05:00
Tom Moor 4e468bf0d6 fix: Use actor for readEmail check in users.invite response (#14748) 2026-11-26 18:55:20 -05:00
Tom Moor 5891724628 fix: Present collections in suggestions.mention response (#14747) 2026-11-26 18:51:29 -05:00
Tom Moor 3767785ef5 fix: Page large document and template text in MCP fetch (#14728)
* fix: Page large document and template text in MCP fetch

* fix: Keep surrogate pairs whole when paging MCP fetch text

* fix: Only include textLength in MCP fetch when text is paged

* fix: Update MCP instructions and skills for paged fetch and template lists
2026-11-26 16:42:37 +00:00
Tom Moor 578bf73e6b Prevent adding users as guests when their email matches a workspace domain (#14726)
* Prevent adding users as guests when their email matches a workspace domain

* Address review: skip existing users, use transaction, invite team domain emails as members from share popovers
2026-11-26 09:48:40 -05:00
Tom Moor e5cdb22cc9 fix: Restored revisions via API are overwritten on next edit (#14714)
* fix: Restore collaborative state when restoring a revision via the API

* fix: Normalize restored content and do not fail on collaboration notify errors

* fix: Read state under a row lock when restoring a revision
2026-11-25 21:55:59 -05:00
Tom Moor c7434dcc26 fix: Delete attachments shared only by documents in the same purge batch (#14712)
* fix: Delete attachments referenced only by documents in the same purge batch

* fix: Only consider attachments owned by the document's team when purging
2026-11-25 20:52:05 -05:00
Tom Moor d6e25d246f fix: Recalculate document memberships and notifications after restore (#14721) 2026-11-25 20:51:29 -05:00
Tom Moor e622b016fc fix: Validate provider details when connecting authentication (#14704)
* fix: Validate provider details when connecting authentication

* fix: Limit provider validation to personal Google accounts

* fix: Only validate provider details when connecting a new provider
2026-11-26 01:29:07 +00:00
Tom Moor 4f25f3854e fix: Validate attachment in documents.import (#14711) 2026-11-25 20:20:58 -05:00
Tom MoorandClaude 767758a1a8 feat: Document and collection owners (#14437)
* feat: Add document owners

Documents can now have owners, stored as an array of user IDs. Owners
must be active members or admins, and changing them requires the
existing manage users permission on the document, gated behind a new
DocumentOwners plan entitlement that is included in every plan.

- ownerIds accepted by documents.create and documents.update and
  returned by the document presenter
- ownerIds filter field (eq/in) for documents.list and documents.search
- ownerIds on the MCP create_document and update_document tools, and an
  ownerId filter on list_documents
- Owners section in the document Insights dialog to add and remove owners
- Owner filter on the search page
- In-app and email notification when a user is made an owner

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016MJXFdSZ39ZGPf31jyGcYz

* feat: Give document owners responsibility for their documents

- Access requests are routed to owners that can manage the document
  before falling back to document, collection and workspace admins
- Owners are subscribed to a document when they are added, respecting
  a previous unsubscribe
- Owners that can edit a document can also manage its access, owners
  and archive it; ownership never grants access on its own
- Owners are shown in the document byline, list items and search
  results, and document hover previews

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016MJXFdSZ39ZGPf31jyGcYz

* feat: Manage document owners from the share panel

- Owner is a role in the share panel permission menu and invite picker for
  individual users, adding an owner gives them the manage permission
- Lowering an owner's permission or removing their access removes the
  ownership
- Owners are sorted to the top of the member list
- Owners added through the API or MCP are given the manage permission
- Owners do not also receive the "added to document" notification
- Only added owners are validated, so suspended owners can still be removed
- Deleted users are removed from document owners
- Removes the owners section from Insights

* fix: Address review feedback on document owners

- Authorize owner changes before assigning owners on create
- Lock the document when adding an owner so concurrent invitations are kept
- Enforce the owner limit on every path
- Run MCP document updates in a transaction
- Broadcast owner removals to connected clients

* feat: Add collection owners

- Collections can have owners, who also own every document in the
  collection, shown first in document bylines
- Owner is a role in the collection share panel and invite picker for
  individual users, adding an owner gives them the manage permission
- Lowering an owner's permission or removing their access removes the
  ownership
- ownerIds on collections.create, collections.update and the MCP
  collection tools
- The document owner filter includes documents in owned collections
- Access requests go to document and collection owners together
- Collection owners are subscribed to the collection and notified when
  they are added
- Deleted users are removed from collection owners
- Renames the personal collection policy helper to
  isPersonalCollectionOwner

* feat: Show profile cards on owner names, hide inherited owners in collection lists

* fix: Allow adding yourself as a collection owner, include collection owners in MCP exact match

* fix: Correct singular owner translations

* feat: Allow users to make themselves a document owner

- The share panel suggests the current user when they can manage owners,
  and only offers the Owner permission for them
- documents.add_user accepts the actor's own ID when changing ownership,
  without changing their own access
- An owner's own row offers "Remove as owner", which keeps their access
- Hides the duplicate "You have full access" row when the current user is
  listed as a member

* fix: Restore singular owner translations

* fix: Limit owners to 5, use no key update locks when adding owners

* refactor: Move owner logic into Document and Collection model methods

- addOwner, removeOwner, grantOwnerAccess and setOwnerIds on both models,
  locking the row so concurrent owner changes are kept
- Owner events are created by an update hook from the change in ownerIds
- The manageOwners check runs at the route level when ownerIds is sent
- Removes the documentOwners and collectionOwners command modules
- Removes duplicate owner tests

* fix: Owner selection and membership edge cases

- Remove document owners from the legacy plan
- Selecting yourself in the share picker only suggests other users that can
  be owners, and you are not suggested next to groups or guests
- Users that make themselves an owner through the API get the manage
  permission, so they are listed in the share panel

* perf: Scope the collection owner filter subquery to the team

* chore: Drop redundant teamId UUID check

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-11-25 19:21:26 -05:00
Tom Moor 39a0e92223 fix: Align collection checks in list endpoints (#14715)
* fix: Align collection checks in list endpoints

* test: Cover MCP list tools for private collections
2026-11-25 11:52:42 -05:00
Tom Moor 50f54a9c6d fix: Validate provider access for passkey sessions (#14706) 2026-11-25 09:01:00 -05:00
Tom Moor e74517acfe fix: Restrict session and sign-in management routes to app sessions (#14713) 2026-11-25 09:00:17 -05:00
Tom Moor ca4aed4c15 fix: Apply archive limits when reading import attachments (#14709) 2026-11-25 09:00:05 -05:00
Tom Moor 1c6e26553b fix: Empty trash in batches to bound memory use (#14710) 2026-11-25 08:59:49 -05:00
Tom Moor b680a06b7e fix: Re-check notifications when a user role changes (#14705) 2026-11-25 08:57:17 -05:00
Tom Moor 7fab397ec6 fix: Respect draft visibility when duplicating nested documents (#14698)
* fix: Respect draft visibility when duplicating nested documents

* fix: Use flattened Context fields after merging main
2026-11-24 20:04:35 -05:00
Tom Moor 2c84b2100f fix: Stream attachments in document exports and stop on disconnect (#14697)
* fix: Stream attachments in single document exports and stop on disconnect

Single document and revision exports read every attachment into memory
before building the zip, and kept running after the client had gone.
Repeated exports of a document with large attachments ran web dynos out
of memory.

- Stream attachments into the zip with a shared AttachmentHelper.addToArchive
- Abort export work when the client connection closes
- Read only images that will be inlined, with a 1MB total inline limit

* fix: Destroy streams opened after abort, treat missing local files as absent
2026-11-24 19:51:15 -05:00
Tom MoorandClaude Opus 5.5 00b124d03c chore: Rename APIContext to Context and flatten its fields (#14684)
* chore: Rename APIContext to Context and flatten its fields

Auth and transaction now live directly on the context instead of in
ctx.state and a nested ctx.context, and model helpers read them directly.
APIContext remains as a deprecated alias.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016MJXFeUxvU46KyvKnP8sXf

* chore: Remove deprecated APIContext alias

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016MJXFeUxvU46KyvKnP8sXf

* fix: Read auth from context in OAuth provider callbacks

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016MJXFeUxvU46KyvKnP8sXf

* chore: Add withUser and withTransaction context helpers

Replaces manual createContext rebuilds that copy fields from an existing context.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016MJXFeUxvU46KyvKnP8sXf

* chore: Remove arbitrary property access from Koa context types

AppContext and Context no longer inherit the any index signature from
Koa's DefaultContext, custom fields are declared explicitly, and importing
Koa's loose Context type is disallowed by lint.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016MJXFeUxvU46KyvKnP8sXf

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-11-23 23:17:06 -05:00
Tom Moor 147014c6d6 fix: Claim transfer tokens atomically on redemption (#14693) 2026-11-23 19:41:24 -05:00
Tom Moor 6576bc832a perf: Add subscriptions documentId index for document delete cascade (#14688) 2026-11-23 09:20:27 -05:00
813b0bd5d6 Validate MCP document update edit modes (#14678)
Co-authored-by: Tom Moor <380914+tommoor@users.noreply.github.com>
Co-authored-by: linear-code[bot] <222613912+linear-code[bot]@users.noreply.github.com>
2026-11-20 14:31:40 -05:00
Tom Moor 1465b7ea80 feat: Show export completion in the notifications center (#14673)
* feat: Show export completion in the notifications center

Exports now create an in-app notification with the export name, status,
format and a download button. Export emails are sent from the notification
with a one-minute delay, so they are skipped once the notification is read.

* fix: Avoid nested button in export notification and keep it after delete

* fix: Revoke export notifications when access to the source is lost

* fix: Remove icon from export notification download cue
2026-11-20 11:17:15 -05:00
Tom Moor 620ef924a1 Improve log data sanitization (#14671)
* Improve log data sanitization

Extract the log sanitizer into its own module, match field names regardless of case and separators, extend the filtered fields, sanitize Sentry extras as a whole, keep serializable values such as dates, and apply the depth limit only to nested objects.

* Call toJSON once when sanitizing log data
2026-11-19 17:59:44 -05:00
Tom Moor e0fb40baaa fix: Halve indexed document text until the search vector fits (#14646) 2026-11-19 17:57:25 -05:00
Tom Moor db71a3edad fix: Tighten permissions on documents.users (#14670) 2026-11-19 17:56:37 -05:00
Tom Moor 0171534400 feat: Allow admins to reconnect an authentication provider (#14649)
Reconnecting updates the existing provider row in place so that member
authentications stay linked when the external domain or tenant changes.
2026-11-18 22:36:53 -05:00
Tom Moor 6d82287a08 fix: Do not download relative attachment paths in API imports (#14650) 2026-11-18 22:36:26 -05:00