mirror of
https://github.com/muety/wakapi.git
synced 2023-08-10 21:12:56 +03:00
fix: delete language mapping (resolve #143)
This commit is contained in:
parent
1f557d562f
commit
f73285160d
@ -319,13 +319,14 @@ func (h *SettingsHandler) actionDeleteLanguageMapping(w http.ResponseWriter, r *
|
|||||||
return http.StatusInternalServerError, "", "could not delete mapping"
|
return http.StatusInternalServerError, "", "could not delete mapping"
|
||||||
}
|
}
|
||||||
|
|
||||||
if mapping, err := h.languageMappingSrvc.GetById(uint(id)); err != nil || mapping == nil {
|
mapping, err := h.languageMappingSrvc.GetById(uint(id))
|
||||||
|
if err != nil || mapping == nil {
|
||||||
return http.StatusNotFound, "", "mapping not found"
|
return http.StatusNotFound, "", "mapping not found"
|
||||||
} else if mapping.UserID != user.ID {
|
} else if mapping.UserID != user.ID {
|
||||||
return http.StatusForbidden, "", "not allowed to delete mapping"
|
return http.StatusForbidden, "", "not allowed to delete mapping"
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := h.languageMappingSrvc.Delete(&models.LanguageMapping{ID: uint(id)}); err != nil {
|
if err := h.languageMappingSrvc.Delete(mapping); err != nil {
|
||||||
return http.StatusInternalServerError, "", "could not delete mapping"
|
return http.StatusInternalServerError, "", "could not delete mapping"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1 +1 @@
|
|||||||
1.24.7
|
1.24.8
|
||||||
|
Loading…
Reference in New Issue
Block a user