Skip to content

Commit

Permalink
(Re)Load issue labels when changing them (#13007)
Browse files Browse the repository at this point in the history
(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>
  • Loading branch information
zeripath authored Oct 5, 2020
1 parent cda4475 commit 5e1c51c
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
5 changes: 5 additions & 0 deletions models/issue.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}

Expand Down
15 changes: 15 additions & 0 deletions models/issue_label.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}

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

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

0 comments on commit 5e1c51c

Please sign in to comment.