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

Avoid parameter loss when sort issue_template #61

Merged
merged 1 commit into from
Mar 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions app/controllers/concerns/issue_templates_common.rb
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ def builtin_fields_json
end

def valid_params
return template_params unless template_params.has_key?(:builtin_fields)
attributes = template_params.except(:builtin_fields)
attributes[:builtin_fields_json] = builtin_fields_json if builtin_fields_enabled?
attributes
Expand Down
10 changes: 10 additions & 0 deletions spec/controllers/issue_templates_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -248,5 +248,15 @@
expect(issue_template.reload.title).to eq 'Issue Template updated title for update test'
end
end

context 'update position' do
let(:update_params) { { issue_template: { position: 10 } } }
let(:issue_template) { create :issue_template, builtin_fields_json: { key: "value" }}

it 'not updated builtin_fields' do
issue_template.reload
expect(issue_template.builtin_fields_json).to eq({ key: "value" })
end
end
end
end