Skip to content
Snippets Groups Projects
Commit b896880e authored by Alex Denisov's avatar Alex Denisov
Browse files

Method name changed

parent 549c4c22
No related branches found
No related tags found
1 merge request!1480API attributes refactoring
Loading
Loading
@@ -28,7 +28,7 @@ module Gitlab
end
end
 
def existed_attributes(keys)
def attributes_for_keys(keys)
attrs = {}
keys.each do |key|
attrs[key] = params[key] if params[key].present?
Loading
Loading
Loading
Loading
@@ -48,7 +48,7 @@ module Gitlab
# Example Request:
# POST /projects/:id/issues
post ":id/issues" do
attrs = existed_attributes [:title, :description, :assignee_id, :milestone_id]
attrs = attributes_for_keys [:title, :description, :assignee_id, :milestone_id]
attrs[:label_list] = params[:labels] if params[:labels].present?
@issue = user_project.issues.new attrs
@issue.author = current_user
Loading
Loading
@@ -76,7 +76,7 @@ module Gitlab
@issue = user_project.issues.find(params[:issue_id])
authorize! :modify_issue, @issue
 
attrs = existed_attributes [:title, :description, :assignee_id, :milestone_id, :closed]
attrs = attributes_for_keys [:title, :description, :assignee_id, :milestone_id, :closed]
attrs[:label_list] = params[:labels] if params[:labels].present?
if @issue.update_attributes attrs
present @issue, with: Entities::Issue
Loading
Loading
Loading
Loading
@@ -36,7 +36,7 @@ module Gitlab
# Example Request:
# POST /projects/:id/milestones
post ":id/milestones" do
attrs = existed_attributes [:title, :description, :due_date]
attrs = attributes_for_keys [:title, :description, :due_date]
@milestone = user_project.milestones.new attrs
if @milestone.save
present @milestone, with: Entities::Milestone
Loading
Loading
@@ -60,7 +60,7 @@ module Gitlab
authorize! :admin_milestone, user_project
 
@milestone = user_project.milestones.find(params[:milestone_id])
attrs = existed_attributes [:title, :description, :due_date, :closed]
attrs = attributes_for_keys [:title, :description, :due_date, :closed]
if @milestone.update_attributes attrs
present @milestone, with: Entities::Milestone
else
Loading
Loading
Loading
Loading
@@ -40,7 +40,7 @@ module Gitlab
post do
params[:code] ||= params[:name]
params[:path] ||= params[:name]
attrs = existed_attributes [:code,
attrs = attributes_for_keys [:code,
:path,
:name,
:description,
Loading
Loading
@@ -207,7 +207,7 @@ module Gitlab
# Example Request:
# POST /projects/:id/snippets
post ":id/snippets" do
attrs = existed_attributes [:title, :file_name]
attrs = attributes_for_keys [:title, :file_name]
attrs[:expires_at] = params[:lifetime] if params[:lifetime].present?
attrs[:content] = params[:code] if params[:code].present?
@snippet = user_project.snippets.new attrs
Loading
Loading
@@ -235,7 +235,7 @@ module Gitlab
@snippet = user_project.snippets.find(params[:snippet_id])
authorize! :modify_snippet, @snippet
 
attrs = existed_attributes [:title, :file_name]
attrs = attributes_for_keys [:title, :file_name]
attrs[:expires_at] = params[:lifetime] if params[:lifetime].present?
attrs[:content] = params[:code] if params[:code].present?
 
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment