Merge branch 'develop' of https://gitlink.org.cn/Trustie/forgeplus into develop

This commit is contained in:
yystopf 2022-06-01 10:01:15 +08:00
commit 038df804c0
1 changed files with 423 additions and 416 deletions

View File

@ -141,6 +141,8 @@ class Project < ApplicationRecord
delegate :content, to: :project_detail, allow_nil: true
delegate :name, to: :license, prefix: true, allow_nil: true
validate :validate_sensitive_string
def self.all_visible(user_id=nil)
user_projects_sql = Project.joins(:owner).where(users: {type: 'User'}).to_sql
org_public_projects_sql = Project.joins(:owner).merge(Organization.joins(:organization_extension).where(organization_extensions: {visibility: 'common'})).to_sql
@ -413,4 +415,9 @@ class Project < ApplicationRecord
def is_transfering
applied_transfer_project&.common? ? true : false
end
def validate_sensitive_string
raise("项目名称包含敏感词汇,请重新输入") if name && !HarmoniousDictionary.clean?(name)
raise("项目描述包含敏感词汇,请重新输入") if description && !HarmoniousDictionary.clean?(description)
end
end