66 "fmt"
77 "net/http"
88 "slices"
9- "strings"
109 "sync"
1110 "time"
1211
@@ -556,7 +555,7 @@ func (g GitlabProvider) getToken(projectId int, name string) (string, error) {
556555 return resultToken .Token , nil
557556}
558557
559- func (g GitlabProvider ) ResetApprovals (projectId , mergeId int , updatedAt time. Time , config handlers.ResetApprovalsOnPush ) error {
558+ func (g GitlabProvider ) ResetApprovals (projectId , mergeId int , config handlers.ResetApprovalsOnPush ) error {
560559 logger .Debug ("gitlab resetApprovals" , "mergeId" , mergeId )
561560
562561 if config .IssueToken {
@@ -568,30 +567,16 @@ func (g GitlabProvider) ResetApprovals(projectId, mergeId int, updatedAt time.Ti
568567 g .client = newGitlabClient (token , gitlabURL )
569568 }
570569
571- for note := range g .listMergeRequestNotes (projectId , mergeId , getApprovalsSize , sortDesc ) {
572- if ! note .System {
573- continue
574- }
575-
576- if note .UpdatedAt .After (updatedAt ) {
577- continue
578- }
579-
580- if strings .Contains (note .Body , "commit" ) {
581- _ , err := g .client .MergeRequestApprovals .ResetApprovalsOfMergeRequest (projectId , mergeId )
582- if err != nil {
583- return err
584- }
585-
586- if err := g .LeaveComment (projectId , mergeId , approvalsResetMessage ); err != nil {
587- return err
588- }
570+ _ , err := g .client .MergeRequestApprovals .ResetApprovalsOfMergeRequest (projectId , mergeId )
571+ if err != nil {
572+ return err
573+ }
589574
590- return nil
591- }
575+ if err := g . LeaveComment ( projectId , mergeId , approvalsResetMessage ); err != nil {
576+ return err
592577 }
593578
594- return handlers . CommitNotFoundError
579+ return nil
595580}
596581
597582func newGitlabClient (token , instanceUrl string ) * gitlab.Client {
0 commit comments