(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>
This commit is contained in:
zeripath 2020-10-05 07:49:11 +01:00 committed by GitHub
parent cda44750cb
commit 5e1c51cdb6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 20 additions and 0 deletions

View file

@ -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()
}

View file

@ -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()
}