func ToHook(repoLink string, w *models.Webhook) *api.Hook { config := map[string]string{ "url": w.URL, "content_type": w.ContentType.Name(), } if w.HookTaskType == models.SLACK { s := w.GetSlackHook() config["channel"] = s.Channel config["username"] = s.Username config["icon_url"] = s.IconURL config["color"] = s.Color } return &api.Hook{ ID: w.ID, Type: w.HookTaskType.Name(), URL: fmt.Sprintf("%s/settings/hooks/%d", repoLink, w.ID), Active: w.IsActive, Config: config, Events: w.EventsArray(), Updated: w.Updated, Created: w.Created, } }