Fix resetting list, label & namespace colors

This commit is contained in:
kolaente 2020-06-15 11:32:07 +02:00
parent 47d7e713af
commit 24c1098736
Signed by untrusted user: konrad
GPG Key ID: F40E70337AB24C9B
3 changed files with 10 additions and 7 deletions

View File

@ -92,7 +92,14 @@ func (l *Label) Create(a web.Auth) (err error) {
// @Failure 500 {object} models.Message "Internal error"
// @Router /labels/{id} [put]
func (l *Label) Update() (err error) {
_, err = x.ID(l.ID).Update(l)
_, err = x.
ID(l.ID).
Cols(
"title",
"description",
"hex_color",
).
Update(l)
if err != nil {
return
}

View File

@ -460,13 +460,11 @@ func CreateOrUpdateList(list *List) (err error) {
"title",
"is_archived",
"identifier",
"hex_color",
}
if list.Description != "" {
colsToUpdate = append(colsToUpdate, "description")
}
if list.HexColor != "" {
colsToUpdate = append(colsToUpdate, "hex_color")
}
_, err = x.
ID(list.ID).

View File

@ -448,13 +448,11 @@ func (n *Namespace) Update() (err error) {
colsToUpdate := []string{
"name",
"is_archived",
"hex_color",
}
if n.Description != "" {
colsToUpdate = append(colsToUpdate, "description")
}
if n.HexColor != "" {
colsToUpdate = append(colsToUpdate, "hex_color")
}
// Do the actual update
_, err = x.