forked from forgejo/forgejo
[REFACTOR] webhook slack endpoints
This commit is contained in:
parent
7e0965b02c
commit
6f00821f3d
4 changed files with 44 additions and 54 deletions
|
@ -481,33 +481,6 @@ func mSTeamsHookParams(ctx *context.Context) webhookParams {
|
|||
}
|
||||
}
|
||||
|
||||
// SlackHooksNewPost response for creating Slack webhook
|
||||
func SlackHooksNewPost(ctx *context.Context) {
|
||||
createWebhook(ctx, slackHookParams(ctx))
|
||||
}
|
||||
|
||||
// SlackHooksEditPost response for editing Slack webhook
|
||||
func SlackHooksEditPost(ctx *context.Context) {
|
||||
editWebhook(ctx, slackHookParams(ctx))
|
||||
}
|
||||
|
||||
func slackHookParams(ctx *context.Context) webhookParams {
|
||||
form := web.GetForm(ctx).(*forms.NewSlackHookForm)
|
||||
|
||||
return webhookParams{
|
||||
Type: webhook_module.SLACK,
|
||||
URL: form.PayloadURL,
|
||||
ContentType: webhook.ContentTypeJSON,
|
||||
WebhookForm: form.WebhookForm,
|
||||
Meta: &webhook_service.SlackMeta{
|
||||
Channel: strings.TrimSpace(form.Channel),
|
||||
Username: form.Username,
|
||||
IconURL: form.IconURL,
|
||||
Color: form.Color,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
// FeishuHooksNewPost response for creating Feishu webhook
|
||||
func FeishuHooksNewPost(ctx *context.Context) {
|
||||
createWebhook(ctx, feishuHookParams(ctx))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue