* Add helpers for checking and removing user readwrite token membership
* Add sharing-updates page and handlers
* Redirect read write token members to sharing-updates on project load
GitOrigin-RevId: d552a2cd74a9843c6103923b03f137131a48877a
* Only show the AI error assistant to users with write permission on the project
* Fix line number in searchDocLines
* Abort the request after 60 seconds
* Move comment
* Jump to file + line when suggestion line number is clicked
* Set tool_choice: 'required'
* Fix handling of suggestLineChange
* Tidy up getDocLines
* Avoid showing Suggest Fix button in gutter marker for typesetting warnings
* Log request errors
* Fix prefixed function name
* Update tool description
* Tweak the prompt in an attempt to improve the line number
* Reject if the total message content is too large
* Change the structure of the suggested change
* Reduce line highlight
* Fix change highlighting on deletion
GitOrigin-RevId: afde096e547050b8518195ef51b68983bc3b0be3
* Move unawaited promises out of `p-props`: `User.updateOne`
* Move unawaited promises out of `p-props`: `sessionMaintenance`
* Move unawaited promises out of `p-props`: `reactivateProjectIfRequired`
* Move unawaited promises out of `p-props`: `markAsOpened`
* Move unawaited promises out of `p-props`: `flushProjectToTpdsIfNeeded`
This was actually awaited, but is it necessary?
* Use `getUserValues`: `user`
* Use `getUserValues`: `learnedWords`
* Use `getUserValues`: `projectTags`
* Use `getUserValues`: `userHasInstitutionLicence`
* Use `getUserValues`: `subscription`
* Use `getUserValues`: `isTokenMember`
* Use `getUserValues`: `isInvitedMember`
* Update `splitTestAssignments` syntax
* Remove `mapValues` in `pProps`
* Await unused promises again: `flushProjectToTpdsIfNeeded` and `reactivateProjectIfRequired`
* Remove error page file committed by mistake 🤦
GitOrigin-RevId: 6529445c364a6af660bc8ab6dfc836a4ddf7a040
* Reapply "[web] Promisify MetricsEmailController and InstitutionHubsController …"
This reverts commit ea14df1395f1dc2fa7d41fc7837849f9686425b5.
* Fix changes to node-fetch: `statusCode` -> `status` (!!)
* Update test
* Handle no-content without throwing (!)
Avoid error `Unexpected end of JSON input` when doing `response.json()` on an empty response when status is 204
Related: https://github.com/node-fetch/node-fetch/issues/165
* Also return `204` when no data in departments_data and roles_data
* Revert "Handle no-content without throwing (!)", and return null instead
This reverts commits 3baa779f7a9e64804e54a276faf865ab9252f336 and 51507a3d763d7006c8b01414a7c79bd3f3b6948b.
* Update tests: `assert_nil`
* Fixup: Update tests: assert null
* Use `fetchJSON` in Institution.fetchV1Data
* Proxy errors from server without throwing 500
GitOrigin-RevId: 9c13e293f3fed3abd2accddd1a9060ed02b96ba2
* add RestoreFileOrigin in overleaf-editor-core
* support source to be an object
* use sourceOrOrigin as param
* rename to originOrSource so the priority is more clear
* get timestamp from version
* fix test
* include version and min_count in getUpdatesFromHistory
* extractOriginOrSource util function
* fix RestoreManagerTests
GitOrigin-RevId: 0ace05a6ade2794c753a9d0bffb4f858ecc6899a
This config is superseded by `plansFeatures.js` that is imported by `plansConfig.js` which is directly used in the pug template.
GitOrigin-RevId: ae0a0e1ff7c8a64022ab378d17943fe4a7ed3b35
* Promisify LdapController
* Update tests LdapControllerTests.js
* Promisify `AuthenticationController.finishLogin`
* Simplify null checks in LdapController
* Fix: don't use spread operator in module.exports
* Make `AuthenticationController.promises.finishLogin` a promise that resolves
* Fixup: `finishLogin` does not call `next` then the promise finishes, it calls it only on errors
* Use `Modules.promises.hooks.fire`
* Revert `processPassportLogin` callback style
* Update error handling: Use `OError.tag` instead of `logger.err`
* Fix unit tests: Rely on callbacks rather than promises
* Fix: Actually call `passport.authenticate` (!!)
* Update test: fixup `passport.authenticate` mocks
This would have caught the bugs that the previous commit is solving
* Remove `.then(() => next())` in `processPassportLogin`
Co-authored-by: Eric Mc Sween <eric.mcsween@overleaf.com>
---------
Co-authored-by: Eric Mc Sween <eric.mcsween@overleaf.com>
GitOrigin-RevId: a7eab5f5289956aeb8f2418408958daef3511ab7
* [web] revert binary file
* use addEntityWithName if file was deleted
* todo comments
* only show Revert file in ui even if deleted
* use _revertBinaryFile function
* emit new ids when reverting
* format:fix
* await emitToRoom calls
* use EditorController.upsertFile
* remove _revertBinaryFile function
* binary file check
* mock importFile method in tests
* move findElementByPath stub
* debug ci error
* resolve with empty object as file
* fix tests
* remove await before expect()
* format:fix
* test when binary file exists and when it does not
* use "file-revert" for source
* [web] revert existing file without ranges support (#18107)
* [web] revert existing file without ranges support
* ignore document_updated_externally if file-revert
* fix test
GitOrigin-RevId: a5e0c83a7635bc7d934dec9debe916bdd4beb51e
* Create `getPaginatedEndpointIterator` to iterate each page
* Create `waitMs` util, it will replace `slowCallback`
* Make `handleAPIError` async
* Make `isAccountUsingPaypal` async
* Make `attemptInvoiceCollection` async
* Make `attemptInvoicesCollection` async
* Use `await` instead of `new Promise`
* Remove unused callbackified `attemptInvoiceCollection`
* Run `attemptInvoiceCollection` for each page instead of gathering all pages in the beginning
* Add test on fetching multiple pages of invoice
GitOrigin-RevId: 2674b18c6ca5732b873fb2bc71b515909006f93d
* Rename `RecurlyWrapper` to `promises`, as it will only contain the promises soon
* Update `apiRequest`
* Update `_parseXml`
* Update `_parseXmlAndGetAttribute`
* Update `_parse*Xml`
* Update `updateAccountEmailAddress`
* Update `checkAccountExists`
* Update `createAccount`
* Update `createBillingInfo`
* Update `setAddressAndCompanyBillingInfo`
* Update `createSubscription`
* Update `_createPaypalSubscription`
* Update `_handle422Response`
* Update `_createCreditCardSubscription`
* Update `createSubscription`
* Update `getSubscriptions`
* Update `getSubscription`
* Update `getPaginatedEndpoint`
* Update `getAccount`
* Update `getAccountActiveCoupons`
* Update `getCoupon`
* Update `getBillingInfo`
* Update `getAccountPastDueInvoices`
* Update `attemptInvoiceCollection`
* Update `updateSubscription`
* Update `createFixedAmmountCoupon`
* Update `lookupCoupon`
* Update `redeemCoupon`
* Update `extendTrial`
* Update `listAccountActiveSubscriptions`
* To find which functions to add as callbackified, I used this Regex:
`RecurlyWrapper\.(?!promises)[^.\s]*`
And after adding callbackified functions, we're left with no results with the Regex:
`RecurlyWrapper\.(?!promises|apiUrl|_buildXml|_parseXml|attemptInvoiceCollection|createFixedAmmountCoupon|getAccountActiveCoupons|getBillingInfo|getPaginatedEndpoint|getSubscription|updateAccountEmailAddress)[^.\s]*`
* Update unit tests
* Test `getSubscription` both as "promise" and as "callback"
I'm not sure if we want to generalize this.
* Fix: add missing `await`s (!!)
* Change `apiRequest` to reject errors instead of resolving it in an object
* Fixup for CollectPayPalPastDueInvoice test
* Fix: callbackify `getSubscriptions` (!!)
* Replace `.then(...)` chain by multiple `await`
* Fixup `attemptInvoicesCollection`: prevent reading length of undefined
* Use `return await` when returning promises
Per https://github.com/overleaf/internal/pull/18384#pullrequestreview-2065738771
GitOrigin-RevId: ceda755b24fd29f97a27e60ac5db9bc7e369f932
* Fix `revokeAllUserSessions` call in `_cleanupUser`
The user object should be passed, not the _id
* Change `revokeAllUserSessions` signature, take `req` and `stayLoggedIn` arguments
* Update uses of `revokeAllUserSessions`
* Fix promisified `revokeAllUserSessions` args
* Update tests
* Destroy or Regenerate the session in the end of `revokeAllUserSessions`
Per https://github.com/overleaf/internal/issues/17036#issuecomment-1938398570
* Revert "Destroy or Regenerate the session in the end of `revokeAllUserSessions`"
This reverts commit fe30734dbe45b27d2931d2e43a711d591bb85787.
* Rename `revokeAllUserSessions` to `removeSessionsFromRedis`
* Fixup tests
* Fix: add optional chaining in `req.sessionID` (!!)
GitOrigin-RevId: d41676bf00f463230af495e09c65fb9ee521f49f