Commit Graph

786 Commits

Author SHA1 Message Date
Tom Moor cc591ebc66 Conversion of User to event system (#9741)
* Conversion of User to event system

* fix

* warning

* fixes

* Skip lastActiveAt in changeset

* fix: Skip count in view changeset

* refactor: Remove userDestroyer

* refactor: Remove userSuspender

* refactor: Remove userUnsuspender

* tests
2025-07-27 13:15:21 -04:00
Tom Moor c678701bd0 fix: Documents accessible only through group memberships do not appear in search results (#9738)
* first pass

* Add falsy test case coverage
2025-07-26 12:31:11 -04:00
Tom Moor f23559d1b8 chore: Integration to event backend (#9688) 2025-07-20 13:13:27 -04:00
Tom Moor 6e33b90f62 chore: Convert View to event backend (#9683) 2025-07-19 15:01:25 -04:00
Hemachandar 5db3df35f5 chore: Move Collection event writing to model layer (#9663)
* collections.create, collections.update, collections.delete API

* collections.archive, collections.restore

* collections.move

* file imports

* remove collectionDestroyer

* remove data field

* remove data field for collections.move

* remove data field for import flow

* use hook for permission_changed event

* simplify event type

* tiny
2025-07-19 13:38:22 -04:00
Hemachandar d78b0440df fix: Skip overwriting non-transaction fields in firstCollectionForTeam query (#9662) 2025-07-17 08:22:09 -04:00
Hemachandar c7231ffd8b chore: Move Revision event writing to model layer (#9650) 2025-07-16 17:28:29 -04:00
Tom Moor bf447ec72a Convert team to model events (#9628) 2025-07-16 07:06:59 -04:00
Tom Moor 772eb2f1d4 fix: randomstring dep does not work in browser with rolldown-vite (#9624)
* fix: randomstring dep does not work in browser with rolldown-vite

* fix: Last usage of randomstring, docs

* feedback
2025-07-13 09:33:16 -04:00
Tom Moor 40e6a87d15 chore: Refactor revisions list (#9623)
* fix: Remove force render

* chore: Refactor revisions list to be reactive

* fix: Access of undefined

* refactor
2025-07-12 19:29:57 -04:00
codegen-sh[bot] a57d90fdf1 Add collaboratorIds support to revisions (#9343)
* Add collaboratorIds support to revision events

- Add database migration to add collaboratorIds column to revisions table
- Update server Revision model to include collaboratorIds field
- Update client Revision model to include collaboratorIds field
- Modify Revision.buildFromDocument to capture document collaborators
- Update revisionCreator to include collaboratorIds in event data

Fixes #6975

* fix to actually work

* test: Add missing methods to mock

* Return collaborators to client and display

---------

Co-authored-by: codegen-sh[bot] <131295404+codegen-sh[bot]@users.noreply.github.com>
Co-authored-by: Tom Moor <tom@getoutline.com>
2025-07-12 09:24:53 -04:00
Tom Moor 7dd0616b8c fix: Remote table modifications cause CellSelection to be lost (#9596)
* fix: Table modifications lose any existing CellSelection

* tsc

* doc

* Remove unused imports
2025-07-10 08:46:08 -04:00
Tom Moor 6dfc75f090 perf: Some small performance improvements in SearchHelper (#9580) 2025-07-08 22:19:02 +00:00
Tom Moor a6b0fcff48 feat: Add OTP sign-in for PWA (#9556)
* wip

* wip

* wip

* Only use code for desktop and PWA
2025-07-07 18:36:43 -04:00
Newton d36f98bc9e disable search engine indexing for documents by default (#9551) 2025-07-05 22:17:55 -04:00
Tom Moor 0589f62bde fix: Make shared document content available to screenreaders (#9549) 2025-07-04 16:45:21 -04:00
Andy Copland 50fe0bb746 fix: Add OAuth support to search query source enum (#9511)
- Add 'oauth' to SearchQuery enum in server and client models
- Add database migration to include 'oauth' in enum_search_queries_source
- Fixes 400 validation error when OAuth users search with parameters

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-authored-by: Claude <noreply@anthropic.com>
2025-07-01 03:37:25 -04:00
codegen-sh[bot] 879c568a2c Upgrade Prettier to v3.6.2 (#9500)
* Upgrade Prettier to v3.6.2 and eslint-plugin-prettier to v5.5.1

- Upgraded prettier from ^2.8.8 to ^3.6.2 (latest version)
- Upgraded eslint-plugin-prettier from ^4.2.1 to ^5.5.1 for compatibility
- Applied automatic formatting changes from new Prettier version
- All existing ESLint and Prettier configurations remain compatible

* Applied automatic fixes

* Trigger CI

---------

Co-authored-by: codegen-sh[bot] <131295404+codegen-sh[bot]@users.noreply.github.com>
Co-authored-by: Tom Moor <tom@getoutline.com>
2025-06-28 10:22:28 -04:00
Tom Moor ca5c51a712 fix: Client and server validation differ for subdomains (#9468)
* fix: Client and server validation differ for subdomains

* Validation message

* Lower min subdomain length to 2
2025-06-18 16:50:17 -04:00
Tom Moor 75f173c6ff Add option to publish but not persist events (#9448)
* Add option to publish but not persist events

* tsc
2025-06-14 10:46:01 -04:00
Tom Moor a9c4dd43d6 fix: options vs rest usage (#9431)
No functional difference here, just avoid extra passed attributes
2025-06-11 20:04:43 -04:00
Tom Moor e4917cc4bd fix: Ensure notification relationships are loaded in EmailProcessor (#9426) 2025-06-10 21:19:28 -04:00
Tom Moor 0f4c1d7db5 fix: Regression in collections.info endpoint disallowed find by urlId (#9423) 2025-06-10 18:21:39 -04:00
codegen-sh[bot] c2069db882 Migrate Backlink model to Relationship (#9370)
* Migrate Backlink model to generic Relationship model

- Create new Relationship model with type field to support different relationship types
- Add database migration to create relationships table and migrate existing backlinks
- Update Backlink model to delegate to Relationship model for backward compatibility
- Update BacklinksProcessor to use Relationship model with backlink type
- Update API routes to use new Relationship model
- Update test files to use Relationship model
- Maintain backward compatibility through database view and model delegation

Fixes #9366

* Update migration to rename table instead of creating new one

- Rename existing backlinks table to relationships instead of creating new table
- Add type column with default value to existing table
- Update existing rows to have type='backlink'
- Avoid expensive data migration by keeping existing data in place
- Maintain backward compatibility with database view
- Update rollback to reverse table rename and column addition

This approach is much more efficient for large datasets as it avoids copying millions of rows.

* Remove unnecessary UPDATE statement from migration

The UPDATE statement is not needed since defaultValue automatically
applies to existing rows when adding a column with a default value.

Thanks @tommoor for catching this!

* Wrap up migration in transaction

- Wrap all migration operations in a transaction for atomicity
- Add transaction parameter to all queryInterface calls
- Follow the same pattern as other migrations in the codebase
- Ensures all operations succeed or fail together

* Remove Backlink class entirely and use Relationship everywhere

- Delete server/models/Backlink.ts
- Remove Backlink export from server/models/index.ts
- Remove Backlink import and association from Document model
- All functionality now uses Relationship model with RelationshipType.Backlink
- Maintains same API through Relationship model methods
- Cleaner architecture with single relationship model

* Update documents.test.ts to use RelationshipType enum instead of string

- Import RelationshipType from Relationship model
- Replace type: "backlink" with type: RelationshipType.Backlink
- Improves type safety and consistency with enum usage

* Address code review feedback

- Add transaction wrapper to migration down method for safer rollback
- Remove unused findByTypeForUser method from Relationship model
- Method wasn't used and won't work for all relationship types (e.g., user mentions)
- Clean up code structure and improve safety

* Restore imports

---------

Co-authored-by: codegen-sh[bot] <131295404+codegen-sh[bot]@users.noreply.github.com>
Co-authored-by: Tom Moor <tom@getoutline.com>
2025-06-07 15:50:33 -04:00
codegen-sh[bot] 758d4edbb9 Upgrade @typescript-eslint dependencies to v8.33.0 (#9363)
* Upgrade @typescript-eslint dependencies from v6.21.0 to v8.33.0

- Updated @typescript-eslint/eslint-plugin from ^6.21.0 to ^8.33.0
- Updated @typescript-eslint/parser from ^6.21.0 to ^8.33.0
- Tested linting functionality to ensure compatibility
- This brings the latest TypeScript ESLint features and bug fixes

* lint

* tsc

---------

Co-authored-by: codegen-sh[bot] <131295404+codegen-sh[bot]@users.noreply.github.com>
Co-authored-by: Tom Moor <tom@getoutline.com>
2025-06-01 11:01:15 -04:00
codegen-sh[bot] 76bd503581 Add description setting for workspaces (#9345)
* Add team description column and settings

- Add database migration to add description column to teams table
- Update server-side Team model with description field and validation
- Update client-side Team model to include description field
- Add description input field to team settings page
- Update renderApp to use team description in HTML metadata when public branding is enabled

* Applied automatic fixes

* tweaks

---------

Co-authored-by: codegen-sh[bot] <131295404+codegen-sh[bot]@users.noreply.github.com>
Co-authored-by: Tom Moor <tom@getoutline.com>
2025-05-31 13:53:42 -04:00
codegen-sh[bot] 7a5480f12f Add option to show modified timestamp on shared docs (#9347)
* Add showLastModified option to Share models

- Add showLastModified column to shares table with migration
- Add showLastModified field to client and server Share models
- Add 'Show last modified' toggle in share popover (PublicAccess component)
- Update shares.update API route to handle showLastModified field
- Include share data in documents.info API response for shared documents
- Modify DocumentMeta visibility logic to show timestamp when showLastModified is enabled
- Add proper type definitions across component hierarchy
- Follow existing patterns used by allowIndexing option

* Applied automatic fixes

* refactor

---------

Co-authored-by: codegen-sh[bot] <131295404+codegen-sh[bot]@users.noreply.github.com>
Co-authored-by: Tom Moor <tom@getoutline.com>
2025-05-31 11:29:55 -04:00
codegen-sh[bot] caaff1c3d6 Add order parameter to addDocumentToStructure function (#9342)
* Add order parameter to addDocumentToStructure function

- Add 'order' parameter with 'prepend' | 'append' options to Collection.addDocumentToStructure
- Update import logic to use 'append' order to preserve document sorting during import
- Fixes issue where exported documents lose their sorting when re-imported
- Maintains backward compatibility by defaulting to append behavior

Fixes #7532

* Fix TypeScript error: rename order parameter to insertOrder

The 'order' parameter in addDocumentToStructure was conflicting with
Sequelize's FindOptions.order property, causing a type intersection
error. Renamed it to 'insertOrder' to avoid the conflict.

Fixes TypeScript compilation errors in:
- server/queues/processors/ImportsProcessor.ts
- server/queues/tasks/ImportTask.ts

---------

Co-authored-by: codegen-sh[bot] <131295404+codegen-sh[bot]@users.noreply.github.com>
2025-05-30 20:45:11 -04:00
codegen-sh[bot] 2686e059a0 Fix URL duplication in shared documents with custom static URLs (#9340)
Fixes issue where internal document links in shared documents with custom
static URLs would have their share path duplicated, causing malformed URLs.

The bug was in ProsemirrorHelper.replaceInternalUrls() where the replaceUrl
function would replace ALL occurrences of '/doc/' with 'basePath/doc/',
even when the URL already contained the correct share path structure.

Now only URLs that start with '/doc/' get the basePath prepended, preventing
duplication for URLs that already have the share path.

Fixes #9338

Co-authored-by: codegen-sh[bot] <131295404+codegen-sh[bot]@users.noreply.github.com>
2025-05-30 19:05:21 -04:00
codegen-sh[bot] 11cff77162 Add installation.create API endpoint (#9324)
* Add installation.create API endpoint

- Add new endpoint that accepts teamName, userName, userEmail
- Use accountProvisioner to create team and user
- Only allow when no existing teams exist (unauthenticated)
- Add comprehensive tests for success, failure, and validation cases
- Add schema validation with Zod
- Include rate limiting (5 per hour)
- Follow existing API patterns and conventions

* Remove changes to .env.test

* fix

* Centralize validation

* test

* test

* test

---------

Co-authored-by: codegen-sh[bot] <131295404+codegen-sh[bot]@users.noreply.github.com>
Co-authored-by: Tom Moor <tom@getoutline.com>
2025-05-29 22:52:49 -04:00
codegen-sh[bot] c02a33a74c feat: Disable commenting per collection (#9295)
* Address PR feedback: Move commenting logic to Collection model

- Update openDocumentComments action to use collection.canCreateComment
- Update AuthenticatedLayout to check collection-level commenting setting
- Update DocumentMeta to use collection commenting preference
- Add commenting field to CollectionForm with proper UI
- Maintain backward compatibility with team-level preferences

* Applied automatic fixes

* Disable comment creation UI when collection commenting is disabled

- Update Editor component to use collection-level commenting setting
- Pass onCreateCommentMark as undefined when commenting is disabled
- This removes the shortcut and toolbar icon for comment creation
- Maintains backward compatibility with team-level preferences

* Fix TypeScript error in Editor component

- Fix props destructuring to avoid variable shadowing
- Ensure all required props are properly destructured
- Maintain correct property order from original implementation

* Fix TypeScript error: add missing activeCollectionId parameter

- Add activeCollectionId to import document action perform function
- This parameter was being used but not declared in the function signature
- Fixes TS2304 error: Cannot find name 'activeCollectionId'

* fix form

* docs

---------

Co-authored-by: codegen-sh[bot] <131295404+codegen-sh[bot]@users.noreply.github.com>
Co-authored-by: Tom Moor <tom@getoutline.com>
2025-05-24 18:35:50 -04:00
Tom Moor 5b7a5d751c Fix: Properly escape backslashes in search queries (#9297)
* Fix: Properly escape backslashes in search queries

This commit fixes a bug where backslashes in search queries were not properly escaped, leading to database errors.
The `escapeQuery` method is now applied to quoted queries and URLs to ensure that all parts of the search query are correctly escaped.

A test case has been added to verify that searching with backslashes works as expected.

* Fix: Properly escape backslashes in search query URLs

This commit fixes a bug where backslashes in URLs within search queries were not properly escaped, leading to database errors.
The `escapeQuery` method is now applied to `likelyUrls` before they are used in `iLike` conditions.

Quoted queries were found to be already escaped and are no longer double-escaped.
The existing test case for searching with backslashes remains relevant for verifying URL escaping.

* lint

---------

Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
2025-05-24 11:30:00 -04:00
Tom Moor 3ffee1239b Add revision deletion endpoints (#9240) 2025-05-21 22:57:02 -04:00
codegen-sh[bot] 3bc566915e Fix document URL generation for titles with only special characters (#9258)
* Fix document URL generation for titles with only special characters

* Refactor: Update instance path method to use static getPath method

---------

Co-authored-by: codegen-sh[bot] <131295404+codegen-sh[bot]@users.noreply.github.com>
2025-05-20 07:32:07 -04:00
Tom Moor 201fbb56eb perf: Add cache for document structure (#9196)
* Normalize Collection.findByPk

* Add caching of documentStructure

* fix: Do not set cache before transaction is flushed

* Mock Redis
2025-05-18 18:45:00 -04:00
codegen-sh[bot] e5ded0a6a5 Fix misalignment between email and comment mentions (#9234)
* Fix misalignment between email and comment mentions

* Add test

* Update ProsemirrorHelper.tsx

* Optimize user mention processing with batch loading

* Add test for multiple mentions

---------

Co-authored-by: codegen-sh[bot] <131295404+codegen-sh[bot]@users.noreply.github.com>
Co-authored-by: Tom Moor <tom@getoutline.com>
2025-05-17 12:45:45 -04:00
Hemachandar 052924d816 Resolve index collision when restoring collection (#9229)
* Resolve index collision when restoring collection

* use beforeUpdate hook
2025-05-16 23:56:46 -04:00
Hemachandar 610721eed6 fix: Ensure collection withUser scope is not overriden (#9226) 2025-05-16 08:16:25 -04:00
Tom Moor 08b7c11461 Normalize Collection.findByPk (#9193) 2025-05-14 00:05:45 -04:00
Tom Moor 2d6167e933 fix: Add encoding meta tag to exported HTML (#9207)
closes #9194
2025-05-13 22:47:48 -04:00
Tom Moor 68b07eb466 fix: withoutState scope should include state as fallback (#9145) 2025-05-07 18:49:33 -04:00
Tom Moor 06a149407a fix: withoutState scope should include state as fallback (#9144) 2025-05-07 09:00:42 -04:00
Tom Moor b9387734c7 perf: Remove documentStructure from default query select (#9141)
* perf: Remove documentStructure from default query select

* test
2025-05-07 07:47:57 -04:00
Tom Moor 3f8bdf7ac2 Refactor withMembershipScope (#9134) 2025-05-04 18:37:01 -04:00
Tom Moor 9c4b4f4989 fix: Chained scopes overwrite (#9133) 2025-05-04 22:16:38 +00:00
Tom Moor a06671e8ce OAuth provider (#8884)
This PR contains the necessary work to make Outline an OAuth provider including:

- OAuth app registration
- OAuth app management
- Private / public apps (Public in cloud only)
- Full OAuth 2.0 spec compatible authentication flow
- Granular scopes
- User token management screen in settings
- Associated API endpoints for programatic access
2025-05-03 19:40:18 -04:00
Tom Moor fd3c21d28b Remove withCollectionPermissions scope (#9124)
* Remove withCollectionPermissions scope

* defaultScopeWithUser -> withUserScope

* fix: Include withDrafts in groupMemberships.list

* rename
2025-05-03 12:00:54 -04:00
codegen-sh[bot] a226889143 Update task scheduling to use instance method (#9092)
* Update task scheduling to use instance method

* Delete update_task_schedule.sh

* Applied automatic fixes

* tsc

---------

Co-authored-by: codegen-sh[bot] <131295404+codegen-sh[bot]@users.noreply.github.com>
Co-authored-by: Tom Moor <tom@getoutline.com>
2025-04-29 06:47:51 -04:00
Tom Moor 347f033802 fix: Notifications received for draft with access but no subscription (#9099) 2025-04-29 06:45:15 -04:00
Tom Moor 7e05fc1017 Revert "Add recency boost to search results (#9038)" (#9065)
This reverts commit 2bc47cfcef.
2025-04-26 16:44:49 +00:00