Closed spbdimka closed 1 year ago
I think, that it's an error in your code. You shouldn't cut off yourself. If it's necessary, from whatever reason, you should detect yourself this case and redirect it as follows:
redirect_to: issues_path
I think, that it's an error in your code. You shouldn't cut off yourself. If it's necessary, from whatever reason, you should detect yourself this case and redirect it as follows:
redirect_to: issues_path
Processing by CustomWorkflowsController#create as HTML Parameters: {"utf8"=>"✓", "authenticity_token"=>"sdfVhurcQtfg==", "custom_workflow"=>{"name"=>"redirz", "author"=>"", "observable"=>"issue", "description"=>"", "is_for_all"=>"0", "active"=>"1", "project_ids"=>["3", ""], "before_save"=>"", "after_save"=>"redirect_to: projects_path", "before_destroy"=>"", "after_destroy"=>""}, "commit"=>"Создать"} Current user: admin (id=1) = Running shared code for Issue (#) " #: " = Finished running shared code for Issue (#) " #: " Completed 500 Internal Server Error in 32ms (ActiveRecord: 3.9ms)
SyntaxError ((eval):1: syntax error, unexpected ':', expecting end-of-input redirect_to: issues_path ^):
plugins/redmine_custom_workflows/app/models/custom_workflow.rb:111:in
instance_eval' plugins/redmine_custom_workflows/app/models/custom_workflow.rb:111:in
validate_syntax_for' plugins/redmine_custom_workflows/app/models/custom_workflow.rb:142:inblock in validate_syntax' plugins/redmine_custom_workflows/app/models/custom_workflow.rb:142:in
each' plugins/redmine_custom_workflows/app/models/custom_workflow.rb:142:invalidate_syntax' plugins/redmine_custom_workflows/app/controllers/custom_workflows_controller.rb:106:in
block in create' plugins/redmine_custom_workflows/app/controllers/custom_workflows_controller.rb:105:increate' lib/redmine/sudo_mode.rb:65:in
sudo_mode' plugins/redmine_dmsf/lib/redmine_dmsf/webdav/custom_middleware.rb:60:in `call'
redirect_to issues_path
redirect_to issues_path
so i got undefined variable issues_path after defining it, i got undefined method redirect_to
redmine 4.1.1, i put clean code in after_save callback
Hm, you're right. My advice was completely wrong. You can't use a redirection in a model. How about the following approach?
unless @issue.visible?
raise WorkflowError.new("You've lost access to the issue")
end
@picman Yes, it is possible, but it is more of a temporary kludge Is it possible to write an internal function for workflows to implement redirects?
I don't think so. The plugin works with models only.
Hi. It happens that I change in the workflow, for example, the assigned user and after saving the issue, the current user does not have enough rights. The user sees a 403 error. Is there any way to redress it, for example, on / issues?