Merge pull request '同步代码' (#177) from KingChan/forgeplus:pm_project_develop into pm_project_develop
This commit is contained in:
commit
a5da06b7b3
|
@ -1,11 +1,21 @@
|
||||||
class Api::Pm::ProjectsController < Api::Pm::BaseController
|
class Api::Pm::ProjectsController < Api::Pm::BaseController
|
||||||
|
before_action :require_login, except: [:convert]
|
||||||
|
before_action :load_project
|
||||||
def convert
|
def convert
|
||||||
@project = Project.joins(:owner).find params[:project_id]
|
|
||||||
data = {
|
data = {
|
||||||
owner: @project.owner.try(:login),
|
owner: @project.owner.try(:login),
|
||||||
identifier: @project.identifier
|
identifier: @project.identifier
|
||||||
}
|
}
|
||||||
render_ok(data: data)
|
render_ok(data: data)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def bind_project
|
||||||
|
return render_forbidden('您没有操作权限!') unless @project.member?(current_user) || current_user.admin?
|
||||||
|
Issue.where(pm_project_id: params[:pm_project_id], user_id: current_user).update_all(project_id: params[:project_id])
|
||||||
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
def load_project
|
||||||
|
@project = Project.joins(:owner).find params[:project_id]
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue