diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-05-17 19:05:49 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-05-17 19:05:49 +0300 |
commit | 43a25d93ebdabea52f99b05e15b06250cd8f07d7 (patch) | |
tree | dceebdc68925362117480a5d672bcff122fb625b /app/controllers/groups/milestones_controller.rb | |
parent | 20c84b99005abd1c82101dfeff264ac50d2df211 (diff) |
Add latest changes from gitlab-org/gitlab@16-0-stable-eev16.0.0-rc42
Diffstat (limited to 'app/controllers/groups/milestones_controller.rb')
-rw-r--r-- | app/controllers/groups/milestones_controller.rb | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/app/controllers/groups/milestones_controller.rb b/app/controllers/groups/milestones_controller.rb index 494b8c5621d..903c8c214ae 100644 --- a/app/controllers/groups/milestones_controller.rb +++ b/app/controllers/groups/milestones_controller.rb @@ -45,6 +45,24 @@ class Groups::MilestonesController < Groups::ApplicationController Milestones::UpdateService.new(@milestone.parent, current_user, milestone_params).execute(@milestone) redirect_to milestone_path(@milestone) + rescue ActiveRecord::StaleObjectError + respond_to do |format| + format.html do + @conflict = true + render :edit + end + + format.json do + render json: { + errors: [ + format( + _("Someone edited this %{model_name} at the same time you did. Please refresh your browser and make sure your changes will not unintentionally remove theirs."), # rubocop:disable Layout/LineLength + model_name: _('milestone') + ) + ] + }, status: :conflict + end + end end def destroy @@ -63,7 +81,15 @@ class Groups::MilestonesController < Groups::ApplicationController end def milestone_params - params.require(:milestone).permit(:title, :description, :start_date, :due_date, :state_event) + params.require(:milestone) + .permit( + :description, + :due_date, + :lock_version, + :start_date, + :state_event, + :title + ) end def milestones |