Commit fc1226fe authored by Oswaldo Ferreira's avatar Oswaldo Ferreira

Remove scope issue board params when feature is not available

parent 5e636fa2
module Boards module Boards
class UpdateService < Boards::BaseService class UpdateService < Boards::BaseService
def execute(board) def execute(board)
params.delete(:milestone_id) unless parent.feature_available?(:scoped_issue_board) unless parent.feature_available?(:scoped_issue_board)
params.delete(:milestone_id)
params.delete(:assignee_id)
params.delete(:label_ids)
params.delete(:weight)
end
board.update(params) board.update(params)
end end
......
...@@ -25,7 +25,7 @@ describe Boards::UpdateService do ...@@ -25,7 +25,7 @@ describe Boards::UpdateService do
expect(service.execute(board)).to eq false expect(service.execute(board)).to eq false
end end
it 'udpates the milestone with issue board milestones enabled' do it 'updates the milestone with issue board milestones enabled' do
stub_licensed_features(scoped_issue_board: true) stub_licensed_features(scoped_issue_board: true)
milestone = create(:milestone, project: project) milestone = create(:milestone, project: project)
...@@ -35,14 +35,14 @@ describe Boards::UpdateService do ...@@ -35,14 +35,14 @@ describe Boards::UpdateService do
expect(board.reload.milestone).to eq(milestone) expect(board.reload.milestone).to eq(milestone)
end end
it 'udpates the milestone with the issue board milestones feature enabled' do it 'filters unpermitted params when scoped issue board is not enabled' do
stub_licensed_features(scoped_issue_board: false) stub_licensed_features(scoped_issue_board: false)
milestone = create(:milestone, project: project) params = { milestone_id: double, assignee_id: double, label_ids: double, weight: double }
service = described_class.new(project, double, milestone_id: milestone.id) expect(board).to receive(:update).with({})
service.execute(board)
expect(board.reload.milestone).to be_nil service = described_class.new(project, double, params)
service.execute(board)
end end
end end
end end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment