@@ -83,14 +83,19 @@ export const qcFlagDetailsComponent = (qcFlagDetailsModel, additionalDetailsConf
8383 }
8484 } ;
8585
86+ const { personid } = sessionService . get ( ) ;
87+
8688 /**
8789 * Function to send verification
88- *
90+ * @param {number } userId id of the current user
91+ * @param {number } flagCreatorId id of a flag creator
8992 * @return {void }
9093 */
91- const qcFlagVerificationSendHandler = ( ) => {
92- if ( confirm ( 'Verifying the flag by the same person who added the flag. \
93- A different person to verify the flag is encouraged. Do you want to continue?' ) ) {
94+ const qcFlagVerificationSendHandlerFabric = ( userId , flagCreatorId ) => ( ) => {
95+ const userQuestion = 'Verifying the flag by the same person who added the flag. \
96+ A different person to verify the flag is encouraged. Do you want to continue?' ;
97+
98+ if ( userId !== flagCreatorId || confirm ( userQuestion ) ) {
9499 verificationCreationModel . submit ( ) ;
95100 }
96101 } ;
@@ -197,7 +202,9 @@ A different person to verify the flag is encouraged. Do you want to continue?'))
197202 qcFlagDetailsModel . verificationEnabled = false ;
198203 } ) ,
199204 createButton (
200- verificationCreationModel . isValid ( ) ? qcFlagVerificationSendHandler : null ,
205+ verificationCreationModel . isValid ( )
206+ ? qcFlagVerificationSendHandlerFabric ( personid , qcFlag . createdBy . externalId )
207+ : null ,
201208 'Post verification' ,
202209 ) ,
203210 ] ,
@@ -206,7 +213,9 @@ A different person to verify the flag is encouraged. Do you want to continue?'))
206213 qcFlagDetailsModel . verificationEnabled = false ;
207214 } ) ,
208215 createButton (
209- verificationCreationModel . isValid ( ) ? qcFlagVerificationSendHandler : null ,
216+ verificationCreationModel . isValid ( )
217+ ? qcFlagVerificationSendHandlerFabric ( personid , qcFlag . createdBy . externalId )
218+ : null ,
210219 'Post verification' ,
211220 ) ,
212221 ] ,
0 commit comments