diff options
author | zeripath <art27@cantab.net> | 2022-01-26 22:09:07 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-01-26 22:09:07 +0000 |
commit | cada7202aa0e5766eb770f7d5c95e8483386adf1 (patch) | |
tree | 3ae727540403daba475042496c307fea1523f10d /models | |
parent | 0b331e2213e7b1efcc817dcd6be4d5e98a2c7b82 (diff) | |
download | gitea-cada7202aa0e5766eb770f7d5c95e8483386adf1.tar.gz gitea-cada7202aa0e5766eb770f7d5c95e8483386adf1.zip |
Only view milestones from current repo (#18414) (#18417)
Backport #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 <art27@cantab.net>
Diffstat (limited to 'models')
-rw-r--r-- | models/issue_milestone.go | 16 |
1 files changed, 0 insertions, 16 deletions
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() |