mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-11-22 18:00:37 +01:00
Fixed #200
This commit is contained in:
parent
80055bde86
commit
87854c95a9
2 changed files with 13 additions and 1 deletions
|
@ -473,6 +473,10 @@ func NewLabel(l *Label) error {
|
|||
|
||||
// GetLabelById returns a label by given ID.
|
||||
func GetLabelById(id int64) (*Label, error) {
|
||||
if id <= 0 {
|
||||
return nil, ErrLabelNotExist
|
||||
}
|
||||
|
||||
l := &Label{Id: id}
|
||||
has, err := orm.Get(l)
|
||||
if err != nil {
|
||||
|
|
|
@ -742,7 +742,15 @@ func UpdateLabel(ctx *middleware.Context, params martini.Params, form auth.Creat
|
|||
}
|
||||
|
||||
func DeleteLabel(ctx *middleware.Context) {
|
||||
strIds := strings.Split(ctx.Query("remove"), ",")
|
||||
removes := ctx.Query("remove")
|
||||
if len(strings.TrimSpace(removes)) == 0 {
|
||||
ctx.JSON(200, map[string]interface{}{
|
||||
"ok": true,
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
strIds := strings.Split(removes, ",")
|
||||
for _, strId := range strIds {
|
||||
if err := models.DeleteLabel(ctx.Repo.Repository.Id, strId); err != nil {
|
||||
ctx.Handle(500, "issue.DeleteLabel(DeleteLabel)", err)
|
||||
|
|
Loading…
Reference in a new issue