summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGrzegorz Bizon <grzegorz@gitlab.com>2017-08-30 15:15:23 +0000
committerGrzegorz Bizon <grzegorz@gitlab.com>2017-08-30 15:15:23 +0000
commitf35d7d7f6ea04a38da822db902ad24108dfe94a2 (patch)
treea561939595656be354abd1db6909872e63c2fe54
parentf1d9dc81727c84c1114c1cbdc1b87a2a10462420 (diff)
parentb9d8946395ebe2b0d05e464e6a2af1181c7f1b90 (diff)
downloadgitlab-ce-f35d7d7f6ea04a38da822db902ad24108dfe94a2.tar.gz
Merge branch '37231-mysql2-error-unknown-column-award_emoji-count-on-master' into 'master'
Resolve "Mysql2::Error: Unknown column 'award_emoji.count' on master" Closes #37231 See merge request !13926
-rw-r--r--app/controllers/autocomplete_controller.rb2
-rw-r--r--lib/api/branches.rb2
-rw-r--r--lib/api/helpers.rb6
-rw-r--r--lib/api/tags.rb2
4 files changed, 7 insertions, 5 deletions
diff --git a/app/controllers/autocomplete_controller.rb b/app/controllers/autocomplete_controller.rb
index 54f78fc8719..59be955599d 100644
--- a/app/controllers/autocomplete_controller.rb
+++ b/app/controllers/autocomplete_controller.rb
@@ -55,7 +55,7 @@ class AutocompleteController < ApplicationController
.limit(AWARD_EMOJI_MAX)
.where(user: current_user)
.group(:name)
- .order(count: :desc, name: :asc)
+ .order('count_all DESC, name ASC')
.count
# Transform from hash to array to guarantee json order
diff --git a/lib/api/branches.rb b/lib/api/branches.rb
index b87f7cdbad1..a989394ad91 100644
--- a/lib/api/branches.rb
+++ b/lib/api/branches.rb
@@ -130,7 +130,7 @@ module API
commit = user_project.repository.commit(branch.dereferenced_target)
- destroy_conditionally!(commit, last_update_field: :authored_date) do
+ destroy_conditionally!(commit, last_updated: commit.authored_date) do
result = DeleteBranchService.new(user_project, current_user)
.execute(params[:branch])
diff --git a/lib/api/helpers.rb b/lib/api/helpers.rb
index 84980864151..3d377fdb9eb 100644
--- a/lib/api/helpers.rb
+++ b/lib/api/helpers.rb
@@ -19,8 +19,10 @@ module API
end
end
- def destroy_conditionally!(resource, last_update_field: :updated_at)
- check_unmodified_since!(resource.public_send(last_update_field))
+ def destroy_conditionally!(resource, last_updated: nil)
+ last_updated ||= resource.updated_at
+
+ check_unmodified_since!(last_updated)
status 204
if block_given?
diff --git a/lib/api/tags.rb b/lib/api/tags.rb
index 81b17935b81..912415e3a7f 100644
--- a/lib/api/tags.rb
+++ b/lib/api/tags.rb
@@ -70,7 +70,7 @@ module API
commit = user_project.repository.commit(tag.dereferenced_target)
- destroy_conditionally!(commit, last_update_field: :authored_date) do
+ destroy_conditionally!(commit, last_updated: commit.authored_date) do
result = ::Tags::DestroyService.new(user_project, current_user)
.execute(params[:tag_name])