@@ -56,7 +56,14 @@ class ReviewAnalyzer {
56
56
const map = new Map ( ) ;
57
57
const collaborators = this . collaborators ;
58
58
const list = this . reviews
59
- . filter ( ( r ) => r . state !== PENDING || this . isApprovedInComment ( r ) )
59
+ . filter ( ( r ) => r . state !== PENDING )
60
+ . filter ( ( r ) => {
61
+ if ( r . state === COMMENTED ) {
62
+ return this . isApprovedInComment ( r ) ;
63
+ } else {
64
+ return true ;
65
+ }
66
+ } )
60
67
. filter ( ( r ) => {
61
68
return ( isCollaborator ( collaborators , r . author ) ) ;
62
69
} ) . sort ( ( a , b ) => {
@@ -84,7 +91,7 @@ class ReviewAnalyzer {
84
91
case COMMENTED :
85
92
map . set (
86
93
login ,
87
- new Review ( r . state , r . publishedAt , r . bodyText , FROM_REVIEW_COMMENT )
94
+ new Review ( APPROVED , r . publishedAt , r . bodyText , FROM_REVIEW_COMMENT )
88
95
) ;
89
96
break ;
90
97
case DISMISSED :
@@ -104,7 +111,7 @@ class ReviewAnalyzer {
104
111
updateMapByRawReviews ( oldMap ) {
105
112
const comments = this . comments ;
106
113
const collaborators = this . collaborators ;
107
- const withLgtm = comments . filter ( ( c ) => this . hasLGTM ( c , 'bodyText' ) )
114
+ const withLgtm = comments . filter ( ( c ) => this . hasLGTM ( c ) )
108
115
. filter ( ( c ) => {
109
116
return ( isCollaborator ( collaborators , c . author ) ) ;
110
117
} ) . sort ( ( a , b ) => {
@@ -139,7 +146,7 @@ class ReviewAnalyzer {
139
146
const collaborators = this . collaborators ;
140
147
for ( const [ login , review ] of reviewers ) {
141
148
const reviewer = collaborators . get ( login . toLowerCase ( ) ) ;
142
- if ( review . state === APPROVED || this . isApprovedInComment ( review ) ) {
149
+ if ( review . state === APPROVED ) {
143
150
result . approved . push ( { reviewer, review} ) ;
144
151
} else if ( review . state === CHANGES_REQUESTED ) {
145
152
result . rejected . push ( { reviewer, review } ) ;
@@ -153,16 +160,16 @@ class ReviewAnalyzer {
153
160
* @returns {boolean }
154
161
*/
155
162
isApprovedInComment ( review ) {
156
- return review . state === COMMENTED && this . hasLGTM ( review , 'ref' ) ;
163
+ return review . state === COMMENTED && this . hasLGTM ( review ) ;
157
164
}
158
165
159
166
/**
160
167
* @param object
161
168
* @param prop: string
162
169
* @returns {boolean }
163
170
*/
164
- hasLGTM ( object , prop ) {
165
- return LGTM_RE . test ( object [ prop ] . trim ( ) ) ;
171
+ hasLGTM ( object ) {
172
+ return LGTM_RE . test ( object . bodyText . trim ( ) ) ;
166
173
}
167
174
}
168
175
0 commit comments