Commit Graph

1562 Commits

Author SHA1 Message Date
Florent
243369513f
Don't throttle /api/docs/{docId}/force-reload #1107 (#1197)
When a document has too many requests, one may want to force a document to be reopened. However, the /force-reload endpoint may raise a 429 (TOO_MANY_REQUESTS) error, because it uses the throttled middleware.
2024-09-05 16:36:05 -04:00
Florent
16ebc32611
Add tests for UsersManager (#1149)
Context

HomeDBManager lacks of direct tests, which makes hard to make rework or refactorations.
Proposed solution

Specifically here, I introduce tests which call exposed UsersManager methods directly and check their result.

Also:

    I removed updateUserName which seems to me useless (updateUser does the same work)
    Taking a look at the getUserByLogin methods, it appears that Typescirpt infers it returns a Promise<User|null> while in no case it may resolve a nullish value, therefore I have forced to return a Promise<User> and have changed the call sites to reflect the change.

Related issues

I make this change for then working on #870
2024-09-05 16:30:04 -04:00
Vincent Viers
f0d0b9120b
Fix: formula assistant translations (#1192)
These strings are translated under the `FormulaAssistant.*` keys in weblate
2024-09-04 11:11:22 -04:00
Florent
b1a9e5f0da
OIDC: allow configuring the request timeout (#1177)
Add IdP timeout, controlled by env var GRIST_OIDC_SP_HTTP_TIMEOUT

---------

Co-authored-by: atropos <sv7n@pm.me>
2024-09-03 17:10:18 -04:00
George Gevoian
437aaac6d2
Pin browser tests to Chrome 127 (#1187) 2024-09-03 11:36:49 -04:00
Paul Fitzpatrick
994c8d3faa (core) updates from grist-core 2024-09-03 10:01:20 -04:00
George Gevoian
5e4140fcae (core) Support bare links in Markdown cells
Summary:
Also tweaks the bottom margin of a few Markdown
element types when they are the last element in a
cell, and fixes an alignment issue with list items
containing paragraphs.

Test Plan: Browser and manual tests.

Reviewers: jarek

Reviewed By: jarek

Subscribers: jarek

Differential Revision: https://phab.getgrist.com/D4334
2024-09-03 02:23:57 -04:00
Jordi Gutiérrez Hermoso
80f8168cab (core) DocLimits: display days remaining instead of days of grace period
Summary:
Before this change we would always say there are 14 days remaining,
regardless of how many actually are remaining. Let's pass around a
different `dataLimitsInfo` object that also reports the number of days
remaining.

Test Plan: Ensure the test suite passes.

Reviewers: georgegevoian

Reviewed By: georgegevoian

Differential Revision: https://phab.getgrist.com/D4332
2024-08-29 22:51:49 -04:00
Dmitry S
8da89b0a3d (core) Improve behavior to update current time, to allow inactive docs to shut down, and reduce spurious errors.
Summary:
- When sandbox is down, report failing UpdateCurrentTime calls as warnings instead of errors.
- When applying system actions (such as updating current time), don't treat
  them as user activity for the purpose of keeping the doc open.

Test Plan: Added a test case for the fixed behavior.

Reviewers: georgegevoian

Reviewed By: georgegevoian

Differential Revision: https://phab.getgrist.com/D4324
2024-08-29 01:22:57 -04:00
Florent
76fcfd733e
Small: Log requests body (#913)
Add body in log requests.

GRIST_LOG_SKIP_HTTP is a badly named environment variable and its
expected values are confusing (to log the requests, you actually have to
set its value to "", and setting to "false" actually is equivalent to
setting to "true").

We deprecate this env variable in favor of GRIST_LOG_HTTP which is more
convenient and understandable:
 - by default, its undefined, so nothing is logged;
 - to enable the logs, you just have to set GRIST_LOG_HTTP=true

Also this commit removes the default value for GRIST_LOG_SKIP_HTTP,
because we don't have to set it to "true" to actually disable the
requests logging thanks to GRIST_LOG_HTTP. FlexServer now handles
the historical behavior for this deprecated variable.

---------

Co-authored-by: Jonathan Perret <j-github@jonathanperret.net>
2024-08-27 06:38:35 -04:00
George Gevoian
292c894b93 (core) Add Markdown cell format
Summary:
Text columns can now display their values as Markdown-formatted text
by changing their cell format to "Markdown". A minimal subset of the
Markdown specification is currently supported.

Test Plan: Browser tests.

Reviewers: Spoffy, dsagal

Reviewed By: Spoffy, dsagal

Subscribers: dsagal, Spoffy

Differential Revision: https://phab.getgrist.com/D4326
2024-08-23 11:24:35 -04:00
George Gevoian
5c486e686e (core) Refactor disabled summary button logic
Summary:
A project test began failing because of an incompatibility with pointer-events
being disabled. This gets us back to green.

Test Plan: Existing tests.

Reviewers: jordigh

Reviewed By: jordigh

Subscribers: jordigh

Differential Revision: https://phab.getgrist.com/D4325
2024-08-19 22:59:21 -04:00
Jordi Gutiérrez Hermoso
54502280de (core) AdminPanel: hide the enterprise toggle in core and grist-ee images
Summary:
In the pure OSS `grist-oss` image, the `ActivationPage` module from
stubs is used, as the `ext` code is completely missing. We can easily
just always return `false` here.

In the case when the `ext` directory exists, this may mean we're in
the standard `grist` image or the `grist-ee` image. The latter is
distinguished by having `GRIST_FORCE_ENABLE_ENTERPRISE` so we check if
that's on, and hide the toggle accordingly if so.

Test Plan:
Use these changes to build the three Docker images
(`grist-oss`, `grist`, and `grist-ee`) and verify that only `grist`
shows the toggle.

Reviewers: jarek

Reviewed By: jarek

Subscribers: jarek

Differential Revision: https://phab.getgrist.com/D4321
2024-08-19 15:51:24 -04:00
Paul Fitzpatrick
0a78cdbaab (core) updates from grist-core 2024-08-19 07:01:01 -04:00
Dmitry S
ef4180c8da (core) Fix unhandledRejection caused by exception from verifyClient.
Summary:
This includes two fixes: one to ensure that any exception from websocket
upgrade handlers are handled (by destroying the socket). A test case is
added for this.

The other is to ensure verifyClient returns false instead of failing; this
should lead to a better error to the client (Forbidden, rather than just socket
close). This is only tested manually with a curl request.

Test Plan: Added a test case for the more sensitive half of the fix.

Reviewers: georgegevoian

Reviewed By: georgegevoian

Subscribers: georgegevoian

Differential Revision: https://phab.getgrist.com/D4323
2024-08-15 17:32:44 -04:00
George Gevoian
e70c294e3d (core) Add custom widget gallery
Summary:
Custom widgets are now shown in a gallery.

The gallery is automatically opened when a new custom widget is
added to a page.

Descriptions, authors, and update times are pulled from the widget
manifest.

Test Plan: Browser tests.

Reviewers: jarek

Reviewed By: jarek

Subscribers: dsagal

Differential Revision: https://phab.getgrist.com/D4309
2024-08-14 16:48:36 -04:00
Jordi Gutiérrez Hermoso
a16d76d25d (core) config: rename TEST_ENABLE_ACTIVATION to GRIST_FORCE_ENABLE_ENTERPRISE
Summary:
The name of this env var has bothered me for a little while.
Let's rename it more meaningfully.

Test Plan: No need to test, cosmetic change only.

Reviewers: jarek

Reviewed By: jarek

Differential Revision: https://phab.getgrist.com/D4320
2024-08-14 14:33:06 -04:00
Jarosław Sadziński
9509b2edcb (core) Hiding censored pages and all their leaves
Summary:
Page is now hidden when any of its ancestor (or the page itself)
is censored.

Test Plan: Updated

Reviewers: georgegevoian

Reviewed By: georgegevoian

Differential Revision: https://phab.getgrist.com/D4319
2024-08-14 19:48:17 +02:00
Grégoire Cutzach
93ed1bec5e
feat: forms inhibited when summary selected and vice versa (#1037) 2024-08-14 10:59:06 -04:00
Dmitry S
fbc0418118 (core) Fix CustomView taking up more height than page layout gives it.
Summary:
Each view type currently responsible for fitting appropriately within the box
it's given (e.g. deciding which container is scrollable). CustomView wasn't
doing a good job of it, particularly when showing "columns aren't mapped"
message.

Test Plan:
Only CSS affected. Checked manually on FF, Chrome, Safari that CustomViews take
the right amount of space, and scroll well, in 3 situations: not-mapped,
not-configured, and a functional widget.

Reviewers: jarek

Reviewed By: jarek

Subscribers: jarek

Differential Revision: https://phab.getgrist.com/D4316
2024-08-13 12:34:28 -04:00
Dmitry S
5ef54b278f (core) When getting error details for on-demand formulas, provide an explanation
Summary:
Since formula errors are typically obtained from the Python data engine, they
were not returning any info for errors in on-demand tables (not loaded into the
data engine). This change implements a detailed message to explain such errors,
mainly to point out that on-demand table is the reason.

Test Plan: Added a check to the OnDemand test that formula error details are shown.

Reviewers: jarek

Reviewed By: jarek

Differential Revision: https://phab.getgrist.com/D4317
2024-08-13 12:34:08 -04:00
Dmitry S
69aabd1ae0 (core) Limit related videos when playing onboarding video tour from home page
Summary:
When video is opened from the app homepage, it opens in a popup, which stays
open when it ends. The rel=0 parameter limits the related videos shown at the
end to those from the same channel, avoiding surprising unrelated videos.

This doesn't affect the video shown during initial onboarding, since that once
auto-closes when it ends.

Test Plan: Tested manually

Reviewers: georgegevoian

Reviewed By: georgegevoian

Differential Revision: https://phab.getgrist.com/D4313
2024-08-09 19:24:09 -04:00
Paul Fitzpatrick
9b8d0c9fac (core) updates from grist-core 2024-08-09 17:56:34 -04:00
Dmitry S
4ed90faf79 (core) Fix more tests: bundleSize and Embed
Summary:
1. Unclear why Embed fails often. Locally, it fails for me every time, and
   this tweak makes it pass (while still keeping the test useful).
2. Reduced back main bundle's size by removing dependency of some common
   elements on the full AdminPanel. Updated expected size of errorPages
   bundle to the new reduced size.

Test Plan: No changes to functionality; relying on existing tests to verify that.

Reviewers: jordigh

Reviewed By: jordigh

Subscribers: georgegevoian, jordigh

Differential Revision: https://phab.getgrist.com/D4315
2024-08-09 16:08:31 -04:00
Florent
fde6c8142d
Support nonce and acr with OIDC + other improvements and tests (#883)
* Introduces new configuration variables for OIDC:
  - GRIST_OIDC_IDP_ENABLED_PROTECTIONS
  - GRIST_OIDC_IDP_ACR_VALUES
  - GRIST_OIDC_IDP_EXTRA_CLIENT_METADATA
* Implements all supported protections in oidc/Protections.ts
* Includes a better error page for failed OIDC logins
* Includes some other improvements, e.g. to logging, to OIDC
* Adds a large unit test for OIDCConfig
* Adds support for SERVER_NODE_OPTIONS for running tests
* Adds to documentation/develop.md info about GREP_TESTS, VERBOSE, and SERVER_NODE_OPTIONS.
2024-08-08 15:35:37 -04:00
Paul Fitzpatrick
773588f795 (core) updates from grist-core 2024-08-07 14:06:59 -04:00
Jordi Gutiérrez Hermoso
ba7b72b39a Activations: add an enabled_at column
For #1140, I considered trying to use the existing fields in a better
way, but because we already use the activations table to store
preferences, we need to keep all of the existing data and its usage
as-is.

The enterprise code will use this new column to decide how long the
trial period should be.
2024-08-06 15:06:36 -04:00
Jordi Gutiérrez Hermoso
952544432e UserManager: show proper org domain (#476)
We had `getgrist.com` hardcoded here, which only works for SaaS. The
base domain as well as the way that orgs are encoded in the URL can be
different in other circumstances.

If we are encoding orgs in the domain name, that's easy. We just do
`orgname.base.domain.name`. If we are not, then we first try a base
domain, and if that isn't set, we'll use the domain of the home
server.
2024-08-06 14:39:43 -04:00
George Gevoian
1ce26ea6f5 (core) Fix typo in tutorial card
Test Plan: N/A

Reviewers: jarek

Reviewed By: jarek

Differential Revision: https://phab.getgrist.com/D4308
2024-08-06 09:53:49 -04:00
Jordi Gutiérrez Hermoso
4bfcbf20ac markdown: document this function 2024-08-05 13:21:09 -04:00
Jordi Gutiérrez Hermoso
1b6a80335f AdminPanel: add the toggle for enterprise
Final ingredient. This surfaces the work in creating the backend
config API, the frontend model, the grainjs observable, and the
grainjs DOM and CSS components.
2024-07-30 13:41:47 -04:00
Jordi Gutiérrez Hermoso
ffe3b22378 ToggleEnterpriseWidget: new frontend toggle for the admin
Strongly patterned after SupportGristPage. In fact, it has almost the
same structure.

Perhaps one day it would be possible to synchronise the logic between
the two toggles even further, but I couldn't see a simple way to do so
now. For now, some code structure duplication seemed easiest in lieau
of more abstractions.
2024-07-30 13:41:47 -04:00
Jordi Gutiérrez Hermoso
0bf3f9bc43 markdown: new utility module
Since we've started using Markdown, why not a simple utility function
to start using it?
2024-07-30 13:41:47 -04:00
Jordi Gutiérrez Hermoso
4621b67c8e AdminToggleCss: factor out CSS from SupportGristPage
We will create a new enterprise toggle, so we will need to share the same CSS.
2024-07-30 13:41:47 -04:00
Jordi Gutiérrez Hermoso
f0cf86be8e ToggleEnterpriseModel: new GrainJS model to handle changes to config API
Patterned after TelemetryModel.ts
2024-07-30 13:41:47 -04:00
Jordi Gutiérrez Hermoso
62a04e9510 ConfigAPI: new class to handle frontend requests to config backend
This new API is somewhat patterned after the InstallAPI, but simpler
whenever possible.
2024-07-30 13:41:47 -04:00
Jordi Gutiérrez Hermoso
960f023618 restart: gracefully handle restart failure
In case Grist isn't running with the supervisor (e.g. it's running
under nodemon instead via `yarn start`), surface the problem to the
frontend.
2024-07-30 13:41:47 -04:00
Jordi Gutiérrez Hermoso
bc8e5f6837 FlexServer: remove config from restart endpoint
The config endpoint now handles changing config values, so we only
need to handle restarts here.
2024-07-30 13:41:47 -04:00
Jordi Gutiérrez Hermoso
2d85ed1bfe config: new API endpoint
This adds PATCH and GET endpoints to handle `config.json`.
2024-07-30 13:41:47 -04:00
Jordi Gutiérrez Hermoso
d57c3f068d configCore: default to enterprise edition if TEST_ENABLE_ACTIVATION is truthy
This will ensure that the grist-ee image will have a consistent config
setting when created from the default value.
2024-07-30 13:41:47 -04:00
Jordi Gutiérrez Hermoso
f0aacc4d96 config: end the file with a newline
Small cosmetic change, POSIX requires final newlines in text files.

https://stackoverflow.com/questions/729692/why-should-text-files-end-with-a-newline
2024-07-30 13:41:47 -04:00
Paul Fitzpatrick
5dbdb5c06c (core) updates from grist-core 2024-07-29 17:20:32 -04:00
Dmitry S
bb0213ecbe (core) Fix regression that caused Date/DateTime series to be treated as categorical data
Test Plan: Tested manually with a Date and DateTime column type.

Reviewers: paulfitz

Reviewed By: paulfitz

Subscribers: paulfitz

Differential Revision: https://phab.getgrist.com/D4305
2024-07-29 12:52:57 -07:00
Jordi Gutiérrez Hermoso
fea7c0b536 create: add a comment explaining the session secret situation 2024-07-28 18:52:39 -04:00
Jordi Gutiérrez Hermoso
09871480ba create: add a short docstring for makeSimpleCreator 2024-07-28 18:52:39 -04:00
Jordi Gutiérrez Hermoso
9b3ae08ece create: hard-code the default session secret even more
The problem here is that making it this optional meant that it wasn't
supplied by [the enterprise creation
function](fb22d94878/ext/app/server/lib/create.ts (L10)).
This resulted in an odd situation where the secret was required for
the enterprise edition, even though it offers no additional security.
Without this key, the enterprise code crashes.

The requirement to supply a secret key would make a Grist instance
crash if you start in normal mode but switch to enterprise, as the
enterprise creator does not supply a default secret key.
2024-07-28 18:52:39 -04:00
Jordi Gutiérrez Hermoso
c9f9b70b67 apiconsole: allow uploads in console
By adding an XHR to "Try it out" requests, we can make non-JSON
requests pass a CORS check.
2024-07-26 09:09:11 -04:00
Jarosław Sadziński
61942f6f4b (core) Adding confirmation before remove last widget for a table
Summary:
When last widget for a table is removed, user is informed
about that and can decide between removing the widget and removing
both table and widget

Test Plan: Updated

Reviewers: georgegevoian

Reviewed By: georgegevoian

Differential Revision: https://phab.getgrist.com/D4295
2024-07-25 16:42:19 +02:00
Paul Fitzpatrick
fc3a7f580c
make access control for ConvertFromColumn action less brutal (#1111)
Access control for ConvertFromColumn in the presence of access rules had previously been left as a TODO. This change allows the action when the user has schema rights. Because schema rights let you create formulas, they let you read anything, so there is currently no value in nuance here.
2024-07-24 11:41:50 -04:00
George Gevoian
4740f1f933 (core) Update onboarding flow
Summary:
A new onboarding page is now shown to all new users visiting the doc
menu for the first time. Tutorial cards on the doc menu have been
replaced with a new version that tracks completion progress, alongside
a new card that opens the orientation video.

Test Plan: Browser tests.

Reviewers: jarek

Reviewed By: jarek

Differential Revision: https://phab.getgrist.com/D4296
2024-07-23 11:49:23 -04:00