diff options
author | Sean McGivern <sean@gitlab.com> | 2017-08-30 13:33:39 +0100 |
---|---|---|
committer | Sean McGivern <sean@gitlab.com> | 2017-08-30 13:33:39 +0100 |
commit | e117d9d56554608837418966eb64179a549710f1 (patch) | |
tree | ab0bbe9389d7153fd1731f76063cc156e9149949 | |
parent | 07a7801c03ec6f5bccd517c38beaec426c554e11 (diff) | |
download | gitlab-ce-37231-mysql2-error-unknown-column-award_emoji-count-on-master.tar.gz |
Don't use public_send in destroy_conditionally! helper37231-mysql2-error-unknown-column-award_emoji-count-on-master
As we only override in one place, we could just ask for the value rather than
the method name.
-rw-r--r-- | lib/api/branches.rb | 2 | ||||
-rw-r--r-- | lib/api/helpers.rb | 6 |
2 files changed, 5 insertions, 3 deletions
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? |