From 9a75c2741d2806f5bb12d21b5a9d7387b2d44073 Mon Sep 17 00:00:00 2001 From: zeripath Date: Wed, 26 Jan 2022 20:01:35 +0000 Subject: Only view milestones from current repo (#18414) The endpoint /{username}/{reponame}/milestone/{id} is not currently restricted to the repo. This PR restricts the milestones to those within the repo. Signed-off-by: Andrew Thornton --- models/issue_milestone.go | 16 ---------------- 1 file changed, 16 deletions(-) (limited to 'models') diff --git a/models/issue_milestone.go b/models/issue_milestone.go index 7f2fd9a1f3..a321718513 100644 --- a/models/issue_milestone.go +++ b/models/issue_milestone.go @@ -134,22 +134,6 @@ func GetMilestoneByRepoIDANDName(repoID int64, name string) (*Milestone, error) return &mile, nil } -// GetMilestoneByID returns the milestone via id . -func GetMilestoneByID(id int64) (*Milestone, error) { - return getMilestoneByID(db.GetEngine(db.DefaultContext), id) -} - -func getMilestoneByID(e db.Engine, id int64) (*Milestone, error) { - var m Milestone - has, err := e.ID(id).Get(&m) - if err != nil { - return nil, err - } else if !has { - return nil, ErrMilestoneNotExist{ID: id, RepoID: 0} - } - return &m, nil -} - // UpdateMilestone updates information of given milestone. func UpdateMilestone(m *Milestone, oldIsClosed bool) error { ctx, committer, err := db.TxContext() -- cgit v1.2.3