@ -471,12 +471,13 @@ func RegisterRoutes(m *macaron.Macaron) {
m . Get ( "/:username/:reponame/action/:action" , reqSignIn , context . RepoAssignment ( ) , repo . Action )
m . Get ( "/:username/:reponame/action/:action" , reqSignIn , context . RepoAssignment ( ) , repo . Action )
m . Group ( "/:username/:reponame" , func ( ) {
m . Group ( "/:username/:reponame" , func ( ) {
// FIXME: should use different URLs but mostly same logic for comments of issue and pull reuqest.
// So they can apply their own enable/disable logic on routers.
m . Group ( "/issues" , func ( ) {
m . Group ( "/issues" , func ( ) {
m . Combo ( "/new" , repo . MustEnableIssues ) . Get ( context . RepoRef ( ) , repo . NewIssue ) .
m . Combo ( "/new" , repo . MustEnableIssues ) . Get ( context . RepoRef ( ) , repo . NewIssue ) .
Post ( bindIgnErr ( auth . CreateIssueForm { } ) , repo . NewIssuePost )
Post ( bindIgnErr ( auth . CreateIssueForm { } ) , repo . NewIssuePost )
} , context . CheckUnit ( models . UnitTypeIssues ) )
// FIXME: should use different URLs but mostly same logic for comments of issue and pull reuqest.
// So they can apply their own enable/disable logic on routers.
m . Group ( "/issues" , func ( ) {
m . Group ( "/:index" , func ( ) {
m . Group ( "/:index" , func ( ) {
m . Post ( "/title" , repo . UpdateIssueTitle )
m . Post ( "/title" , repo . UpdateIssueTitle )
m . Post ( "/content" , repo . UpdateIssueContent )
m . Post ( "/content" , repo . UpdateIssueContent )
@ -484,21 +485,21 @@ func RegisterRoutes(m *macaron.Macaron) {
m . Combo ( "/comments" ) . Post ( bindIgnErr ( auth . CreateCommentForm { } ) , repo . NewComment )
m . Combo ( "/comments" ) . Post ( bindIgnErr ( auth . CreateCommentForm { } ) , repo . NewComment )
} )
} )
m . Post ( "/labels" , repo . UpdateIssueLabel , reqRepoWriter )
m . Post ( "/labels" , reqRepoWriter , re po . UpdateIssueLabel )
m . Post ( "/milestone" , repo . UpdateIssueMilestone , reqRepoWriter )
m . Post ( "/milestone" , reqRepoWriter , re po . UpdateIssueMilestone )
m . Post ( "/assignee" , repo . UpdateIssueAssignee , reqRepoWriter )
m . Post ( "/assignee" , reqRepoWriter , re po . UpdateIssueAssignee )
m . Post ( "/status" , repo . UpdateIssueStatus , reqRepoWriter )
m . Post ( "/status" , reqRepoWriter , re po . UpdateIssueStatus )
} , context . CheckUnit ( models . UnitTypeIssues ) )
} )
m . Group ( "/comments/:id" , func ( ) {
m . Group ( "/comments/:id" , func ( ) {
m . Post ( "" , repo . UpdateCommentContent )
m . Post ( "" , repo . UpdateCommentContent )
m . Post ( "/delete" , repo . DeleteComment )
m . Post ( "/delete" , repo . DeleteComment )
} , context . CheckUnit ( models . UnitTypeIssues ) )
} , context . CheckAny Unit ( models . UnitTypeIssues , models . UnitTypePullRequest s ) )
m . Group ( "/labels" , func ( ) {
m . Group ( "/labels" , func ( ) {
m . Post ( "/new" , bindIgnErr ( auth . CreateLabelForm { } ) , repo . NewLabel )
m . Post ( "/new" , bindIgnErr ( auth . CreateLabelForm { } ) , repo . NewLabel )
m . Post ( "/edit" , bindIgnErr ( auth . CreateLabelForm { } ) , repo . UpdateLabel )
m . Post ( "/edit" , bindIgnErr ( auth . CreateLabelForm { } ) , repo . UpdateLabel )
m . Post ( "/delete" , repo . DeleteLabel )
m . Post ( "/delete" , repo . DeleteLabel )
m . Post ( "/initialize" , bindIgnErr ( auth . InitializeLabelsForm { } ) , repo . InitializeLabels )
m . Post ( "/initialize" , bindIgnErr ( auth . InitializeLabelsForm { } ) , repo . InitializeLabels )
} , reqRepoWriter , context . RepoRef ( ) , context . CheckUnit ( models . UnitTypeIssues ) )
} , reqRepoWriter , context . RepoRef ( ) , context . CheckAny Unit ( models . UnitTypeIssues , models . UnitTypePullRequest s ) )
m . Group ( "/milestones" , func ( ) {
m . Group ( "/milestones" , func ( ) {
m . Combo ( "/new" ) . Get ( repo . NewMilestone ) .
m . Combo ( "/new" ) . Get ( repo . NewMilestone ) .
Post ( bindIgnErr ( auth . CreateMilestoneForm { } ) , repo . NewMilestonePost )
Post ( bindIgnErr ( auth . CreateMilestoneForm { } ) , repo . NewMilestonePost )
@ -506,7 +507,7 @@ func RegisterRoutes(m *macaron.Macaron) {
m . Post ( "/:id/edit" , bindIgnErr ( auth . CreateMilestoneForm { } ) , repo . EditMilestonePost )
m . Post ( "/:id/edit" , bindIgnErr ( auth . CreateMilestoneForm { } ) , repo . EditMilestonePost )
m . Get ( "/:id/:action" , repo . ChangeMilestonStatus )
m . Get ( "/:id/:action" , repo . ChangeMilestonStatus )
m . Post ( "/delete" , repo . DeleteMilestone )
m . Post ( "/delete" , repo . DeleteMilestone )
} , reqRepoWriter , context . RepoRef ( ) , context . CheckUnit ( models . UnitTypeIssues ) )
} , reqRepoWriter , context . RepoRef ( ) , context . CheckAny Unit ( models . UnitTypeIssues , models . UnitTypePullRequest s ) )
m . Combo ( "/compare/*" , repo . MustAllowPulls , repo . SetEditorconfigIfExists ) .
m . Combo ( "/compare/*" , repo . MustAllowPulls , repo . SetEditorconfigIfExists ) .
Get ( repo . CompareAndPullRequest ) .
Get ( repo . CompareAndPullRequest ) .
@ -573,8 +574,8 @@ func RegisterRoutes(m *macaron.Macaron) {
m . Group ( "" , func ( ) {
m . Group ( "" , func ( ) {
m . Get ( "/^:type(issues|pulls)$" , repo . RetrieveLabels , repo . Issues )
m . Get ( "/^:type(issues|pulls)$" , repo . RetrieveLabels , repo . Issues )
m . Get ( "/^:type(issues|pulls)$/:index" , repo . ViewIssue )
m . Get ( "/^:type(issues|pulls)$/:index" , repo . ViewIssue )
m . Get ( "/labels/" , repo . RetrieveLabels , repo . Labels )
m . Get ( "/labels/" , context . CheckAnyUnit ( models . UnitTypeIssues , models . UnitTypePullRequests ) , repo . RetrieveLabels , repo . Labels )
m . Get ( "/milestones" , repo . Milestones )
m . Get ( "/milestones" , context . CheckAnyUnit ( models . UnitTypeIssues , models . UnitTypePullRequests ) , repo . Milestones )
} , context . RepoRef ( ) )
} , context . RepoRef ( ) )
m . Group ( "/wiki" , func ( ) {
m . Group ( "/wiki" , func ( ) {