(Re)Load issue labels when changing them (#13007)

(Re)Load issue labels when labels are added or removed

This means that the label state that the webhooks produce accurately matches
the changes that they are reporting.

Fix #10660

Signed-off-by: Andrew Thornton <art27@cantab.net>
tokarchuk/v1.17
zeripath 4 years ago committed by GitHub
parent cda44750cb
commit 5e1c51cdb6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 5
      models/issue.go
  2. 15
      models/issue_label.go

@ -549,6 +549,11 @@ func (issue *Issue) ReplaceLabels(labels []*Label, doer *User) (err error) {
}
}
issue.Labels = nil
if err = issue.loadLabels(sess); err != nil {
return err
}
return sess.Commit()
}

@ -670,6 +670,11 @@ func NewIssueLabel(issue *Issue, label *Label, doer *User) (err error) {
return err
}
issue.Labels = nil
if err = issue.loadLabels(sess); err != nil {
return err
}
return sess.Commit()
}
@ -699,6 +704,11 @@ func NewIssueLabels(issue *Issue, labels []*Label, doer *User) (err error) {
return err
}
issue.Labels = nil
if err = issue.loadLabels(sess); err != nil {
return err
}
return sess.Commit()
}
@ -742,5 +752,10 @@ func DeleteIssueLabel(issue *Issue, label *Label, doer *User) (err error) {
return err
}
issue.Labels = nil
if err = issue.loadLabels(sess); err != nil {
return err
}
return sess.Commit()
}

Loading…
Cancel
Save