Follow-up fixes to the retention feature.
The superseded CleanupDeletedDocumentsTask was still registered and ran
hourly, hard deleting documents 30 days after `deletedAt` regardless of the
team's configured period. Any retention longer than 30 days — including
infinite — had no effect.
The `destroyedAt` column was declared with a bare `@Column`. Decorator
metadata is disabled in the server build, so sequelize-typescript could not
infer its type and threw while loading the Document model.
Documents pending permanent deletion stayed readable and restorable through
`documents.info`, `documents.restore` and the MCP restore tool. They are now
treated as if they no longer exist.
Also:
- Add trash and data retention controls to workspace security settings, the
only way to configure either was to call the API directly.
- Derive the retention tranches to process from the periods teams actually
use, so a team holding a period that is no longer offered is not skipped.
- Bound the trash expiry task by `limit`, it previously ran an unbounded
UPDATE across the whole documents table every hour.
- Match team preferences on JSON text rather than casting to int, so one bad
value cannot fail the query for every other team in the batch.
- Derive the API validation schema from the same presets the UI offers.
- Send `ASC` rather than `asc` from the trash list, the sort direction was
silently coerced back to descending.
- Move the retention badge in with the other document badges, pluralize it,
and never show a negative day count.
- Drop the unused `Template.destroyedAt` computed, which returned a future
date under a name meaning the opposite on the sibling model.
- Rename the migration to match its position in the sequence and the column
it adds.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01U3kXbDxLMJesYLM5E4P6HQ
Two-phase retention: configurable trash retention (TrashRetentionDays)
and data retention (DataRetentionDays) per team, with a destroyedAt
column and background tasks to expire and permanently delete documents.
* Treat legacy boolean commenting preference as disabled
Teams not yet migrated to the CommentingAccess enum may still have a
boolean `false` stored for the commenting preference. Guard the
enabled checks so `false` reads as disabled rather than enabled.
* Move commenting setting from Details to Security settings
---------
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
* Add TeamPreference to prevent document embedding
- Add PreventDocumentEmbedding enum value to TeamPreference
- Add default value (false) to maintain backward compatibility
- Update TeamPreferences interface with new boolean property
- Modify renderShare function to respect team preference
- When preference is true, X-Frame-Options header is kept to prevent iframe embedding
- When preference is false (default), X-Frame-Options is removed to allow embedding
* Add preventDocumentEmbedding to TeamsUpdateSchema
- Add preventDocumentEmbedding boolean field to the preferences object in TeamsUpdateSchema
- This allows the new TeamPreference to be modified through the API
- The existing teamUpdater function will automatically handle the new preference
- API responses will include the preference via the presentTeam function
---------
Co-authored-by: codegen-sh[bot] <131295404+codegen-sh[bot]@users.noreply.github.com>
* feat: allow sort by position for comments
* wait for prosemirror nodes to load
* Move to menu
* remove sort; rename enum
* asc sort for in-thread display
* revert sort
---------
Co-authored-by: Tom Moor <tom.moor@gmail.com>
This PR moves the entire project to Typescript. Due to the ~1000 ignores this will lead to a messy codebase for a while, but the churn is worth it – all of those ignore comments are places that were never type-safe previously.
closes#1282