@@ -598,141 +598,3 @@ func UpdateIssueDeadline(ctx *context.APIContext, form api.EditDeadlineOption) {
598598
599599 ctx .JSON (201 , api.IssueDeadline {Deadline : & deadline })
600600}
601-
602- // StartIssueStopwatch creates a stopwatch for the given issue.
603- func StartIssueStopwatch (ctx * context.APIContext ) {
604- // swagger:operation POST /repos/{owner}/{repo}/issues/{index}/stopwatch/start issue issueStartStopWatch
605- // ---
606- // summary: Start stopwatch on an issue.
607- // consumes:
608- // - application/json
609- // produces:
610- // - application/json
611- // parameters:
612- // - name: owner
613- // in: path
614- // description: owner of the repo
615- // type: string
616- // required: true
617- // - name: repo
618- // in: path
619- // description: name of the repo
620- // type: string
621- // required: true
622- // - name: index
623- // in: path
624- // description: index of the issue to create the stopwatch on
625- // type: integer
626- // format: int64
627- // required: true
628- // responses:
629- // "201":
630- // "$ref": "#/responses/empty"
631- // "403":
632- // description: Not repo writer, user does not have rights to toggle stopwatch
633- // "404":
634- // description: Issue not found
635- // "409":
636- // description: Cannot start a stopwatch again if it already exists
637- issue , err := models .GetIssueByIndex (ctx .Repo .Repository .ID , ctx .ParamsInt64 (":index" ))
638- if err != nil {
639- if models .IsErrIssueNotExist (err ) {
640- ctx .NotFound ()
641- } else {
642- ctx .Error (500 , "GetIssueByIndex" , err )
643- }
644-
645- return
646- }
647-
648- if ! ctx .Repo .CanWrite (models .UnitTypeIssues ) {
649- ctx .Status (403 )
650- return
651- }
652-
653- if ! ctx .Repo .CanUseTimetracker (issue , ctx .User ) {
654- ctx .Status (403 )
655- return
656- }
657-
658- if models .StopwatchExists (ctx .User .ID , issue .ID ) {
659- ctx .Error (409 , "StopwatchExists" , "a stopwatch has already been started for this issue" )
660- return
661- }
662-
663- if err := models .CreateOrStopIssueStopwatch (ctx .User , issue ); err != nil {
664- ctx .Error (500 , "CreateOrStopIssueStopwatch" , err )
665- return
666- }
667-
668- ctx .Status (201 )
669- }
670-
671- // StopIssueStopwatch stops a stopwatch for the given issue.
672- func StopIssueStopwatch (ctx * context.APIContext ) {
673- // swagger:operation POST /repos/{owner}/{repo}/issues/{index}/stopwatch/stop issue issueStopWatch
674- // ---
675- // summary: Stop an issue's existing stopwatch.
676- // consumes:
677- // - application/json
678- // produces:
679- // - application/json
680- // parameters:
681- // - name: owner
682- // in: path
683- // description: owner of the repo
684- // type: string
685- // required: true
686- // - name: repo
687- // in: path
688- // description: name of the repo
689- // type: string
690- // required: true
691- // - name: index
692- // in: path
693- // description: index of the issue to stop the stopwatch on
694- // type: integer
695- // format: int64
696- // required: true
697- // responses:
698- // "201":
699- // "$ref": "#/responses/empty"
700- // "403":
701- // description: Not repo writer, user does not have rights to toggle stopwatch
702- // "404":
703- // description: Issue not found
704- // "409":
705- // description: Cannot stop a non existent stopwatch
706- issue , err := models .GetIssueByIndex (ctx .Repo .Repository .ID , ctx .ParamsInt64 (":index" ))
707- if err != nil {
708- if models .IsErrIssueNotExist (err ) {
709- ctx .NotFound ()
710- } else {
711- ctx .Error (500 , "GetIssueByIndex" , err )
712- }
713-
714- return
715- }
716-
717- if ! ctx .Repo .CanWrite (models .UnitTypeIssues ) {
718- ctx .Status (403 )
719- return
720- }
721-
722- if ! ctx .Repo .CanUseTimetracker (issue , ctx .User ) {
723- ctx .Status (403 )
724- return
725- }
726-
727- if ! models .StopwatchExists (ctx .User .ID , issue .ID ) {
728- ctx .Error (409 , "StopwatchExists" , "cannot stop a non existent stopwatch" )
729- return
730- }
731-
732- if err := models .CreateOrStopIssueStopwatch (ctx .User , issue ); err != nil {
733- ctx .Error (500 , "CreateOrStopIssueStopwatch" , err )
734- return
735- }
736-
737- ctx .Status (201 )
738- }
0 commit comments