(c *context.Context, orCtx *orgRepoContext, f form.NewSlackHook)
| 385 | } |
| 386 | |
| 387 | func WebhooksSlackEditPost(c *context.Context, orCtx *orgRepoContext, f form.NewSlackHook) { |
| 388 | c.Title("repo.settings.update_webhook") |
| 389 | c.PageIs("SettingsHooks") |
| 390 | c.PageIs("SettingsHooksEdit") |
| 391 | |
| 392 | w := loadWebhook(c, orCtx) |
| 393 | if c.Written() { |
| 394 | return |
| 395 | } |
| 396 | |
| 397 | meta, err := jsoniter.Marshal(&database.SlackMeta{ |
| 398 | Channel: f.Channel, |
| 399 | Username: f.Username, |
| 400 | IconURL: f.IconURL, |
| 401 | Color: f.Color, |
| 402 | }) |
| 403 | if err != nil { |
| 404 | c.Error(err, "marshal JSON") |
| 405 | return |
| 406 | } |
| 407 | |
| 408 | w.URL = f.PayloadURL |
| 409 | w.Meta = string(meta) |
| 410 | w.HookEvent = toHookEvent(f.Webhook) |
| 411 | w.IsActive = f.Active |
| 412 | validateAndUpdateWebhook(c, orCtx, w) |
| 413 | } |
| 414 | |
| 415 | func WebhooksDiscordEditPost(c *context.Context, orCtx *orgRepoContext, f form.NewDiscordHook) { |
| 416 | c.Title("repo.settings.update_webhook") |
nothing calls this directly
no test coverage detected