MCPcopy Create free account
hub / github.com/gogs/gogs / ChangeMilestoneStatus

Function ChangeMilestoneStatus

internal/database/milestone.go:224–247  ·  view source on GitHub ↗

ChangeMilestoneStatus changes the milestone open/closed status. If milestone passes with changed values, those values will be updated to database as well.

(m *Milestone, isClosed bool)

Source from the content-addressed store, hash-verified

222// If milestone passes with changed values, those values will be
223// updated to database as well.
224func ChangeMilestoneStatus(m *Milestone, isClosed bool) (err error) {
225 repo, err := GetRepositoryByID(m.RepoID)
226 if err != nil {
227 return err
228 }
229
230 sess := x.NewSession()
231 defer sess.Close()
232 if err = sess.Begin(); err != nil {
233 return err
234 }
235
236 m.IsClosed = isClosed
237 if err = updateMilestone(sess, m); err != nil {
238 return err
239 }
240
241 repo.NumMilestones = int(countRepoMilestones(sess, repo.ID))
242 repo.NumClosedMilestones = int(countRepoClosedMilestones(sess, repo.ID))
243 if _, err = sess.ID(repo.ID).AllCols().Update(repo); err != nil {
244 return err
245 }
246 return sess.Commit()
247}
248
249func changeMilestoneIssueStats(e *xorm.Session, issue *Issue) error {
250 if issue.MilestoneID == 0 {

Callers 2

ChangeMilestonStatusFunction · 0.92
ChangeStatusMethod · 0.85

Calls 6

GetRepositoryByIDFunction · 0.85
updateMilestoneFunction · 0.85
countRepoMilestonesFunction · 0.85
UpdateMethod · 0.65
IDMethod · 0.65

Tested by

no test coverage detected