MCPcopy Create free account
hub / github.com/gogs/gogs / WebhooksSlackEditPost

Function WebhooksSlackEditPost

internal/route/repo/webhook.go:387–413  ·  view source on GitHub ↗
(c *context.Context, orCtx *orgRepoContext, f form.NewSlackHook)

Source from the content-addressed store, hash-verified

385}
386
387func 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
415func WebhooksDiscordEditPost(c *context.Context, orCtx *orgRepoContext, f form.NewDiscordHook) {
416 c.Title("repo.settings.update_webhook")

Callers

nothing calls this directly

Calls 7

loadWebhookFunction · 0.85
stringFunction · 0.85
toHookEventFunction · 0.85
validateAndUpdateWebhookFunction · 0.85
TitleMethod · 0.80
PageIsMethod · 0.80
ErrorMethod · 0.45

Tested by

no test coverage detected