Remove push, tag and deployment webhook filters (#281)

- remove `AllowPush`, `AllowTag`,  `AllowDeploy` options.
- keep `AllowPullRequest` option and disable it by default

---
close #265 
close #243
This commit is contained in:
Anbraten 2021-09-18 16:28:35 +02:00 committed by GitHub
parent 387760ccbf
commit 894df351ee
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
19 changed files with 187 additions and 175 deletions

View file

@ -13,26 +13,23 @@ type (
// Repo represents a repository. // Repo represents a repository.
Repo struct { Repo struct {
ID int64 `json:"id,omitempty"` ID int64 `json:"id,omitempty"`
Owner string `json:"owner"` Owner string `json:"owner"`
Name string `json:"name"` Name string `json:"name"`
FullName string `json:"full_name"` FullName string `json:"full_name"`
Avatar string `json:"avatar_url,omitempty"` Avatar string `json:"avatar_url,omitempty"`
Link string `json:"link_url,omitempty"` Link string `json:"link_url,omitempty"`
Kind string `json:"scm,omitempty"` Kind string `json:"scm,omitempty"`
Clone string `json:"clone_url,omitempty"` Clone string `json:"clone_url,omitempty"`
Branch string `json:"default_branch,omitempty"` Branch string `json:"default_branch,omitempty"`
Timeout int64 `json:"timeout,omitempty"` Timeout int64 `json:"timeout,omitempty"`
Visibility string `json:"visibility"` Visibility string `json:"visibility"`
IsPrivate bool `json:"private,omitempty"` IsPrivate bool `json:"private,omitempty"`
IsTrusted bool `json:"trusted"` IsTrusted bool `json:"trusted"`
IsStarred bool `json:"starred,omitempty"` IsStarred bool `json:"starred,omitempty"`
IsGated bool `json:"gated"` IsGated bool `json:"gated"`
AllowPull bool `json:"allow_pr"` AllowPull bool `json:"allow_pr"`
AllowPush bool `json:"allow_push"` Config string `json:"config_file"`
AllowDeploy bool `json:"allow_deploys"`
AllowTag bool `json:"allow_tags"`
Config string `json:"config_file"`
} }
// RepoPatch defines a repository patch request. // RepoPatch defines a repository patch request.
@ -43,9 +40,6 @@ type (
Timeout *int64 `json:"timeout,omitempty"` Timeout *int64 `json:"timeout,omitempty"`
Visibility *string `json:"visibility"` Visibility *string `json:"visibility"`
AllowPull *bool `json:"allow_pr,omitempty"` AllowPull *bool `json:"allow_pr,omitempty"`
AllowPush *bool `json:"allow_push,omitempty"`
AllowDeploy *bool `json:"allow_deploy,omitempty"`
AllowTag *bool `json:"allow_tag,omitempty"`
BuildCounter *int `json:"build_counter,omitempty"` BuildCounter *int `json:"build_counter,omitempty"`
} }

View file

@ -30,31 +30,28 @@ type RepoLite struct {
// //
// swagger:model repo // swagger:model repo
type Repo struct { type Repo struct {
ID int64 `json:"id,omitempty" meddler:"repo_id,pk"` ID int64 `json:"id,omitempty" meddler:"repo_id,pk"`
UserID int64 `json:"-" meddler:"repo_user_id"` UserID int64 `json:"-" meddler:"repo_user_id"`
Owner string `json:"owner" meddler:"repo_owner"` Owner string `json:"owner" meddler:"repo_owner"`
Name string `json:"name" meddler:"repo_name"` Name string `json:"name" meddler:"repo_name"`
FullName string `json:"full_name" meddler:"repo_full_name"` FullName string `json:"full_name" meddler:"repo_full_name"`
Avatar string `json:"avatar_url,omitempty" meddler:"repo_avatar"` Avatar string `json:"avatar_url,omitempty" meddler:"repo_avatar"`
Link string `json:"link_url,omitempty" meddler:"repo_link"` Link string `json:"link_url,omitempty" meddler:"repo_link"`
Kind string `json:"scm,omitempty" meddler:"repo_scm"` Kind string `json:"scm,omitempty" meddler:"repo_scm"`
Clone string `json:"clone_url,omitempty" meddler:"repo_clone"` Clone string `json:"clone_url,omitempty" meddler:"repo_clone"`
Branch string `json:"default_branch,omitempty" meddler:"repo_branch"` Branch string `json:"default_branch,omitempty" meddler:"repo_branch"`
Timeout int64 `json:"timeout,omitempty" meddler:"repo_timeout"` Timeout int64 `json:"timeout,omitempty" meddler:"repo_timeout"`
Visibility string `json:"visibility" meddler:"repo_visibility"` Visibility string `json:"visibility" meddler:"repo_visibility"`
IsPrivate bool `json:"private" meddler:"repo_private"` IsPrivate bool `json:"private" meddler:"repo_private"`
IsTrusted bool `json:"trusted" meddler:"repo_trusted"` IsTrusted bool `json:"trusted" meddler:"repo_trusted"`
IsStarred bool `json:"starred,omitempty" meddler:"-"` IsStarred bool `json:"starred,omitempty" meddler:"-"`
IsGated bool `json:"gated" meddler:"repo_gated"` IsGated bool `json:"gated" meddler:"repo_gated"`
IsActive bool `json:"active" meddler:"repo_active"` IsActive bool `json:"active" meddler:"repo_active"`
AllowPull bool `json:"allow_pr" meddler:"repo_allow_pr"` AllowPull bool `json:"allow_pr" meddler:"repo_allow_pr"`
AllowPush bool `json:"allow_push" meddler:"repo_allow_push"` Counter int `json:"last_build" meddler:"repo_counter"`
AllowDeploy bool `json:"allow_deploys" meddler:"repo_allow_deploys"` Config string `json:"config_file" meddler:"repo_config_path"`
AllowTag bool `json:"allow_tags" meddler:"repo_allow_tags"` Hash string `json:"-" meddler:"repo_hash"`
Counter int `json:"last_build" meddler:"repo_counter"` Perm *Perm `json:"-" meddler:"-"`
Config string `json:"config_file" meddler:"repo_config_path"`
Hash string `json:"-" meddler:"repo_hash"`
Perm *Perm `json:"-" meddler:"-"`
} }
func (r *Repo) ResetVisibility() { func (r *Repo) ResetVisibility() {
@ -101,8 +98,5 @@ type RepoPatch struct {
Timeout *int64 `json:"timeout,omitempty"` Timeout *int64 `json:"timeout,omitempty"`
Visibility *string `json:"visibility,omitempty"` Visibility *string `json:"visibility,omitempty"`
AllowPull *bool `json:"allow_pr,omitempty"` AllowPull *bool `json:"allow_pr,omitempty"`
AllowPush *bool `json:"allow_push,omitempty"`
AllowDeploy *bool `json:"allow_deploy,omitempty"`
AllowTag *bool `json:"allow_tag,omitempty"`
BuildCounter *int `json:"build_counter,omitempty"` BuildCounter *int `json:"build_counter,omitempty"`
} }

View file

@ -134,16 +134,9 @@ func PostHook(c *gin.Context) {
c.Writer.WriteHeader(204) c.Writer.WriteHeader(204)
return return
} }
var skipped = true
if (build.Event == model.EventPush && repo.AllowPush) ||
(build.Event == model.EventPull && repo.AllowPull) ||
(build.Event == model.EventDeploy && repo.AllowDeploy) ||
(build.Event == model.EventTag && repo.AllowTag) {
skipped = false
}
if skipped { if build.Event == model.EventPull && !repo.AllowPull {
logrus.Infof("ignoring hook. repo %s is disabled for %s events.", repo.FullName, build.Event) logrus.Infof("ignoring hook. repo %s is disabled for pull requests.", repo.FullName)
c.Writer.WriteHeader(204) c.Writer.WriteHeader(204)
return return
} }

View file

@ -42,19 +42,18 @@ func PostRepo(c *gin.Context) {
repo.IsActive = true repo.IsActive = true
repo.UserID = user.ID repo.UserID = user.ID
if !repo.AllowPush && !repo.AllowPull && !repo.AllowDeploy && !repo.AllowTag {
repo.AllowPush = true
repo.AllowPull = true
}
if repo.Visibility == "" { if repo.Visibility == "" {
repo.Visibility = model.VisibilityPublic repo.Visibility = model.VisibilityPublic
if repo.IsPrivate { if repo.IsPrivate {
repo.Visibility = model.VisibilityPrivate repo.Visibility = model.VisibilityPrivate
} }
} }
if repo.Timeout == 0 { if repo.Timeout == 0 {
repo.Timeout = 60 // 1 hour default build time repo.Timeout = 60 // 1 hour default build time
} }
if repo.Hash == "" { if repo.Hash == "" {
repo.Hash = base32.StdEncoding.EncodeToString( repo.Hash = base32.StdEncoding.EncodeToString(
securecookie.GenerateRandomKey(32), securecookie.GenerateRandomKey(32),
@ -110,18 +109,9 @@ func PatchRepo(c *gin.Context) {
return return
} }
if in.AllowPush != nil {
repo.AllowPush = *in.AllowPush
}
if in.AllowPull != nil { if in.AllowPull != nil {
repo.AllowPull = *in.AllowPull repo.AllowPull = *in.AllowPull
} }
if in.AllowDeploy != nil {
repo.AllowDeploy = *in.AllowDeploy
}
if in.AllowTag != nil {
repo.AllowTag = *in.AllowTag
}
if in.IsGated != nil { if in.IsGated != nil {
repo.IsGated = *in.IsGated repo.IsGated = *in.IsGated
} }

View file

@ -93,10 +93,7 @@ paths:
"timeout": 60, "timeout": 60,
"private": false, "private": false,
"trusted": false, "trusted": false,
"allow_pr": true, "allow_pr": true
"allow_push": true,
"allow_deploys": false,
"allow_tags": false
} }
required: true required: true
tags: tags:
@ -655,10 +652,7 @@ definitions:
"timeout": 60, "timeout": 60,
"private": false, "private": false,
"trusted": false, "trusted": false,
"allow_pr": true, "allow_pr": true
"allow_push": true,
"allow_deploys": false,
"allow_tags": false
} }
properties: properties:
id: id:
@ -712,15 +706,6 @@ definitions:
allow_pr: allow_pr:
description: Whether pull requests should trigger a build. description: Whether pull requests should trigger a build.
type: boolean type: boolean
allow_push:
description: Whether push events should trigger a build.
type: boolean
allow_deploys:
description: Whether deployment events should trigger a build.
type: boolean
allow_tags:
description: Whether tags should trigger a build.
type: boolean
Build: Build:
description: A build for a repository. description: A build for a repository.

View file

@ -204,6 +204,10 @@ var migrations = []struct {
name: "alter-table-drop-repo-fallback", name: "alter-table-drop-repo-fallback",
stmt: alterTableDropRepoFallback, stmt: alterTableDropRepoFallback,
}, },
{
name: "drop-allow-push-tags-deploys-columns",
stmt: dropAllowPushTagsDeploysColumns,
},
} }
// Migrate performs the database migration. If the migration fails // Migrate performs the database migration. If the migration fails
@ -757,3 +761,11 @@ UPDATE builds SET changed_files='[]'
var alterTableDropRepoFallback = ` var alterTableDropRepoFallback = `
ALTER TABLE repos DROP COLUMN repo_fallback ALTER TABLE repos DROP COLUMN repo_fallback
` `
//
// 027_drop_allow_push_tags_deployments_columns.sql
//
var dropAllowPushTagsDeploysColumns = `
ALTER TABLE repos DROP COLUMN repo_allow_push, DROP COLUMN repo_allow_deploys, DROP COLUMN repo_allow_tags
`

View file

@ -0,0 +1,2 @@
-- name: drop-allow-push-tags-deploys-columns
ALTER TABLE repos DROP COLUMN repo_allow_push, DROP COLUMN repo_allow_deploys, DROP COLUMN repo_allow_tags

View file

@ -204,6 +204,10 @@ var migrations = []struct {
name: "alter-table-drop-repo-fallback", name: "alter-table-drop-repo-fallback",
stmt: alterTableDropRepoFallback, stmt: alterTableDropRepoFallback,
}, },
{
name: "drop-allow-push-tags-deploys-columns",
stmt: dropAllowPushTagsDeploysColumns,
},
} }
// Migrate performs the database migration. If the migration fails // Migrate performs the database migration. If the migration fails
@ -759,3 +763,11 @@ UPDATE builds SET changed_files='[]'
var alterTableDropRepoFallback = ` var alterTableDropRepoFallback = `
ALTER TABLE repos DROP COLUMN repo_fallback ALTER TABLE repos DROP COLUMN repo_fallback
` `
//
// 027_drop_allow_push_tags_deployments_columns.sql
//
var dropAllowPushTagsDeploysColumns = `
ALTER TABLE repos DROP COLUMN repo_allow_push, DROP COLUMN repo_allow_deploys, DROP COLUMN repo_allow_tags
`

View file

@ -0,0 +1,2 @@
-- name: drop-allow-push-tags-deploys-columns
ALTER TABLE repos DROP COLUMN repo_allow_push, DROP COLUMN repo_allow_deploys, DROP COLUMN repo_allow_tags

View file

@ -208,6 +208,10 @@ var migrations = []struct {
name: "alter-table-drop-repo-fallback", name: "alter-table-drop-repo-fallback",
stmt: alterTableDropRepoFallback, stmt: alterTableDropRepoFallback,
}, },
{
name: "drop-allow-push-tags-deploys-columns",
stmt: dropAllowPushTagsDeploysColumns,
},
} }
// Migrate performs the database migration. If the migration fails // Migrate performs the database migration. If the migration fails
@ -812,3 +816,57 @@ DROP TABLE repos;
ALTER TABLE repos_new RENAME TO repos; ALTER TABLE repos_new RENAME TO repos;
COMMIT; COMMIT;
` `
//
// 027_drop_allow_push_tags_deployments_columns.sql
//
var dropAllowPushTagsDeploysColumns = `
BEGIN TRANSACTION;
CREATE TABLE repos_new (
repo_id INTEGER PRIMARY KEY AUTOINCREMENT,
repo_user_id INTEGER,
repo_owner TEXT,
repo_name TEXT,
repo_full_name TEXT,
repo_avatar TEXT,
repo_link TEXT,
repo_clone TEXT,
repo_branch TEXT,
repo_timeout INTEGER,
repo_private BOOLEAN,
repo_trusted BOOLEAN,
repo_active BOOLEAN,
repo_allow_pr BOOLEAN,
repo_hash TEXT,
repo_scm TEXT,
repo_config_path TEXT,
repo_gated BOOLEAN,
repo_visibility TEXT,
repo_counter INTEGER,
UNIQUE(repo_full_name)
);
INSERT INTO repos_new SELECT repo_id
,repo_user_id
,repo_owner
,repo_name
,repo_full_name
,repo_avatar
,repo_link
,repo_clone
,repo_branch
,repo_timeout
,repo_private
,repo_trusted
,repo_active
,repo_allow_pr
,repo_hash
,repo_scm
,repo_config_path
,repo_gated
,repo_visibility
,repo_counter FROM repos;
DROP TABLE repos;
ALTER TABLE repos_new RENAME TO repos;
COMMIT;
`

View file

@ -0,0 +1,48 @@
-- name: drop-allow-push-tags-deploys-columns
BEGIN TRANSACTION;
CREATE TABLE repos_new (
repo_id INTEGER PRIMARY KEY AUTOINCREMENT,
repo_user_id INTEGER,
repo_owner TEXT,
repo_name TEXT,
repo_full_name TEXT,
repo_avatar TEXT,
repo_link TEXT,
repo_clone TEXT,
repo_branch TEXT,
repo_timeout INTEGER,
repo_private BOOLEAN,
repo_trusted BOOLEAN,
repo_active BOOLEAN,
repo_allow_pr BOOLEAN,
repo_hash TEXT,
repo_scm TEXT,
repo_config_path TEXT,
repo_gated BOOLEAN,
repo_visibility TEXT,
repo_counter INTEGER,
UNIQUE(repo_full_name)
);
INSERT INTO repos_new SELECT repo_id
,repo_user_id
,repo_owner
,repo_name
,repo_full_name
,repo_avatar
,repo_link
,repo_clone
,repo_branch
,repo_timeout
,repo_private
,repo_trusted
,repo_active
,repo_allow_pr
,repo_hash
,repo_scm
,repo_config_path
,repo_gated
,repo_visibility
,repo_counter FROM repos;
DROP TABLE repos;
ALTER TABLE repos_new RENAME TO repos;
COMMIT;

View file

@ -84,9 +84,6 @@ func (db *datastore) RepoBatch(repos []*model.Repo) error {
repo.IsTrusted, repo.IsTrusted,
repo.IsActive, repo.IsActive,
repo.AllowPull, repo.AllowPull,
repo.AllowPush,
repo.AllowDeploy,
repo.AllowTag,
repo.Hash, repo.Hash,
repo.Kind, repo.Kind,
repo.Config, repo.Config,

View file

@ -21,9 +21,6 @@ SELECT
,repo_trusted ,repo_trusted
,repo_active ,repo_active
,repo_allow_pr ,repo_allow_pr
,repo_allow_push
,repo_allow_deploys
,repo_allow_tags
,repo_hash ,repo_hash
,repo_scm ,repo_scm
,repo_config_path ,repo_config_path
@ -51,16 +48,13 @@ INSERT IGNORE INTO repos (
,repo_trusted ,repo_trusted
,repo_active ,repo_active
,repo_allow_pr ,repo_allow_pr
,repo_allow_push
,repo_allow_deploys
,repo_allow_tags
,repo_hash ,repo_hash
,repo_scm ,repo_scm
,repo_config_path ,repo_config_path
,repo_gated ,repo_gated
,repo_visibility ,repo_visibility
,repo_counter ,repo_counter
) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?) ) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)
-- name: repo-delete -- name: repo-delete

View file

@ -439,9 +439,6 @@ SELECT
,repo_trusted ,repo_trusted
,repo_active ,repo_active
,repo_allow_pr ,repo_allow_pr
,repo_allow_push
,repo_allow_deploys
,repo_allow_tags
,repo_hash ,repo_hash
,repo_scm ,repo_scm
,repo_config_path ,repo_config_path
@ -469,16 +466,13 @@ INSERT IGNORE INTO repos (
,repo_trusted ,repo_trusted
,repo_active ,repo_active
,repo_allow_pr ,repo_allow_pr
,repo_allow_push
,repo_allow_deploys
,repo_allow_tags
,repo_hash ,repo_hash
,repo_scm ,repo_scm
,repo_config_path ,repo_config_path
,repo_gated ,repo_gated
,repo_visibility ,repo_visibility
,repo_counter ,repo_counter
) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?) ) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)
` `
var repoDelete = ` var repoDelete = `

View file

@ -21,9 +21,6 @@ SELECT
,repo_trusted ,repo_trusted
,repo_active ,repo_active
,repo_allow_pr ,repo_allow_pr
,repo_allow_push
,repo_allow_deploys
,repo_allow_tags
,repo_hash ,repo_hash
,repo_scm ,repo_scm
,repo_config_path ,repo_config_path
@ -51,16 +48,13 @@ INSERT INTO repos (
,repo_trusted ,repo_trusted
,repo_active ,repo_active
,repo_allow_pr ,repo_allow_pr
,repo_allow_push
,repo_allow_deploys
,repo_allow_tags
,repo_hash ,repo_hash
,repo_scm ,repo_scm
,repo_config_path ,repo_config_path
,repo_gated ,repo_gated
,repo_visibility ,repo_visibility
,repo_counter ,repo_counter
) VALUES ($1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12,$13,$14,$15,$16,$17,$18,$19,$20,$21,$22) ) VALUES ($1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12,$13,$14,$15,$16,$17,$18,$19)
ON CONFLICT (repo_full_name) DO NOTHING ON CONFLICT (repo_full_name) DO NOTHING
-- name: repo-delete -- name: repo-delete

View file

@ -442,9 +442,6 @@ SELECT
,repo_trusted ,repo_trusted
,repo_active ,repo_active
,repo_allow_pr ,repo_allow_pr
,repo_allow_push
,repo_allow_deploys
,repo_allow_tags
,repo_hash ,repo_hash
,repo_scm ,repo_scm
,repo_config_path ,repo_config_path
@ -472,16 +469,13 @@ INSERT INTO repos (
,repo_trusted ,repo_trusted
,repo_active ,repo_active
,repo_allow_pr ,repo_allow_pr
,repo_allow_push
,repo_allow_deploys
,repo_allow_tags
,repo_hash ,repo_hash
,repo_scm ,repo_scm
,repo_config_path ,repo_config_path
,repo_gated ,repo_gated
,repo_visibility ,repo_visibility
,repo_counter ,repo_counter
) VALUES ($1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12,$13,$14,$15,$16,$17,$18,$19,$20,$21,$22) ) VALUES ($1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12,$13,$14,$15,$16,$17,$18,$19)
ON CONFLICT (repo_full_name) DO NOTHING ON CONFLICT (repo_full_name) DO NOTHING
` `

View file

@ -21,9 +21,6 @@ SELECT
,repo_trusted ,repo_trusted
,repo_active ,repo_active
,repo_allow_pr ,repo_allow_pr
,repo_allow_push
,repo_allow_deploys
,repo_allow_tags
,repo_hash ,repo_hash
,repo_scm ,repo_scm
,repo_config_path ,repo_config_path
@ -51,16 +48,13 @@ INSERT OR IGNORE INTO repos (
,repo_trusted ,repo_trusted
,repo_active ,repo_active
,repo_allow_pr ,repo_allow_pr
,repo_allow_push
,repo_allow_deploys
,repo_allow_tags
,repo_hash ,repo_hash
,repo_scm ,repo_scm
,repo_config_path ,repo_config_path
,repo_gated ,repo_gated
,repo_visibility ,repo_visibility
,repo_counter ,repo_counter
) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?) ) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)
-- name: repo-delete -- name: repo-delete

View file

@ -439,9 +439,6 @@ SELECT
,repo_trusted ,repo_trusted
,repo_active ,repo_active
,repo_allow_pr ,repo_allow_pr
,repo_allow_push
,repo_allow_deploys
,repo_allow_tags
,repo_hash ,repo_hash
,repo_scm ,repo_scm
,repo_config_path ,repo_config_path
@ -469,16 +466,13 @@ INSERT OR IGNORE INTO repos (
,repo_trusted ,repo_trusted
,repo_active ,repo_active
,repo_allow_pr ,repo_allow_pr
,repo_allow_push
,repo_allow_deploys
,repo_allow_tags
,repo_hash ,repo_hash
,repo_scm ,repo_scm
,repo_config_path ,repo_config_path
,repo_gated ,repo_gated
,repo_visibility ,repo_visibility
,repo_counter ,repo_counter
) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?) ) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)
` `
var repoDelete = ` var repoDelete = `

View file

@ -32,10 +32,7 @@ export default class Settings extends Component {
constructor(props, context) { constructor(props, context) {
super(props, context); super(props, context);
this.handlePushChange = this.handlePushChange.bind(this);
this.handlePullChange = this.handlePullChange.bind(this); this.handlePullChange = this.handlePullChange.bind(this);
this.handleTagChange = this.handleTagChange.bind(this);
this.handleDeployChange = this.handleDeployChange.bind(this);
this.handleTrustedChange = this.handleTrustedChange.bind(this); this.handleTrustedChange = this.handleTrustedChange.bind(this);
this.handleProtectedChange = this.handleProtectedChange.bind(this); this.handleProtectedChange = this.handleProtectedChange.bind(this);
this.handleVisibilityChange = this.handleVisibilityChange.bind(this); this.handleVisibilityChange = this.handleVisibilityChange.bind(this);
@ -78,37 +75,13 @@ export default class Settings extends Component {
<section> <section>
<h2>Repository Hooks</h2> <h2>Repository Hooks</h2>
<div> <div>
<label>
<input
type="checkbox"
checked={repo.allow_push}
onChange={this.handlePushChange}
/>
<span>push</span>
</label>
<label> <label>
<input <input
type="checkbox" type="checkbox"
checked={repo.allow_pr} checked={repo.allow_pr}
onChange={this.handlePullChange} onChange={this.handlePullChange}
/> />
<span>pull request</span> <span>Allow to execute pipelines on Pull-Requests</span>
</label>
<label>
<input
type="checkbox"
checked={repo.allow_tags}
onChange={this.handleTagChange}
/>
<span>tag</span>
</label>
<label>
<input
type="checkbox"
checked={repo.allow_deploys}
onChange={this.handleDeployChange}
/>
<span>deployment</span>
</label> </label>
</div> </div>
</section> </section>
@ -186,22 +159,10 @@ export default class Settings extends Component {
); );
} }
handlePushChange(e) {
this.handleChange("allow_push", e.target.checked);
}
handlePullChange(e) { handlePullChange(e) {
this.handleChange("allow_pr", e.target.checked); this.handleChange("allow_pr", e.target.checked);
} }
handleTagChange(e) {
this.handleChange("allow_tag", e.target.checked);
}
handleDeployChange(e) {
this.handleChange("allow_deploy", e.target.checked);
}
handleTrustedChange(e) { handleTrustedChange(e) {
this.handleChange("trusted", e.target.checked); this.handleChange("trusted", e.target.checked);
} }