Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(core): add permissions limitation to document actions in releases #8603

Merged
merged 5 commits into from
Feb 12, 2025

Conversation

RitaDias
Copy link
Contributor

@RitaDias RitaDias commented Feb 12, 2025

Description

  • Add disable action when user doesn't have permission to discard version in document action and in the release detail table
  • Add disable action when user doesn't have permission to unpublish document in the release detail table
  • Update document action to new action
  • Permissions there now use the versions
  • Updated tooltip text for different conditions on the unpublish action
Screen.Recording.2025-02-12.at.09.45.20.mov

What to review

Does everything look alright?

Testing

Didn't add tests to the menu actions since the larger changes happened directly in the permission aspect of things
To manually test you should use a user that doesn't have permissions (viewer), the debug roles don't work consistently.

Notes for release

Document actions (discard version and unpublish) in a release now respect permissions

Copy link

vercel bot commented Feb 12, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
page-building-studio ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 12, 2025 0:54am
performance-studio ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 12, 2025 0:54am
test-studio ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 12, 2025 0:54am
2 Skipped Deployments
Name Status Preview Comments Updated (UTC)
studio-workshop ⬜️ Ignored (Inspect) Visit Preview Feb 12, 2025 0:54am
test-next-studio ⬜️ Ignored (Inspect) Feb 12, 2025 0:54am

Copy link
Contributor

No changes to documentation

Copy link
Contributor

github-actions bot commented Feb 12, 2025

Coverage Report

Status Category Percentage Covered / Total
🔵 Lines 42.58% 53945 / 126664
🔵 Statements 42.58% 53945 / 126664
🔵 Functions 48.04% 2778 / 5782
🔵 Branches 78.82% 10356 / 13138
File Coverage
File Stmts Branches Functions Lines Uncovered Lines
Changed Files
packages/sanity/src/core/releases/i18n/resources.ts 100% 100% 100% 100%
packages/sanity/src/core/releases/plugin/documentActions/DiscardVersionAction.tsx 16.32% 100% 0% 16.32% 18-67
packages/sanity/src/core/releases/tool/detail/documentTable/DocumentActions.tsx 93.1% 92.85% 40% 93.1% 57, 60, 113-116
packages/sanity/src/core/store/_legacy/grants/documentPairPermissions.ts 70.58% 52.77% 100% 70.58% 26-27, 65-75, 78-81, 90-106, 128-140, 143-158, 161-162, 213-214, 258-261
Generated in workflow #30252 for commit e23427c by the Vitest Coverage Report Action

Copy link
Contributor

github-actions bot commented Feb 12, 2025

⚡️ Editor Performance Report

Updated Wed, 12 Feb 2025 13:00:04 GMT

Benchmark reference
latency of sanity@latest
experiment
latency of this branch
Δ (%)
latency difference
article (title) 25.6 efps (39ms) 27.0 efps (37ms) -2ms (-5.1%)
article (body) 72.7 efps (14ms) 72.5 efps (14ms) +0ms (-/-%)
article (string inside object) 27.8 efps (36ms) 27.0 efps (37ms) +1ms (+2.8%)
article (string inside array) 23.8 efps (42ms) 23.8 efps (42ms) +0ms (-/-%)
recipe (name) 51.3 efps (20ms) 51.3 efps (20ms) +0ms (-/-%)
recipe (description) 58.8 efps (17ms) 58.8 efps (17ms) +0ms (-/-%)
recipe (instructions) 99.9+ efps (5ms) 99.9+ efps (5ms) +0ms (-/-%)
synthetic (title) 21.1 efps (48ms) 20.4 efps (49ms) +2ms (+3.2%)
synthetic (string inside object) 20.4 efps (49ms) 20.8 efps (48ms) -1ms (-2.0%)

efps — editor "frames per second". The number of updates assumed to be possible within a second.

Derived from input latency. efps = 1000 / input_latency

Detailed information

🏠 Reference result

The performance result of sanity@latest

Benchmark latency p75 p90 p99 blocking time test duration
article (title) 39ms 41ms 46ms 104ms 69ms 11.4s
article (body) 14ms 16ms 18ms 114ms 88ms 5.1s
article (string inside object) 36ms 38ms 45ms 157ms 126ms 6.4s
article (string inside array) 42ms 45ms 51ms 153ms 332ms 7.3s
recipe (name) 20ms 21ms 24ms 48ms 4ms 7.2s
recipe (description) 17ms 18ms 20ms 30ms 0ms 4.5s
recipe (instructions) 5ms 7ms 8ms 9ms 0ms 3.1s
synthetic (title) 48ms 54ms 58ms 495ms 917ms 12.8s
synthetic (string inside object) 49ms 52ms 65ms 456ms 907ms 8.5s

🧪 Experiment result

The performance result of this branch

