Skip to content

Commit

Permalink
FIX: value of 'required' attr is string in 'fields' params. (#49)
Browse files Browse the repository at this point in the history
Previously, since we treated it as a boolean it returned `true` even when the value is `"false"` string.
  • Loading branch information
vinothkannans authored Oct 3, 2023
1 parent b881d6b commit 23ad490
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion app/controllers/discourse_jira/issues_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def create

(params[:fields] || []).each do |_, data|
next if data.blank?
next if data[:value].blank? && !data[:required]
next if data[:value].blank? && data[:required] != "true"

case data[:field_type]
when "array"
Expand Down
5 changes: 5 additions & 0 deletions spec/requests/issues_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,11 @@
value: "windows",
field_type: "option",
},
"2": {
key: "customfield_10010",
field_type: "array",
required: "false",
},
},
}
end.to change { Post.count }.by(1)
Expand Down

0 comments on commit 23ad490

Please sign in to comment.