Commit b896880eb46c2b8167e2252d3656b5e38e35f6ec

Authored by Alex Denisov
1 parent 549c4c22

Method name changed

lib/api/helpers.rb
... ... @@ -28,7 +28,7 @@ module Gitlab
28 28 end
29 29 end
30 30  
31   - def existed_attributes(keys)
  31 + def attributes_for_keys(keys)
32 32 attrs = {}
33 33 keys.each do |key|
34 34 attrs[key] = params[key] if params[key].present?
... ...
lib/api/issues.rb
... ... @@ -48,7 +48,7 @@ module Gitlab
48 48 # Example Request:
49 49 # POST /projects/:id/issues
50 50 post ":id/issues" do
51   - attrs = existed_attributes [:title, :description, :assignee_id, :milestone_id]
  51 + attrs = attributes_for_keys [:title, :description, :assignee_id, :milestone_id]
52 52 attrs[:label_list] = params[:labels] if params[:labels].present?
53 53 @issue = user_project.issues.new attrs
54 54 @issue.author = current_user
... ... @@ -76,7 +76,7 @@ module Gitlab
76 76 @issue = user_project.issues.find(params[:issue_id])
77 77 authorize! :modify_issue, @issue
78 78  
79   - attrs = existed_attributes [:title, :description, :assignee_id, :milestone_id, :closed]
  79 + attrs = attributes_for_keys [:title, :description, :assignee_id, :milestone_id, :closed]
80 80 attrs[:label_list] = params[:labels] if params[:labels].present?
81 81 if @issue.update_attributes attrs
82 82 present @issue, with: Entities::Issue
... ...
lib/api/milestones.rb
... ... @@ -36,7 +36,7 @@ module Gitlab
36 36 # Example Request:
37 37 # POST /projects/:id/milestones
38 38 post ":id/milestones" do
39   - attrs = existed_attributes [:title, :description, :due_date]
  39 + attrs = attributes_for_keys [:title, :description, :due_date]
40 40 @milestone = user_project.milestones.new attrs
41 41 if @milestone.save
42 42 present @milestone, with: Entities::Milestone
... ... @@ -60,7 +60,7 @@ module Gitlab
60 60 authorize! :admin_milestone, user_project
61 61  
62 62 @milestone = user_project.milestones.find(params[:milestone_id])
63   - attrs = existed_attributes [:title, :description, :due_date, :closed]
  63 + attrs = attributes_for_keys [:title, :description, :due_date, :closed]
64 64 if @milestone.update_attributes attrs
65 65 present @milestone, with: Entities::Milestone
66 66 else
... ...
lib/api/projects.rb
... ... @@ -40,7 +40,7 @@ module Gitlab
40 40 post do
41 41 params[:code] ||= params[:name]
42 42 params[:path] ||= params[:name]
43   - attrs = existed_attributes [:code,
  43 + attrs = attributes_for_keys [:code,
44 44 :path,
45 45 :name,
46 46 :description,
... ... @@ -207,7 +207,7 @@ module Gitlab
207 207 # Example Request:
208 208 # POST /projects/:id/snippets
209 209 post ":id/snippets" do
210   - attrs = existed_attributes [:title, :file_name]
  210 + attrs = attributes_for_keys [:title, :file_name]
211 211 attrs[:expires_at] = params[:lifetime] if params[:lifetime].present?
212 212 attrs[:content] = params[:code] if params[:code].present?
213 213 @snippet = user_project.snippets.new attrs
... ... @@ -235,7 +235,7 @@ module Gitlab
235 235 @snippet = user_project.snippets.find(params[:snippet_id])
236 236 authorize! :modify_snippet, @snippet
237 237  
238   - attrs = existed_attributes [:title, :file_name]
  238 + attrs = attributes_for_keys [:title, :file_name]
239 239 attrs[:expires_at] = params[:lifetime] if params[:lifetime].present?
240 240 attrs[:content] = params[:code] if params[:code].present?
241 241  
... ...