Commit Graph

2515 Commits

Author SHA1 Message Date
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
Tom Moor 064adb72e1 fix: ctx.url is actually the path, thanks koa (#9545) 2025-07-04 14:47:14 +00:00
Tom Moor 71459e648f fix: Do not print canonical url if same as current (#9525) 2025-07-02 07:25:09 -04:00
Tom Moor 5de549c882 fix: Double title on import of some documents (#9522) 2025-07-01 17:10:01 -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
Tom Moor c4d798d70b fix: Various fixes for HTML -> Markdown conversion (#9509)
* chore: List conversion should use a single space between marker and content

* Simplify table header detection
2025-06-29 11:57:40 -04:00
Tom Moor 8e56f58102 chore: Add additional validation to SMTP_SERVICE env (#9506)
Related #9505
2025-06-29 04:34:47 -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 f6f831f3f6 fix: Enable PKCE if OIDC discovery endpoint supports it (#9478)
* fix: Enable PKCE if OIDC discovery endpoint supports it

* fix: Ensure code_verifier is passed through state

* facepalm
2025-06-27 11:06:45 -04:00
Tom Moor 0244ac2a84 feat: Allow allowIndexing and showLastUpdated to be set in shares.create endpoint (#9476) 2025-06-24 17:21:06 -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 120a3388ed fix: Commenting unavailable on individually shared documents (#9449)
Refactor to use policies for comment
2025-06-15 09:45:42 -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 26f16939ca fix: Memberships loaded for incorrect user in collection add_user/remove_user (#9428)
closes #9306
2025-06-10 21:24:22 -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
Hemachandar 39f9bfbbcd fix: Persist document icon & color in import flow (#9421) 2025-06-10 08:10:14 -04:00
Hemachandar 39c2aca883 chore: Cleanup deprecated task schedule method (#9415) 2025-06-09 19:33:46 -04:00
Hemachandar a85fec57cc chore: Cleanup unfurl temporary backward compatibility (#9406) 2025-06-08 09:24:32 -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
Tom Moor 5ace3363ac fix: Dont invalidate policy on doc creation (#9404) 2025-06-07 15:59:55 +00:00
Tom Moor 384186c318 fix: Canonical meta tag is incorrect for documents shared to custom domain (#9398) 2025-06-06 18:28:29 -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
Tom Moor 1836d2ef63 chore: Fix various lint warnings (#9362)
* Fix various linting errors

This commit addresses several linting warnings reported by ESLint:

- @typescript-eslint/no-shadow:
  - I renamed variables in inner scopes to avoid conflicts with variables in outer scopes in the following files:
    - server/commands/accountProvisioner.ts
    - server/commands/documentDuplicator.ts
    - server/commands/documentMover.ts
    - server/commands/teamProvisioner.test.ts
    - server/commands/teamProvisioner.ts
    - server/commands/userInviter.ts
    - server/commands/userProvisioner.ts
    - server/emails/templates/BaseEmail.tsx
- @typescript-eslint/no-explicit-any:
  - I replaced `any` with more specific types (Record<string, unknown> or void) in the following files:
    - server/emails/templates/BaseEmail.tsx
    - server/emails/templates/InviteEmail.tsx
    - server/emails/templates/SigninEmail.tsx
    - server/logging/Logger.ts

These changes improve code clarity and type safety without altering functionality.

* Update BaseEmail.tsx

* lint

---------

Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
2025-06-01 10:59:55 -04:00
Tom Moor 82dc24040c feat: Add screen to provision workspace (#9355)
* wip

* refactor

* lint
2025-05-31 23:27:44 -04:00
Tom Moor 665b19d933 perf: Remove fetchIfMissing websocket property (#9351)
* Remove fetchIfMissing websocket property

* Refactor to invalidatedPolicies

* invalidate
2025-05-31 21:52:17 -04:00
Tom Moor f6d9d00947 fix: First time migration fails (Regressed in #9345) (#9353) 2025-05-31 20:46:39 +00: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] cd0acc40bb Add support for individual database environment variables (#9344)
* Add support for individual database environment variables

- Add DATABASE_HOST, DATABASE_PORT, DATABASE_NAME, DATABASE_USER, DATABASE_PASSWORD env vars
- Implement mutual exclusivity validation between DATABASE_URL and individual components
- Add effectiveDatabaseUrl getter to construct URL from individual components
- Update database connection logic to use new configuration options
- Ensure backward compatibility with existing DATABASE_URL configuration

Resolves: https://github.com/outline/outline/discussions/9158

* Refactor database configuration methods

- Move effectiveDatabaseUrl method from env.ts to database.ts as getEffectiveDatabaseUrl function
- Remove validateDatabaseConfiguration method from env.ts as validation is handled by decorators
- Maintain clean separation of concerns between environment and database modules

* Pass database options directly to Sequelize constructor

- Replace URL construction with direct Sequelize configuration object
- Support both DATABASE_URL string and individual component object configurations
- Maintain common Sequelize options for both configuration types
- Improve error messaging for different configuration scenarios

* remove spurious comments

* tsc

---------

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:30:28 -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
Tom Moor aa8e077649 feat: Add sitemap to publicly shared documents with indexing enabled (#9334)
* quick: Add sitemap to publicly shared documents with indexing enabled

* escape
2025-05-30 17:54:14 -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] f284a27941 feat: Add OIDC well-known endpoint discovery support (#9308)
* feat: Add OIDC well-known endpoint discovery support

Co-authored-by: codegen-sh[bot] <131295404+codegen-sh[bot]@users.noreply.github.com>
Co-authored-by: Tom Moor <tom@getoutline.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-05-27 07:56:02 -04:00
Tom Moor 0198b80b5d fix: JSON import goes through MD serialization (#9309)
* fix: JSON import goes through MD serialization

* rm

* tsc
2025-05-26 08:48:57 -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 73fea094a8 Prevent outdated clients from connecting to collaboration server (#9291)
Follow up to #8751
2025-05-23 23:49:22 -04:00
Tom Moor 3ffee1239b Add revision deletion endpoints (#9240) 2025-05-21 22:57:02 -04:00
Tom Moor 22c0f18b6b fix: null collectionId received in websocket payload for unpublished drafts (#9276) 2025-05-21 22:44:06 -04:00
Tom Moor 76d9a02fee fix: Use team name on link metadata if public branding enabled (#9273) 2025-05-21 21:01:31 -04:00
codegen-sh[bot] eaf2fd102e Add attachments.list API endpoint (#9259)
* Add attachments.list endpoint to retrieve user's attachments

* Fix TypeScript error in attachments.list endpoint

* Address review comments: restore tests, properly type WhereOptions, remove comments

* fix: Pagination, user filtering

---------

Co-authored-by: codegen-sh[bot] <131295404+codegen-sh[bot]@users.noreply.github.com>
Co-authored-by: Codegen Bot <codegen@example.com>
Co-authored-by: Tom Moor <tom@getoutline.com>
2025-05-20 19:25:55 -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 19627f4d07 fix: Guard all import tasks being filtered out (#9256) 2025-05-19 23:18:31 -04:00
Tom Moor e596b57cc2 chore: Add additional details to validation errors (#9243)
This will help us get to the bottom of Notion importer failures
2025-05-18 20:27:47 -04:00
Tom Moor b8fd239f2e Add additional logging to getFileStream failures (#9242) 2025-05-18 19:24:50 -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