mirror of
https://codeberg.org/davrot/forgejo.git
synced 2025-05-28 12:00:01 +02:00
Fix wrong type on hooktask to convert typ from char(16) to varchar(16) (#14148)
* Fix wrong type on hooktask to convert typ from char(16) to varchar(16) * Fix bugs * Improve code * Use different trim function for MSSQL * Fix bug * Removed wrong changed line * Removed wrong changed line * Fix nullable * Fix lint * Ignore sqlite on migration * Fix mssql modify column failure * Move modifyColumn to migrations.go so that other migrate function could use it
This commit is contained in:
parent
d2ee1221cc
commit
9f73cae635
5 changed files with 114 additions and 8 deletions
|
@ -60,7 +60,7 @@ var (
|
|||
|
||||
// RegisterWebhook registers a webhook
|
||||
func RegisterWebhook(name string, webhook *webhook) {
|
||||
webhooks[models.HookTaskType(strings.TrimSpace(name))] = webhook
|
||||
webhooks[models.HookTaskType(name)] = webhook
|
||||
}
|
||||
|
||||
// IsValidHookTaskType returns true if a webhook registered
|
||||
|
@ -68,7 +68,7 @@ func IsValidHookTaskType(name string) bool {
|
|||
if name == models.GITEA || name == models.GOGS {
|
||||
return true
|
||||
}
|
||||
_, ok := webhooks[models.HookTaskType(strings.TrimSpace(name))]
|
||||
_, ok := webhooks[models.HookTaskType(name)]
|
||||
return ok
|
||||
}
|
||||
|
||||
|
@ -147,7 +147,7 @@ func prepareWebhook(w *models.Webhook, repo *models.Repository, event models.Hoo
|
|||
|
||||
var payloader api.Payloader
|
||||
var err error
|
||||
webhook, ok := webhooks[strings.TrimSpace(w.Type)] // NOTICE: w.Type maynot be trimmed before store into database
|
||||
webhook, ok := webhooks[w.Type]
|
||||
if ok {
|
||||
payloader, err = webhook.payloadCreator(p, event, w.Meta)
|
||||
if err != nil {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue