diff --git a/save-frontend/src/main/kotlin/com/saveourtool/save/frontend/components/views/vuln/VulnerabilityGeneralInfoProps.kt b/save-frontend/src/main/kotlin/com/saveourtool/save/frontend/components/views/vuln/VulnerabilityGeneralInfoProps.kt index c54ca3e187..21e80b082d 100644 --- a/save-frontend/src/main/kotlin/com/saveourtool/save/frontend/components/views/vuln/VulnerabilityGeneralInfoProps.kt +++ b/save-frontend/src/main/kotlin/com/saveourtool/save/frontend/components/views/vuln/VulnerabilityGeneralInfoProps.kt @@ -335,7 +335,7 @@ val vulnerabilityGeneralInfoProps: FC = FC { prop +"Contributors".t() } userBoard { - users = saveContributors + users = saveContributors.distinctBy { it.name } avatarOuterClasses = "col-2" } } @@ -348,8 +348,8 @@ val vulnerabilityGeneralInfoProps: FC = FC { prop className = ClassName("font-weight-bold text-primary-blue mb-4") +"Credits" } - cosv.credits!!.forEachIndexed { creditInd, credit -> - val userPrefix = if (credit.name in saveContributors.map { it.name }) "[SAVE] user" else "External user" + cosv.credits!!.mergeContactsForOneUser().forEachIndexed { creditInd, credit -> + val userPrefix = if (credit.name in saveContributors.map { it.name }) "[SAVE user]" else "[External user]" if (props.isEditDisabled) { div { className = ClassName("row ml-1") @@ -514,6 +514,14 @@ external interface VulnerabilityGeneralInfoProps : Props { var setSelectedMenu: StateSetter } +private fun List.mergeContactsForOneUser() = this + .groupBy { it.name }.map { entry -> + val name = entry.key + val contacts = entry.value.mapNotNull { it.contact }.flatten() + // suppose, that `credit type` is the same for credits with same name + Credit(name, contacts, entry.value.first().type) + } + /** * @param currentUserInfo * @param vulnerability