Skip to content

Commit 0571ac0

Browse files
committed
chore: git info fix
1 parent a740210 commit 0571ac0

File tree

1 file changed

+32
-26
lines changed

1 file changed

+32
-26
lines changed

src/Shared/Components/GitCommitInfoGeneric/GitCommitInfoGeneric.tsx

Lines changed: 32 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ import { ReactComponent as Check } from '@Icons/ic-check-circle.svg'
2828
import { ReactComponent as Abort } from '@Icons/ic-abort.svg'
2929
import { SourceTypeMap, createGitCommitUrl, getGitBranchUrl } from '@Common/Common.service'
3030
import { stopPropagation } from '@Common/Helper'
31-
import { DATE_TIME_FORMATS } from '@Common/Constants'
31+
import { DATE_TIME_FORMATS, GitProviderType } from '@Common/Constants'
3232
import { ReactComponent as Tag } from '@Icons/ic-tag.svg'
3333
import { getLowerCaseObject, getWebhookDate } from '@Shared/Helpers'
3434
import { ReactComponent as Hash } from '@Icons/ic-hash.svg'
@@ -180,30 +180,38 @@ const GitCommitInfoGeneric = ({
180180
return null
181181
}
182182

183-
const renderPRInfoCard = () =>
184-
_isWebhook &&
185-
_webhookData.eventactiontype === WEBHOOK_EVENT_ACTION_TYPE.MERGED && (
186-
<div className="flex column left dc__gap-8">
187-
<div className="flex dc__content-space w-100">
188-
{renderPullRequestId(_webhookData.data['git url'])}
189-
{getCheckUncheckIcon()}
190-
</div>
191-
{renderWebhookTitle()}
192-
{renderBasicGitCommitInfoForWebhook(true)}
183+
const renderPRInfoCard = () => (
184+
<div className="flex column left dc__gap-8">
185+
<div className="flex dc__content-space w-100">
186+
{renderPullRequestId(_webhookData.data['git url'])}
187+
{getCheckUncheckIcon()}
193188
</div>
194-
)
189+
{renderWebhookTitle()}
190+
{renderBasicGitCommitInfoForWebhook(true)}
191+
</div>
192+
)
195193

196-
const renderTagInfoCard = () =>
197-
_isWebhook &&
198-
_webhookData.eventactiontype === WEBHOOK_EVENT_ACTION_TYPE.NON_MERGED && (
199-
<>
200-
<div className="flex left dc__content-space">
201-
{renderTagCreationId(_webhookData.data['target checkout'])}
202-
{getCheckUncheckIcon()}
203-
</div>
204-
{renderBasicGitCommitInfoForWebhook()}
205-
</>
206-
)
194+
const renderTagInfoCard = () => (
195+
<>
196+
<div className="flex left dc__content-space">
197+
{renderTagCreationId(_webhookData.data['target checkout'])}
198+
{getCheckUncheckIcon()}
199+
</div>
200+
{renderBasicGitCommitInfoForWebhook()}
201+
</>
202+
)
203+
204+
const renderWebhookGitInfoCard = () => {
205+
if (!_isWebhook) return null
206+
207+
const isMerged = _webhookData.eventactiontype === WEBHOOK_EVENT_ACTION_TYPE.MERGED
208+
209+
if (materialUrl.includes(GitProviderType.GITLAB)) {
210+
// TODO: This is a temporary fix for the issue where the eventActionType data incorrect
211+
return isMerged ? renderTagInfoCard() : renderPRInfoCard()
212+
}
213+
return isMerged ? renderPRInfoCard() : renderTagInfoCard()
214+
}
207215

208216
return (
209217
<div className="git-commit-info-generic__wrapper cn-9 fs-12">
@@ -277,9 +285,7 @@ const GitCommitInfoGeneric = ({
277285
</div>
278286
</>
279287
)}
280-
281-
{renderPRInfoCard()}
282-
{renderTagInfoCard()}
288+
{renderWebhookGitInfoCard()}
283289
</div>
284290
</div>
285291
)

0 commit comments

Comments
 (0)