Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorRobert Speicher <robert@gitlab.com>2016-07-15 21:29:50 +0300
committerRobert Speicher <robert@gitlab.com>2016-07-15 21:29:50 +0300
commitd4677353b84681bd73f321a0b04bb7eba32dbc9c (patch)
tree41e1e63a6761895ef576e3726d1ec4319978f162 /app
parentdfea11e1e791d0343ccc7d560f03710f5c1e2a98 (diff)
parentd7c591915893c8c572e9135db4ec27dc174823fd (diff)
Merge branch 'revert-lock-for-issuable' into 'master'
Revert "Optimistic locking for Issue and Merge Requests" The migration to add `lock_version` in !5146 to every issue and merge request takes too long on GitLab.com since it has to add a default value of 0 to every row. Unfortunately, Rails 4.2 doesn't work properly if the value is left as `nil`; anything using optimistic locking cannot be edited. This bug was fixed in Rails 5.0 via this commit: https://github.com/rails/rails/commit/13772bfa49325a8dc26410d2dcb555665a320f92. I suggest we revert this change for now, and when we upgrade to Rails 5.0 we can reintroduce this feature. See merge request !5245
Diffstat (limited to 'app')
-rw-r--r--app/controllers/projects/issues_controller.rb6
-rw-r--r--app/controllers/projects/merge_requests_controller.rb5
-rw-r--r--app/models/concerns/issuable.rb6
-rw-r--r--app/views/shared/issuable/_form.html.haml9
4 files changed, 2 insertions, 24 deletions
diff --git a/app/controllers/projects/issues_controller.rb b/app/controllers/projects/issues_controller.rb
index f7ada5cfee4..b6e80762e3c 100644
--- a/app/controllers/projects/issues_controller.rb
+++ b/app/controllers/projects/issues_controller.rb
@@ -119,10 +119,6 @@ class Projects::IssuesController < Projects::ApplicationController
render json: @issue.to_json(include: { milestone: {}, assignee: { methods: :avatar_url }, labels: { methods: :text_color } })
end
end
-
- rescue ActiveRecord::StaleObjectError
- @conflict = true
- render :edit
end
def referenced_merge_requests
@@ -220,7 +216,7 @@ class Projects::IssuesController < Projects::ApplicationController
def issue_params
params.require(:issue).permit(
:title, :assignee_id, :position, :description, :confidential,
- :milestone_id, :due_date, :state_event, :task_num, :lock_version, label_ids: []
+ :milestone_id, :due_date, :state_event, :task_num, label_ids: []
)
end
diff --git a/app/controllers/projects/merge_requests_controller.rb b/app/controllers/projects/merge_requests_controller.rb
index 2deb7959700..df659bb8c3b 100644
--- a/app/controllers/projects/merge_requests_controller.rb
+++ b/app/controllers/projects/merge_requests_controller.rb
@@ -196,9 +196,6 @@ class Projects::MergeRequestsController < Projects::ApplicationController
else
render "edit"
end
- rescue ActiveRecord::StaleObjectError
- @conflict = true
- render :edit
end
def remove_wip
@@ -427,7 +424,7 @@ class Projects::MergeRequestsController < Projects::ApplicationController
:title, :assignee_id, :source_project_id, :source_branch,
:target_project_id, :target_branch, :milestone_id,
:state_event, :description, :task_num, :force_remove_source_branch,
- :lock_version, label_ids: []
+ label_ids: []
)
end
diff --git a/app/models/concerns/issuable.rb b/app/models/concerns/issuable.rb
index fb49bd7dd64..acb6f5a2998 100644
--- a/app/models/concerns/issuable.rb
+++ b/app/models/concerns/issuable.rb
@@ -87,12 +87,6 @@ module Issuable
User.find(assignee_id_was).update_cache_counts if assignee_id_was
assignee.update_cache_counts if assignee
end
-
- # We want to use optimistic lock for cases when only title or description are involved
- # http://api.rubyonrails.org/classes/ActiveRecord/Locking/Optimistic.html
- def locking_enabled?
- title_changed? || description_changed?
- end
end
module ClassMethods
diff --git a/app/views/shared/issuable/_form.html.haml b/app/views/shared/issuable/_form.html.haml
index 07b39c233b1..a8a8426df52 100644
--- a/app/views/shared/issuable/_form.html.haml
+++ b/app/views/shared/issuable/_form.html.haml
@@ -1,12 +1,5 @@
= form_errors(issuable)
-- if @conflict
- .alert.alert-danger
- Someone edited the #{issuable.class.model_name.human.downcase} the same time you did.
- Please check out
- = link_to "the #{issuable.class.model_name.human.downcase}", polymorphic_path([@project.namespace.becomes(Namespace), @project, issuable]), target: "_blank"
- and make sure your changes will not unintentionally remove theirs
-
.form-group
= f.label :title, class: 'control-label'
.col-sm-10
@@ -142,5 +135,3 @@
= link_to 'Delete', polymorphic_path([@project.namespace.becomes(Namespace), @project, issuable]), data: { confirm: "#{issuable.class.name.titleize} will be removed! Are you sure?" },
method: :delete, class: 'btn btn-danger btn-grouped'
= link_to 'Cancel', polymorphic_path([@project.namespace.becomes(Namespace), @project, issuable]), class: 'btn btn-grouped btn-cancel'
-
-= f.hidden_field :lock_version