Fix: Workflow#save passes I18n key as string literal instead of calling I18n.t#5489
Open
ddri wants to merge 1 commit into
Open
Fix: Workflow#save passes I18n key as string literal instead of calling I18n.t#5489ddri wants to merge 1 commit into
ddri wants to merge 1 commit into
Conversation
johrstrom
requested changes
May 27, 2026
Contributor
johrstrom
left a comment
There was a problem hiding this comment.
This appears to have commits/changes from a different branch in them.
…ranslated message errors.add(:save, "I18n.t(...)") passes the method call as a string literal. Calling I18n.t directly returns the translated string. Also fix two pre-existing assertions that were silently passing regardless of error state: assert workflow.errors.inspect → assert_empty workflow.errors
54ab4dc to
54598a2
Compare
Contributor
Author
|
Thanks for catching that — the app_helper changes belonged in a separate PR and got mixed in by mistake. Rebased onto current master, diff now only contains the workflow.rb and workflow_test.rb changes. |
Bubballoo3
approved these changes
May 28, 2026
Contributor
Bubballoo3
left a comment
There was a problem hiding this comment.
This looks good to me!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The
Workflow#saveguards against a nilproject_dirby adding an error and returning early.The error message was passed as a string literal containing the I18n method call rather
than invoking it:
The
WorkflowsControlleralways providesproject_dirviapermit_params, so this guardonly fires outside the normal controller flow, for direct model instantiation, rails console,
or API usage without a project context. In those cases the error bubbles up through
handle_workflow_error→collect_errors, producing the flash message:instead of the translated string "Project directory path is not set for this workflow".
Changes
app/models/workflow.rb— callI18n.tinstead of quoting it as a stringtest/models/workflow_test.rbsavewithoutproject_dirreturns the translated error messageassert workflow.errors.inspect→assert_empty workflow.errors