From 42d2b51f7f2df6788119d2c3489dcdd8c5ab4947 Mon Sep 17 00:00:00 2001 From: yystopf Date: Thu, 16 Jun 2022 13:42:17 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D:=20=E9=A1=B9=E7=9B=AE?= =?UTF-8?q?=E6=95=8F=E6=84=9F=E8=AF=8D=E5=88=A4=E5=AE=9A=E5=8F=AA=E5=9C=A8?= =?UTF-8?q?=E5=88=9B=E5=BB=BA=E6=88=96=E8=80=85=E6=9B=B4=E6=96=B0=E7=9A=84?= =?UTF-8?q?=E6=97=B6=E5=80=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/project.rb | 2 +- app/models/project_unit.rb | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/app/models/project.rb b/app/models/project.rb index 9c77685f7..edaa00eb5 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -141,7 +141,7 @@ class Project < ApplicationRecord delegate :content, to: :project_detail, allow_nil: true delegate :name, to: :license, prefix: true, allow_nil: true - validate :validate_sensitive_string + validate :validate_sensitive_string, on: [:create, :update] def self.all_visible(user_id=nil) user_projects_sql = Project.joins(:owner).where(users: {type: 'User'}).to_sql diff --git a/app/models/project_unit.rb b/app/models/project_unit.rb index cc35a6b28..01f6c6670 100644 --- a/app/models/project_unit.rb +++ b/app/models/project_unit.rb @@ -14,6 +14,8 @@ # class ProjectUnit < ApplicationRecord + + default_scope {where(unit_type: ProjectUnit.unit_types.keys)} belongs_to :project enum unit_type: {code: 1, issues: 2, pulls: 3, wiki:4, devops: 5, versions: 6, resources: 7}