Commit graph

408 commits

Author SHA1 Message Date
Antoine Clausse
78a0bc2b05 [web] Convert RecurlyWrapper functions to async (#18384)
* 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
2024-05-27 10:21:26 +00:00
Antoine Clausse
25d8e053be [web] Update revokeAllUserSessions and rename it to removeSessionsFromRedis (#18360)
* 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
2024-05-20 08:04:12 +00:00
Antoine Clausse
d7f0c66d86 [web] Rename team name IEEECollabratec to IEEEPublications (#18387)
* Replaces all `IEEECollabratec` by `IEEEPublications`

* Revert change in migration

GitOrigin-RevId: f0445b726abdc5f65b7a0613d9979b081332685e
2024-05-17 08:05:06 +00:00
Brian Gough
598eaf08fd Merge pull request #17816 from overleaf/bg-eslint-rule-for-find-with-await
add eslint rule for find with await

GitOrigin-RevId: 7e78104e610073ff3c151d7314753c8301a8c787
2024-05-17 08:04:58 +00:00
Antoine Clausse
9419cc3b37 [web] Add tests to collect_paypal_past_due_invoice.js + update logging (#18310)
* Fix: Invoices collected array length comparison

Update the code with the correct condition to respect the intent of the previous implementation ("exit with non zero code when no invoicess were processed").
See 5476f39984

However, I'm not sure if erroring when no invoices are collected is actually what we want to do.

* Wrap `collect_paypal_past_due_invoice` script and export the function

* Fixup typo `accoutns`

* Log invoices collection data before throwing

* Add note: `handleAPIError` is silencing the errors

* Create a test on `collect_paypal_past_due_invoice`

* Replace `console.log` by `@overleaf/logger` (bunyan)

Our `console.warn` show up as Errors (in red) in GCP. For example the following is an error in GCP:
```
Errors in attemptInvoiceCollection with id=2693634 OError: Recurly API returned with status code: 400
```
https://github.com/overleaf/internal/blob/5476f39/services/web/scripts/recurly/collect_paypal_past_due_invoice.js#L9

---

Does it correctly set the levels as warnings if we use `@overleaf/logger`

GitOrigin-RevId: 37c8bdf4afd8cef4706700aafb44480ec8966a74
2024-05-15 08:04:46 +00:00
Antoine Clausse
a26c655220 Delete 3 migration scripts for compile-timeouts (#18163)
Co-authored-by: Jakob Ackermann <jakob.ackermann@overleaf.com>
GitOrigin-RevId: 2d66052994159b6d902b807f02488095d65562e1
2024-05-01 08:05:00 +00:00
Antoine Clausse
cdd79e8ec0 Fix: unset recent users featuresUpdatedAt after wrong update (#18149)
* Copy previous script

* Remove `featuresUpdatedAt` that was wrongly set on recent users

* Fix! `signupDate` -> `signUpDate`

* Add test on `migration_compile_timeout_60s_to_20s_fixup_new_users.js`

* style: `$unset: { featuresUpdatedAt: 1 }` -> `$unset: { featuresUpdatedAt: '' }`

Co-authored-by: Jakob Ackermann <jakob.ackermann@overleaf.com>

* Add comment on test (https://github.com/overleaf/internal/pull/18149#discussion_r1582999534)

Co-authored-by: Jakob Ackermann <jakob.ackermann@overleaf.com>

---------

Co-authored-by: Jakob Ackermann <jakob.ackermann@overleaf.com>
GitOrigin-RevId: 408f5c7d48e60722aba736167b8e8858e9570d99
2024-04-30 08:04:33 +00:00
Antoine Clausse
711d50a2f1 [web] Create script to update forgotten featuresUpdatedAt after the migration to 20s compile timeout (#18113)
* Copy `migration_compile_timeout_60s_to_20s.js` script

* Update `featuresUpdatedAt`

* Add a comment about `featuresUpdatedAt` in migration_compile_timeout_60s_to_20s.js

* Fix test on migration_compile_timeout_60s_to_20s.js

* Fix: Include users having `featuresUpdatedAt` undefined in the update

* Add test on `migration_compile_timeout_60s_to_20s_fixup_features_updated_at`

GitOrigin-RevId: 4b2baf955a6a9f39bf9ce00b7839af551064c6cb
2024-04-30 08:04:28 +00:00
roo hutton
2469c93da4 Merge pull request #17870 from overleaf/bg-node-upgrade-18-20-2
upgrade node to 18.20.2

GitOrigin-RevId: e4ac30c740ced3885353f1472cf690eb5ec0ece1
2024-04-24 08:05:16 +00:00
Antoine Clausse
b2ef7a935f [web] Use localized number formatting for currencies (#17622)
* Add a unit test on `SubscriptionFormatters.formatPrice`

* Add JSDoc to `formatPrice`

Also: Name the functions before exporting:
This fixes my IDE (WebStorm) navigation

* Make `'USD'` the default param instead of reassigning

* Create `formatCurrency` function

* Use `formatCurrency` in SubscriptionFormatters

* Use an `isNoCentsCurrency` logic for `CLP` `JPY` `KRW` `VND`

And remove custom `CLP` logic and locale

* Add `locale` param to `formatPrice`

* Generate `groups.json` and `localizedPlanPricing.json`

```
bin/exec web node ./scripts/recurly/recurly_prices.js --download -o prices.json
bin/exec web node ./scripts/plan-prices/plans.js -f ../../prices.json -o dir
```

* Update scripts/plan-prices/plans.js to generate numbers instead of localized amounts

* Generate `groups.json` and `localizedPlanPricing.json`

```
bin/exec web node ./scripts/recurly/recurly_prices.js --download -o prices.json
bin/exec web node ./scripts/plan-prices/plans.js -f ../../prices.json -o dir
```

* Remove generation of `plans.json`

As /services/web/frontend/js/main/plans.js was removed in https://github.com/overleaf/internal/pull/12593

* Sort currencies in alphabetical order in scripts/plan-prices/plans.js

* Generate `groups.json` and `localizedPlanPricing.json`

```
bin/exec web node ./scripts/recurly/recurly_prices.js --download -o prices.json
bin/exec web node ./scripts/plan-prices/plans.js -f ../../prices.json -o dir
```

* Use `formatCurrency` in price-summary.tsx

* Use `formatCurrency` in Subscription Pug files

* Fix unit tests SubscriptionHelperTests.js

* Remove unused `currencySymbol`

* Change to `formatCurrency` in other React components

* Add `CurrencyCode` JSDoc types

* Duplicate `formatCurrency` into services/web/app/src/util

* Wrap tests in a top-level describe block

* Use `narrowSymbol`

* Fix tests with `narrowSymbol` expects

* Revert deletion of old `formatPrice` in SubscriptionFormatters.js

* Rename `formatCurrency` -> `formatCurrencyLocalized`

* Revert deletion of `CurrencySymbol`

* Add split-test in SubscriptionController.js

* Add split-test in SubscriptionViewModelBuilder.js

* Add split-test in plans

* Add split-test in subscription-dashboard-context.tsx

* Add split-test in 4 more components

* Update tests

* Show currency and payment methods in interstitial page

* Fix `&ndash;` being printed. Use `–` instead

* Fix test with NOK

* Storybook: Fix missing `SplitTestProvider`

* Storybook: Revert "Remove unused `currencySymbol`"

This reverts commit e55387d4753f97bbf8e39e0fdc3ad17312122aaa.

* Replace `getSplitTestVariant` by `useSplitTestContext`

* Use parameterize currencyFormat in `generateInitialLocalizedGroupPrice`

* Fixup import paths of `formatCurrencyLocalized`

* Replace `% 1 === 0` by `Number.isInteger`

* Add comment explaining that any combinations of languages/currencies could happen

* Fixup after rebase: import `useSplitTestContext`

* Revert "Remove SplitTestProvider from subscription root"

This reverts commit be9f378fda715b86589ab0759737581c72321d87.

* Revert "Remove split test provider from some tests"

This reverts commit 985522932b550cfd38fa6a4f4c3d2ebaee6ff7df.

GitOrigin-RevId: 59a83cbbe0f7cc7e45f189c654e23fcf9bfa37af
2024-04-19 08:03:54 +00:00
Antoine Clausse
616bd0df16 Merge pull request #17925 from overleaf/jpa-ac-20s-timeout-migration-logging-tweaks
[web] timeout 20s split-test teardown cleanups (remove override, remove tests, ...)

GitOrigin-RevId: 8d8c44539cf45d0f5142f84cf8372cecda3bf77a
2024-04-17 08:04:30 +00:00
Jakob Ackermann
3df0fe82ce Merge pull request #17926 from overleaf/jpa-batched-update-sorting
[web] batchedUpdate: use explicit sorting to find first record to update

GitOrigin-RevId: 6f57b92a4e5907f307618bd98642b4874018e9fa
2024-04-17 08:04:09 +00:00
Antoine Clausse
d35204033f Merge pull request #17909 from overleaf/ac-tear-down-compile-timeout-tests-2
[web]  Remove split-tests `compile-backend-class*` and `compile-timeout-20s*` (attempt 2)

GitOrigin-RevId: 5658f2977d3e7089eec5bbe7a33eee81c153e41d
2024-04-16 08:04:08 +00:00
Antoine Clausse
491bc2628d Merge pull request #17899 from overleaf/revert-17700-ac-tear-down-compile-timeout-tests
Revert "[web] Remove split-tests `compile-backend-class*` and `compile-timeout-20s*`"

GitOrigin-RevId: d5070ced06adbd435e782a44b7ef767e395bd6a0
2024-04-15 08:04:37 +00:00
Antoine Clausse
2dd10c7fee [web] Remove split-tests compile-backend-class* and compile-timeout-20s* (#17700)
* Remove split-tests of `compile-timeout-20s` and `compile-timeout-20s-existing-users`

* Remove `NEW_COMPILE_TIMEOUT_ENFORCED_CUTOFF` variables

* Revert timeout override `60` -> `20`

* Update settings.overrides.saas.js: `compileTimeout: 20`

* Remove `compile-backend-class-n2d`

* Remove `force_new_compile_timeout`

* Remove `showNewCompileTimeoutUI`

* Remove `compileTimeChanging`

* Simplify code by removing segmentation object

* Remove `CompileTimeoutChangingSoon`

* Remove `user.features.compileTimeout = '20 (with 10s prompt)'`

* Remove `CompileTimeWarning`

* Remove `TimeoutUpgradePrompt` (old)

* Remove `compile-backend-class`

* Remove unused translations

* Update tests

* Fix: Show `CompileTimeout` even if `!window.ExposedSettings.enableSubscriptions`

* Create script to migrate users to 20s compileTimeout

* migration script: exclude `compileTimeout: 20` from the match

* migration script: use `batchedUpdate`

* Remove `showFasterCompilesFeedbackUI` and `FasterCompilesFeedback`

Helped-by: Jakob Ackermann <jakob.ackermann@overleaf.com>

* Remove `_getCompileBackendClassDetails`, simplify definition of `limits` object

* Remove `Settings.apis.clsi.defaultBackendClass`

* Remove unnecessary second scan of the whole user collection in dry mode

* Override `timeout` to 20 for users having `compileGroup === 'standard' && compileTimeout <= 60`

* Remove second `logCount`: re-run the script in dry-mode if you want to see that count

* Use secondary readPreference when counting users

* Fix script setup and exit 0

* Fix: Remove `user.` from query path!

* Add acceptance test on script migration_compile_timeout_60s_to_20s.js

GitOrigin-RevId: 3cb65130e6d7fbd9c54005f4c213066d0473e9d8
2024-04-15 08:04:24 +00:00
Brian Gough
a9d1ddcb22 Merge pull request #17748 from overleaf/bg-node-security-upgrade-2024-04-05
upgrade node version to 18.20.1

GitOrigin-RevId: 28f8f7c7f63285f7b7355e65713d9ed2dbda8a0e
2024-04-08 08:04:41 +00:00
David
a41879b1a0 Merge pull request #17645 from overleaf/dp-ac-ieee-deprecation-script-remove-users
Create a script to remove users from IEEECollabratec

GitOrigin-RevId: 028537722534ba0091cb8c50c8d0a8e6084af22d
2024-03-29 09:04:17 +00:00
Antoine Clausse
8b670f4378 Create a script to extract OnboardingDataCollection (#17657)
* Create a script to extract OnboardingDataCollection

* Add `userId` to the CSV

* Add `firstName` and `lastName` booleans to the CSV

GitOrigin-RevId: ad1c8b9f88358553651f55563dad597767ab7a88
2024-03-28 09:04:33 +00:00
David
6fef715316 Merge pull request #17611 from overleaf/dp-unlink-sso-script
Add script to unlink a third party identifier

GitOrigin-RevId: ded0672121fdf8c6cf30f94580f4491af9321dd7
2024-03-26 09:04:40 +00:00
Alf Eaton
6cc2db3cdd Merge pull request #17525 from overleaf/ae-upgrade-prettier
Upgrade Prettier to v3

GitOrigin-RevId: 6f1338f196408f3edb4892d5220ad3665ff1a5bc
2024-03-26 09:04:05 +00:00
David
6d55f2e09d Merge pull request #17457 from overleaf/dp-local-collabratec-helpers
Add oauth/create_token.js script for creating oauth tokens locally

GitOrigin-RevId: 5020a5b1946006da020e15afd2ddc1d04cbb8fed
2024-03-26 09:04:00 +00:00
roo hutton
3dac268d1f Merge pull request #17529 from overleaf/rh-sanitize-html
upgrade sanitize-html to 2.12.1 in web/scripts/translations

GitOrigin-RevId: 83e42beb3c091c3d7900c1f95a0b897ea2969522
2024-03-22 09:03:16 +00:00
David
af7ca5d212 Merge pull request #17586 from overleaf/dp-fix-IEEE-script
Fix notification deletion in IEEE script

GitOrigin-RevId: cb921f87290202e3116aeafc3341d3bff782d6fa
2024-03-20 09:03:06 +00:00
David
3ca09c07a1 Merge pull request #17508 from overleaf/dp-ac-ieee-deprecation-notifications
Update notifications for IEEE Retirement

GitOrigin-RevId: f4e02e5fd838c2b1a6227c86f48bb12dd6bdb9a3
2024-03-18 09:04:32 +00:00
ilkin-overleaf
1c34a3fa68 add missing token access fields to projects (#17372)
GitOrigin-RevId: d2eca00c40af65f0309f4b196fc3b5f043761729
2024-03-06 17:27:26 +00:00
ilkin-overleaf
7130a981b7 Merge pull request #17294 from overleaf/ii-token-access-null-values-2
[web] Use secondary when fixing token access values in projects

GitOrigin-RevId: 2111b20630530e2c8d09120a783c84efe6e976ed
2024-02-28 10:24:00 +00:00
Brian Gough
9127e59599 Merge pull request #17291 from overleaf/bg-purge-non-logged-in-sessions
purge sessions using mget/del with multiple keys

GitOrigin-RevId: 9a4c0d1dee1f349282a154da9d25cb78a5bedb77
2024-02-27 17:02:10 +00:00
ilkin-overleaf
b04247dd5a Merge pull request #17023 from overleaf/ii-token-access-null-values
[web] Fix projects token access values

GitOrigin-RevId: f0c6a4993e42320c06753cb65198138afe55b71a
2024-02-26 09:03:13 +00:00
Jakob Ackermann
39189978ac Merge pull request #17170 from overleaf/jpa-node-18-19-1
[misc] upgrade Node.js to 18.19.1

GitOrigin-RevId: 1bd2008682b585c3fccc65f74c90ba7fc9edc023
2024-02-20 09:04:55 +00:00
Jakob Ackermann
8523c21158 Merge pull request #16948 from overleaf/jpa-rails-sharelatex-rebranding-step-2
[web] migrate v1 api calls away from ShareLaTeX branded endpoints

GitOrigin-RevId: af08ee029d0cee8f0f171d21b4f2b0b76222b3f8
2024-02-13 09:03:35 +00:00
Tim Down
56a72690d5 Merge pull request #16521 from overleaf/td-ieee-collabratec-notification
Add notification and script for IEEE Collabratec users

GitOrigin-RevId: 7f463baa172514d9f1d37f99a02b311b8f925cd8
2024-01-18 09:04:44 +00:00
Eric Mc Sween
b0f3f00c43 Merge pull request #16368 from overleaf/em-remove-project-archiver-code
Remove project-archiver related code

GitOrigin-RevId: b3331033658c14a7c4d8745fd7085cd7c65c94bc
2024-01-05 09:03:21 +00:00
Jimmy Domagala-Tang
ebd2a2f5fe Merge pull request #16353 from overleaf/em-typescript-in-web-backend
Enable type checking in the web backend

GitOrigin-RevId: cc8e34777c89704765fcd9b973aed806c3ae9016
2024-01-04 09:03:43 +00:00
Mathias Jakobsen
c371732e6e Merge pull request #16186 from overleaf/mj-mongo-object-id
[web] Use constructor for ObjectId

GitOrigin-RevId: 9eb8b377ea599605b72af237d1ab12f4d8287162
2023-12-19 09:04:02 +00:00
Jakob Ackermann
92dabf236c Merge pull request #16045 from overleaf/revert-16012-jpa-purge-legacy-pw
Revert "[web] purge legacy passwords"

GitOrigin-RevId: 59f2094b853139ffa96a6803c97aebe4ba3c35ee
2023-11-30 09:04:04 +00:00
Jakob Ackermann
5ea17d452f Merge pull request #16012 from overleaf/jpa-purge-legacy-pw
[web] purge legacy passwords

GitOrigin-RevId: db779de632e1ac96cce341d79ff251908640ea72
2023-11-30 09:03:52 +00:00
Jakob Ackermann
9dca97cb50 Merge pull request #15923 from overleaf/jpa-tweak-delay-in-seconds
[web] allow disconnect_all_users.js --delay-in-seconds=0

GitOrigin-RevId: f52f26588da502ab43724854a3fe138347767f09
2023-11-27 09:04:02 +00:00
Brian Gough
04e6819538 Merge pull request #14217 from overleaf/bg-node-18-stress-test-file-buffer
add files option  for create blob in stress_test.js

GitOrigin-RevId: be8f29240007ec6ef3f95b10b548f09235181216
2023-11-15 09:03:01 +00:00
Miguel Serrano
80e170967b Merge pull request #15635 from overleaf/jpa-safer-disconnect
[web] make disconnect_all_users script safer

GitOrigin-RevId: 2b17478b27b516ccdf15ade41d81c75176c8a0cd
2023-11-10 09:03:43 +00:00
Brian Gough
d3adcff0f1 Merge pull request #15544 from overleaf/bg-misc-use-literal-paths
Replace APP_ROOT and other variables with literal paths in web imports

GitOrigin-RevId: 138f03ad9355c8c6c92a206b0e54573234a6f65d
2023-11-02 08:53:03 +00:00
Jakob Ackermann
f061a4add4 Merge pull request #15506 from overleaf/jpa-node-18-18-2
[misc] upgrade Node.js from 18.18.0 to 18.18.2

GitOrigin-RevId: 747783fcb9c2a09d79a82268531f612d1ad157be
2023-11-01 09:02:48 +00:00
Alf Eaton
0124712cd2 Restore escaped standalone ampersands in translations (#15373)
GitOrigin-RevId: 8f505ea4906d9adfddfd72b7609c0c3e465f6b56
2023-10-24 08:03:18 +00:00
Eric Mc Sween
680ebae30b Merge pull request #15172 from overleaf/em-promise-utils
Move util/promises from web into a shared library

GitOrigin-RevId: fe1980dc57b9dc8ce86fa1fad6a8a817e9505b3d
2023-10-20 08:04:05 +00:00
M Fahru
e53f3bb158 Merge pull request #15044 from overleaf/mf-send-warning-to-users-with-personal-and-group-subscriptions
Show notification warning to user with both personal and group subscriptions

GitOrigin-RevId: 7f46d7af10389f552175ce26fae9469e0167f95b
2023-10-18 08:05:04 +00:00
Alf Eaton
89944cb254 Merge pull request #15103 from overleaf/ae-postcss-extra
Upgrade postcss in non-workspace packages

GitOrigin-RevId: 58dfa75ddb1d000849e16a44f258a0126b048ad4
2023-10-06 08:04:07 +00:00
Jakob Ackermann
d76c0e2688 Merge pull request #14991 from overleaf/jpa-log-tree
[web] consolidate logTree helper into scripts folder

GitOrigin-RevId: d98a04f1753ba485f835312198f4c79917f7566d
2023-09-28 08:04:17 +00:00
Jakob Ackermann
a2cf7b459c Merge pull request #14902 from overleaf/jpa-node-18-18-0
[misc] upgrade Node.js to latest LTS 18.18.0

GitOrigin-RevId: 96c7171065ceb8797c28efa4ab331d86a84868d2
2023-09-25 08:04:25 +00:00
Brian Gough
601365bcc6 Merge pull request #14610 from overleaf/bg-filter-csv-by-registered-user-domains
add script to filter csv by user email domains

GitOrigin-RevId: d0faf1fd8ace2ec1bde0ffa5b4595e0894952119
2023-09-04 08:05:03 +00:00
Jakob Ackermann
0c767f67c9 Merge pull request #14579 from overleaf/jpa-bench-bcrypt
[web] add script for benchmarking bcrypt performance

GitOrigin-RevId: c87ef9485323630ddb10b3bed2ed64f8f6812541
2023-09-01 08:04:01 +00:00
Alf Eaton
28a7c13887 Fix path to Lezer LaTeX examples (#14364)
GitOrigin-RevId: bcabe1b73f09078367976456e4d1fddc02688b80
2023-08-18 08:05:18 +00:00