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

Prevent edits and deletions for row action automations #14218

Merged
merged 11 commits into from
Jul 23, 2024

Conversation

adrinr
Copy link
Collaborator

@adrinr adrinr commented Jul 23, 2024

Description

Prevent deleting and editing row actions via the frontend (and via the API)

Addresses

Screenshots

image image image

@adrinr adrinr requested a review from a team as a code owner July 23, 2024 08:54
@adrinr adrinr requested review from samwho and removed request for a team July 23, 2024 08:54
Copy link

linear bot commented Jul 23, 2024

@adrinr adrinr changed the title Prevent edits and deletions Prevent edits and deletions for row action automations Jul 23, 2024
@github-actions github-actions bot added firestorm Data/Infra/Revenue Team size/m labels Jul 23, 2024
@adrinr adrinr requested a review from mike12345567 July 23, 2024 08:54
const result = []
if (!isRowAction) {
result.push(
...[
Copy link
Collaborator

Choose a reason for hiding this comment

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

How come this spread is needed? Could you not ditch the array entirely and pass the objects in bare?

Copy link
Collaborator Author

@adrinr adrinr Jul 23, 2024

Choose a reason for hiding this comment

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

Yes, that would be the same that 3 separate .push(object).

if (
automation.definition.trigger.stepId === AutomationTriggerStepId.ROW_ACTION
) {
ctx.throw("Row actions cannot be deleted", 403)
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: https://www.rfc-editor.org/rfc/rfc9110#status.403 suggests the 403 status is to do with authorisation, I suspect 400 is slightly more accurate here because you're attempting to do something that's invalid regardless of who you are.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I changed this 100 times and I did quite a lot of read. I agree that is not a 403, but, at the same time, it's not a 400. The request is not "bad" in terms of format.

I will change it again to be a 400, as 403 might have more implications and anyways this is something that should never be called

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Changed to 422, as it seems a good use case for it

packages/server/src/sdk/app/automations/crud.ts Outdated Show resolved Hide resolved
@adrinr adrinr merged commit 421e42d into feat/row-actions Jul 23, 2024
11 checks passed
@adrinr adrinr deleted the BUDI-8430/prevent-edits-and-deletions branch July 23, 2024 10:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
firestorm Data/Infra/Revenue Team size/m
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants