diff options
author | ᴜɴᴋɴᴡᴏɴ <u@gogs.io> | 2020-03-22 22:07:22 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-03-22 22:07:22 +0800 |
commit | 22717a1c064511cf37c46af5e650baf7184cf25b (patch) | |
tree | f98bb991145605567f8b43506a7add855db0a90f /internal/route/org/setting.go | |
parent | 82e511ddb1d1e98ebe6b1931766b0835fc066883 (diff) |
webhook: overhaul route handlers (#6002)
* Overual route handlers and fixes #5366
* Merge routes for repo and org
* Inject OrgRepoContext
* DRY validateWebhook
* DRY c.HasError
* Add tests
* Update CHANGELOG
Diffstat (limited to 'internal/route/org/setting.go')
-rw-r--r-- | internal/route/org/setting.go | 34 |
1 files changed, 2 insertions, 32 deletions
diff --git a/internal/route/org/setting.go b/internal/route/org/setting.go index 61503383..15b57623 100644 --- a/internal/route/org/setting.go +++ b/internal/route/org/setting.go @@ -17,9 +17,8 @@ import ( ) const ( - SETTINGS_OPTIONS = "org/settings/options" - SETTINGS_DELETE = "org/settings/delete" - SETTINGS_WEBHOOKS = "org/settings/webhooks" + SETTINGS_OPTIONS = "org/settings/options" + SETTINGS_DELETE = "org/settings/delete" ) func Settings(c *context.Context) { @@ -136,32 +135,3 @@ func SettingsDelete(c *context.Context) { c.Success(SETTINGS_DELETE) } - -func Webhooks(c *context.Context) { - c.Title("org.settings") - c.Data["PageIsSettingsHooks"] = true - c.Data["BaseLink"] = c.Org.OrgLink - c.Data["Description"] = c.Tr("org.settings.hooks_desc") - c.Data["Types"] = conf.Webhook.Types - - ws, err := db.GetWebhooksByOrgID(c.Org.Organization.ID) - if err != nil { - c.Error(err, "get webhooks by organization ID") - return - } - - c.Data["Webhooks"] = ws - c.Success(SETTINGS_WEBHOOKS) -} - -func DeleteWebhook(c *context.Context) { - if err := db.DeleteWebhookOfOrgByID(c.Org.Organization.ID, c.QueryInt64("id")); err != nil { - c.Flash.Error("DeleteWebhookByOrgID: " + err.Error()) - } else { - c.Flash.Success(c.Tr("repo.settings.webhook_deletion_success")) - } - - c.JSONSuccess( map[string]interface{}{ - "redirect": c.Org.OrgLink + "/settings/hooks", - }) -} |