Benchmark latency p75 p90 p99 blocking time test duration
article (title) 37ms 40ms 42ms 307ms 11ms 10.0s
article (body) 14ms 16ms 20ms 161ms 199ms 5.2s
article (string inside object) 37ms 40ms 45ms 171ms 349ms 7.1s
article (string inside array) 42ms 44ms 47ms 74ms 245ms 6.8s
recipe (name) 20ms 21ms 24ms 34ms 0ms 7.3s
recipe (description) 17ms 18ms 19ms 20ms 0ms 4.4s
recipe (instructions) 5ms 6ms 7ms 19ms 0ms 3.1s
synthetic (title) 49ms 51ms 54ms 68ms 267ms 12.1s
synthetic (string inside object) 48ms 49ms 50ms 54ms 210ms 7.1s

📚 Glossary

column definitions

  • benchmark — the name of the test, e.g. "article", followed by the label of the field being measured, e.g. "(title)".
  • latency — the time between when a key was pressed and when it was rendered. derived from a set of samples. the median (p50) is shown to show the most common latency.
  • p75 — the 75th percentile of the input latency in the test run. 75% of the sampled inputs in this benchmark were processed faster than this value. this provides insight into the upper range of typical performance.
  • p90 — the 90th percentile of the input latency in the test run. 90% of the sampled inputs were faster than this. this metric helps identify slower interactions that occurred less frequently during the benchmark.
  • p99 — the 99th percentile of the input latency in the test run. only 1% of sampled inputs were slower than this. this represents the worst-case scenarios encountered during the benchmark, useful for identifying potential performance outliers.
  • blocking time — the total time during which the main thread was blocked, preventing user input and UI updates. this metric helps identify performance bottlenecks that may cause the interface to feel unresponsive.
  • test duration — how long the test run took to complete.

Copy link
Contributor

github-actions bot commented Feb 12, 2025

Component Testing Report Updated Feb 12, 2025 1:02 PM (UTC)

❌ Failed Tests (3) -- expand for details
File Status Duration Passed Skipped Failed
comments/CommentInput.spec.tsx ✅ Passed (Inspect) 1m 10s 15 0 0
formBuilder/ArrayInput.spec.tsx ✅ Passed (Inspect) 12s 3 0 0
formBuilder/inputs/PortableText/Annotations.spec.tsx ❌ Failed (Inspect) 2m 35s 3 0 3
formBuilder/inputs/PortableText/copyPaste/CopyPaste.spec.tsx ✅ Passed (Inspect) 53s 11 7 0
formBuilder/inputs/PortableText/copyPaste/CopyPasteFields.spec.tsx ✅ Passed (Inspect) 0s 0 12 0
formBuilder/inputs/PortableText/Decorators.spec.tsx ✅ Passed (Inspect) 26s 6 0 0
formBuilder/inputs/PortableText/DisableFocusAndUnset.spec.tsx ✅ Passed (Inspect) 15s 3 0 0
formBuilder/inputs/PortableText/DragAndDrop.spec.tsx ✅ Passed (Inspect) 27s 6 0 0
formBuilder/inputs/PortableText/FocusTracking.spec.tsx ✅ Passed (Inspect) 1m 8s 15 0 0
formBuilder/inputs/PortableText/Input.spec.tsx ✅ Passed (Inspect) 1m 35s 21 0 0
formBuilder/inputs/PortableText/ObjectBlock.spec.tsx ✅ Passed (Inspect) 2m 4s 21 0 0
formBuilder/inputs/PortableText/PresenceCursors.spec.tsx ✅ Passed (Inspect) 13s 3 9 0
formBuilder/inputs/PortableText/Styles.spec.tsx ✅ Passed (Inspect) 27s 6 0 0
formBuilder/inputs/PortableText/Toolbar.spec.tsx ✅ Passed (Inspect) 1m 46s 21 0 0
formBuilder/tree-editing/TreeEditing.spec.tsx ✅ Passed (Inspect) 0s 0 3 0
formBuilder/tree-editing/TreeEditingNestedObjects.spec.tsx ✅ Passed (Inspect) 0s 0 3 0

@RitaDias RitaDias marked this pull request as ready for review February 12, 2025 09:29
@RitaDias RitaDias requested review from a team as code owners February 12, 2025 09:29
@RitaDias RitaDias requested a review from bjoerge February 12, 2025 09:29
Copy link
Member

@bjoerge bjoerge left a comment

Choose a reason for hiding this comment

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

Great work, thank you @RitaDias!

@RitaDias RitaDias enabled auto-merge (squash) February 12, 2025 13:49
@stipsan stipsan disabled auto-merge February 12, 2025 13:57
@stipsan stipsan merged commit 2706f6f into next Feb 12, 2025
62 checks passed
@stipsan stipsan deleted the sapp-2366 branch February 12, 2025 14:01
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.

3 participants