Skip to content

feat(grist): open and create grist documents as drive files#3942

Merged
Crash-- merged 1 commit into
masterfrom
feat/grist-drive-files
Jun 22, 2026
Merged

feat(grist): open and create grist documents as drive files#3942
Crash-- merged 1 commit into
masterfrom
feat/grist-drive-files

Conversation

@Crash--

@Crash-- Crash-- commented Jun 21, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Dispatch .grist files (real io.cozy.files with the Grist doc id in metadata.externalId) to the grist coquille, mirroring the Docs integration: computeFileType returns grist, computeApp maps it to the grist slug, computePath builds /bridge/grist/<externalId>.
  • Add a drive.grist.enabled flag-gated "Grist" entry to the create menu, pointing to the coquille's /bridge/grist/new/<folderId> route.
  • Add isGrist helper, the icon-grist.svg asset and the menu_create_grist label.

Summary by CodeRabbit

Release Notes

  • New Features
    • Users can now create new Grist documents directly from the toolbar create menu when the feature is enabled, with controls preventing creation in read-only folders
    • Added comprehensive recognition and routing support for Grist document types throughout the application
    • Extended localization support with English and French translations for all Grist-related menu items and UI elements

Dispatch `.grist` files (a real io.cozy.files carrying the Grist doc id
in `metadata.externalId`) to the `grist` coquille, mirroring the Docs
integration: `computeFileType` returns `grist`, `computeApp` maps it to
the `grist` slug and `computePath` builds `/bridge/grist/<externalId>`.
Add a flag-gated "Grist" entry to the create menu that points to the
coquille's `/bridge/grist/new/<folderId>` route. Behind the
`drive.grist.enabled` flag.
@coderabbitai

coderabbitai Bot commented Jun 21, 2026

Copy link
Copy Markdown

Review Change Stack

Walkthrough

A new CreateGristItem toolbar component is introduced that builds a Grist document creation URL using generateWebLink and redirects the browser, or shows a read-only warning when the folder is not writable. The component is conditionally rendered inside CreateDocumentItems when !isPublic and the drive.grist.enabled feature flag is active. A new src/modules/grist/helpers.js module exports GRIST_EXTENSION and the isGrist predicate. Navigation helpers are extended so computeFileType, computeApp, and computePath recognize Grist files and route them to /bridge/grist/:externalId. Locale strings for menu_create_grist are added in English and French.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately and concisely summarizes the main change: adding Grist document integration for opening and creating Grist files in Twake Drive.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/grist-drive-files

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@codescene-delta-analysis codescene-delta-analysis Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Our agent can fix these. Install it.

Gates Passed
3 Quality Gates Passed

Quality Gate Profile: The Bare Minimum
Install CodeScene MCP: safeguard and uplift AI-generated code. Catch issues early with our IDE extension and CLI tool.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/modules/navigation/hooks/helpers.ts`:
- Around line 201-202: In the 'grist' case within the switch statement, the
externalId from the file metadata is being directly interpolated into the bridge
path without proper URL encoding. Fix this by wrapping the metadata.externalId
access with encodeURIComponent to ensure reserved or special characters are
properly escaped before being inserted into the path string in the return
statement.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: dc8ea3b4-c5c8-43e8-ab18-8477283ece02

📥 Commits

Reviewing files that changed from the base of the PR and between bb252b9 and 42f9f26.

⛔ Files ignored due to path filters (1)
  • src/assets/icons/icon-grist.svg is excluded by !**/*.svg
📒 Files selected for processing (6)
  • src/locales/en.json
  • src/locales/fr.json
  • src/modules/drive/Toolbar/components/CreateDocumentItems.jsx
  • src/modules/drive/Toolbar/components/CreateGristItem.jsx
  • src/modules/grist/helpers.js
  • src/modules/navigation/hooks/helpers.ts

Comment on lines +201 to +202
case 'grist':
return `/bridge/grist/${(file as IOCozyFile).metadata.externalId}`

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Encode externalId before inserting it into the bridge path.

Line 202 interpolates raw metadata.externalId; reserved characters can break routing. Use encodeURIComponent here.

Suggested patch
     case 'grist':
-      return `/bridge/grist/${(file as IOCozyFile).metadata.externalId}`
+      return `/bridge/grist/${encodeURIComponent(
+        (file as IOCozyFile).metadata.externalId
+      )}`
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
case 'grist':
return `/bridge/grist/${(file as IOCozyFile).metadata.externalId}`
case 'grist':
return `/bridge/grist/${encodeURIComponent(
(file as IOCozyFile).metadata.externalId
)}`
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/modules/navigation/hooks/helpers.ts` around lines 201 - 202, In the
'grist' case within the switch statement, the externalId from the file metadata
is being directly interpolated into the bridge path without proper URL encoding.
Fix this by wrapping the metadata.externalId access with encodeURIComponent to
ensure reserved or special characters are properly escaped before being inserted
into the path string in the return statement.

@bundlemon

bundlemon Bot commented Jun 21, 2026

Copy link
Copy Markdown

BundleMon

Unchanged files (20)
Status Path Size Limits
static/js/cozy.(hash).js
928.17KB -
static/resource/(hash).js
336.09KB -
services/qualificationMigration.js
283.39KB -
services/dacc.js
263.13KB -
static/js/main.(hash).js
48.27KB -
static/js/lib-react.(hash).js
43.88KB -
static/css/cozy.(hash).css
30.13KB -
static/js/lib-polyfill.(hash).js
22.77KB -
static/js/lib-router.(hash).js
21.86KB -
static/js/public.(hash).js
19.79KB -
static/css/main.(hash).css
13.57KB -
static/js/intents.(hash).js
9.2KB -
static/js/(chunkId).(hash).js
8.6KB -
manifest.webapp
3.09KB -
static/css/public.(hash).css
2.34KB -
static/js/async/(chunkId).(hash).js
2.06KB -
index.html
770B -
public/index.html
702B -
intents/index.html
644B -
assets/manifest.json
185B -

Total files change -5B 0%

Groups updated (1)
Status Path Size Limits
**/*.js
5.98MB (+302B 0%) -
Unchanged groups (2)
Status Path Size Limits
**/*.{png,svg,ico}
2.16MB -
**/*.css
77.42KB -

Final result: ✅

View report in BundleMon website ➡️


Current branch size history | Target branch size history

@Crash-- Crash-- merged commit 4d8bbda into master Jun 22, 2026
6 checks passed
@Crash-- Crash-- deleted the feat/grist-drive-files branch June 22, 2026 07:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants