@@ -250,7 +250,7 @@ const getImageApprovalPolicyDetailsFromMaterialResult = (cdMaterialsResult): Ima
250250 const validGroups = userApprovalConfig . userGroups . map ( ( group ) => group . identifier )
251251
252252 // Have moved from Object.keys(imageApprovalUsersInfo) to approvalUsers since backend is not filtering out the users without approval
253- // TODO: This check should be on BE. Need to remove this once BE is updated
253+ // TODO: This check should be on BE. Need to remove this once BE is updated
254254 const usersList = approvalUsers . filter ( ( user ) => user !== DefaultUserKey . system )
255255 const groupIdentifierToUsersMap = usersList . reduce (
256256 ( acc , user ) => {
@@ -512,21 +512,18 @@ export function getWebhookEventsForEventId(eventId: string | number) {
512512 return get ( URL )
513513}
514514
515+ /**
516+ *
517+ * @param gitUrl Git URL of the repository
518+ * @param branchName Branch name
519+ * @returns URL to the branch in the Git repository
520+ */
515521export const getGitBranchUrl = ( gitUrl : string , branchName : string ) : string | null => {
516522 if ( ! gitUrl ) return null
517-
518523 const trimmedGitUrl = gitUrl . trim ( ) . replace ( / \/ $ / , '' ) // Remove any trailing slash
519-
520- switch ( true ) {
521- case trimmedGitUrl . includes ( GitProviderType . GITLAB ) :
522- return `${ trimmedGitUrl } /-/tree/${ branchName } `
523- case trimmedGitUrl . includes ( GitProviderType . GITHUB ) :
524- return `${ trimmedGitUrl } /tree/${ branchName } `
525- case trimmedGitUrl . includes ( GitProviderType . BITBUCKET ) :
526- return `${ trimmedGitUrl } /branch/${ branchName } `
527- case trimmedGitUrl . includes ( GitProviderType . AZURE ) :
528- return `${ trimmedGitUrl } /src/branch/${ branchName } `
529- default :
530- return null
531- }
532- }
524+ if ( trimmedGitUrl . includes ( GitProviderType . GITLAB ) ) return `${ trimmedGitUrl } /-/tree/${ branchName } `
525+ else if ( trimmedGitUrl . includes ( GitProviderType . GITHUB ) ) return `${ trimmedGitUrl } /tree/${ branchName } `
526+ else if ( trimmedGitUrl . includes ( GitProviderType . BITBUCKET ) ) return `${ trimmedGitUrl } /branch/${ branchName } `
527+ else if ( trimmedGitUrl . includes ( GitProviderType . AZURE ) ) return `${ trimmedGitUrl } /src/branch/${ branchName } `
528+ return null
529+ }
0 commit comments