[#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
|
||||
|
|
|
@ -76,12 +76,13 @@ Rosa::Application.routes.draw do
|
|||
resources :projects, only: [:index, :show, :update, :create, :destroy] do
|
||||
collection { get :get_id }
|
||||
member {
|
||||
post :fork
|
||||
get :refs_list
|
||||
get :members
|
||||
put :add_member
|
||||
post :fork
|
||||
post :alias
|
||||
get :refs_list
|
||||
get :members
|
||||
put :add_member
|
||||
delete :remove_member
|
||||
put :update_member
|
||||
put :update_member
|
||||
}
|
||||
resources :build_lists, only: :index
|
||||
resources :issues, only: [:index, :create, :show, :update]
|
||||
|
|
Loading…
Reference in New Issue