1
0
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:
Ferdinand Mütsch 2021-03-22 21:19:08 +01:00
parent 1f557d562f
commit f73285160d
2 changed files with 4 additions and 3 deletions

View File

@ -319,13 +319,14 @@ func (h *SettingsHandler) actionDeleteLanguageMapping(w http.ResponseWriter, r *
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"
} else if mapping.UserID != user.ID {
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"
}

View File

@ -1 +1 @@
1.24.7
1.24.8