[#446] alias api
This commit is contained in:
parent
d9fa42af52
commit
b245c2a808
|
@ -67,14 +67,17 @@ class Api::V1::ProjectsController < Api::V1::BaseController
|
|||
update_member_in_subject @project
|
||||
end
|
||||
|
||||
def fork
|
||||
def fork(is_alias = false)
|
||||
owner = (Group.find params[:group_id] if params[:group_id].present?) || current_user
|
||||
authorize! :write, owner if owner.class == Group
|
||||
if forked = @project.fork(owner, new_name: params[:fork_name]) and forked.valid?
|
||||
if forked = @project.fork(owner, new_name: params[:fork_name], is_alias: is_alias) and forked.valid?
|
||||
render_json_response forked, 'Project has been forked successfully'
|
||||
else
|
||||
render_validation_error forked, 'Project has not been forked'
|
||||
end
|
||||
end
|
||||
|
||||
def alias
|
||||
fork(true)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -77,6 +77,7 @@ Rosa::Application.routes.draw do
|
|||
collection { get :get_id }
|
||||
member {
|
||||
post :fork
|
||||
post :alias
|
||||
get :refs_list
|
||||
get :members
|
||||
put :add_member
|
||||
|
|
Loading…
Reference in New Issue