Download this file
| 1 | package equipo |
| 2 | |
| 3 | import ( |
| 4 | "context" |
| 5 | "net/http" |
| 6 | "strconv" |
| 7 | |
| 8 | "amadan.net/oficina/equipo/internal/equipo/chat" |
| 9 | ) |
| 10 | |
| 11 | func (a *application) saveAutonomySetting(w http.ResponseWriter, r *http.Request) { |
| 12 | a.chatActionTo(w, r, "/conversation/settings/autonomy", func(ctx context.Context, person string) error { |
| 13 | revision, err := strconv.ParseInt(r.FormValue("revision"), 10, 64) |
| 14 | if err != nil || revision < 0 { |
| 15 | return chat.ErrInvalid |
| 16 | } |
| 17 | return a.store.Chat().SetProjectAutonomy(ctx, person, r.FormValue("project"), r.FormValue("auto_merge_ci") == "on", r.FormValue("public_previews") == "on", revision, r.FormValue("auto_merge_sensitive") == "on") |
| 18 | }) |
| 19 | } |
| 20 | |