Migrating reference settings to mongo and exposing them through code … (#31726)

* Migrating reference settings to mongo and exposing them through code mirror context

* removing undefined optional for reference manager type settings

* allowing partial updates to user settings objects, and remove repeated cypress intercepts

* Zod schema parsing for user reference manager settings

* Splitting ref provider mongoose schema into const

* Persisting local storage reference settings to mongo and deleting from local

* Enforcing ref provider group id to always be type string

* Fixing test and format errors

* Migrated flag for settings to only migrate once

* fixing cypress tests adding migrated flag

* persisting local storage to allow for easy rollback

GitOrigin-RevId: f59522bdee6f0e56efb7d98b9d9373a743619ec8
This commit is contained in:
l-obrien-overleaf
2026-03-26 09:07:40 +00:00
committed by Copybot
parent 03c30a9d1b
commit 27e5044d30
9 changed files with 368 additions and 0 deletions
+16
View File
@@ -7,6 +7,19 @@ const { ObjectId } = Schema
// See https://stackoverflow.com/questions/386294/what-is-the-maximum-length-of-a-valid-email-address/574698#574698
const MAX_EMAIL_LENGTH = 254
const MAX_NAME_LENGTH = 255
const refProviderSettingsSchema = {
enabled: { type: Boolean, default: true },
groups: {
type: [
{
id: { type: String },
},
],
default: [],
},
disablePersonalLibrary: { type: Boolean, default: false },
migrated: { type: Boolean, default: false },
}
export const UserSchema = new Schema(
{
@@ -94,6 +107,9 @@ export const UserSchema = new Schema(
breadcrumbs: { type: Boolean, default: true },
referencesSearchMode: { type: String, default: 'advanced' }, // 'advanced' or 'simple'
darkModePdf: { type: Boolean, default: false },
zotero: refProviderSettingsSchema,
mendeley: refProviderSettingsSchema,
papers: refProviderSettingsSchema,
},
features: {
collaborators: {