Method name changed
This commit is contained in:
parent
549c4c2202
commit
b896880eb4
4 changed files with 8 additions and 8 deletions
|
@ -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?
|
||||
|
|
|
@ -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
|
||||
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
@ -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
|
||||
|
|
|
@ -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,
|
||||
|
@ -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
|
||||
|
@ -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…
Add table
Reference in a new issue