forked from Gitlink/forgeplus
Merge pull request '【苏州大学】协同开发调整(#11588)' (#397) from kikiwww/forgeplus:dev_edu_local_suzhoudaxue into dev_edu_local_suzhoudaxue
This commit is contained in:
commit
7a71657220
|
@ -0,0 +1,16 @@
|
|||
class Declaration < ApplicationRecord
|
||||
|
||||
#status
|
||||
# '-1': '未提交'
|
||||
# '0': '待审核'
|
||||
# '1': '已通过'
|
||||
# '2': '已驳回'
|
||||
# '3': '已撤销'
|
||||
|
||||
belongs_to :user
|
||||
has_many :apply_actions, as: :container,dependent: :destroy
|
||||
has_many :project_reviews, dependent: :destroy
|
||||
|
||||
|
||||
|
||||
end
|
|
@ -142,6 +142,11 @@ class Project < ApplicationRecord
|
|||
delegate :content, to: :project_detail, allow_nil: true
|
||||
delegate :name, to: :license, prefix: true, allow_nil: true
|
||||
|
||||
def create_project_review
|
||||
de = Declaration.create(user_id: self.user_id,status:0,declare_type:16)
|
||||
de.project_reviews.create(project_id: self.id)
|
||||
end
|
||||
|
||||
def reset_cache_data
|
||||
if changes[:user_id].present?
|
||||
first_owner = Owner.find_by_id(changes[:user_id].first)
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class ProjectReview < ApplicationRecord
|
||||
belongs_to :project
|
||||
belongs_to :declaration
|
||||
|
||||
end
|
|
@ -13,6 +13,7 @@ class Projects::CreateService < ApplicationService
|
|||
@project = Project.new(project_params)
|
||||
ActiveRecord::Base.transaction do
|
||||
if @project.save!
|
||||
@project.create_project_review
|
||||
Project.update_common_projects_count!
|
||||
ProjectUnit.init_types(@project.id)
|
||||
Repositories::CreateService.new(user, @project, repository_params).call
|
||||
|
|
|
@ -12,6 +12,7 @@ class Projects::MigrateService < ApplicationService
|
|||
|
||||
@project = Project.new(project_params)
|
||||
if @project.save!
|
||||
@project.create_project_review
|
||||
ProjectUnit.init_types(@project.id, project.project_type)
|
||||
Project.update_mirror_projects_count!
|
||||
@project.set_owner_permission(user)
|
||||
|
|
|
@ -22,6 +22,8 @@ json.projects @projects do |project|
|
|||
json.invite_code project.invite_code
|
||||
json.is_manager project.manager?(current_user)
|
||||
json.is_member project.member?(current_user)
|
||||
# 审核状态 0:未审核 1:审核通过 2:审核不通过 3:审核撤回
|
||||
json.audit_statu project.audit_statu
|
||||
json.author do
|
||||
if project.educoder?
|
||||
project_educoder = project.project_educoder
|
||||
|
|
|
@ -15,4 +15,7 @@ json.transfer do
|
|||
end
|
||||
json.is_pinned @project.has_pinned_users.include?(current_user)
|
||||
json.pending_verify_count @project.applied_projects.select{|x|x.status == "common"}.size
|
||||
json.join_project_need_verify @project.join_project_need_verify
|
||||
json.join_project_need_verify @project.join_project_need_verify
|
||||
|
||||
# 审核状态 0:未审核 1:审核通过 2:审核不通过 3:审核撤回
|
||||
json.audit_statu @project.audit_statu
|
Loading…
Reference in New Issue