Browse Source

add: team unit add type wiki

tags/v3.1.5
yystopf 4 years ago
parent
commit
43add36d29
3 changed files with 4 additions and 4 deletions
  1. +1
    -1
      app/models/team.rb
  2. +1
    -1
      app/models/team_unit.rb
  3. +2
    -2
      app/services/organizations/teams/create_service.rb

+ 1
- 1
app/models/team.rb View File

@@ -31,7 +31,7 @@ class Team < ApplicationRecord

validates :name, uniqueness: {scope: :organization_id}

enum authorize: {common: 0, read: 1, write: 2, admin: 3, owner: 4}
enum authorize: {read: 1, write: 2, admin: 3, owner: 4}

def self.build(organization_id, name, nickname, description, authorize, includes_all_project, can_create_org_project)
self.create!(organization_id: organization_id,


+ 1
- 1
app/models/team_unit.rb View File

@@ -20,7 +20,7 @@ class TeamUnit < ApplicationRecord
belongs_to :organization
belongs_to :team

enum unit_type: {code: 1, issues: 2, pulls: 3, releases: 4}
enum unit_type: {code: 1, issues: 2, pulls: 3, wiki: 4, releases: 5}

validates :unit_type, uniqueness: { scope: [:organization_id, :team_id]}



+ 2
- 2
app/services/organizations/teams/create_service.rb View File

@@ -37,7 +37,7 @@ class Organizations::Teams::CreateService < ApplicationService
end

def authorize
params[:authorize].present? ? params[:authorize] : "common"
params[:authorize].present? ? params[:authorize] : "read"
end

def includes_all_project
@@ -54,7 +54,7 @@ class Organizations::Teams::CreateService < ApplicationService
end

def units_params
%w(admin owner).include?(authorize) ? %w(code issues pulls releases) : params[:unit_types]
%w(admin owner).include?(authorize) ? %w(code issues pulls wiki releases) : params[:unit_types]
end

def create_units


Loading…
Cancel
Save