fix: TriggerNotify 按 CLA 类型触发,不再同时触发企业和个人两边#484
Conversation
- TriggerNotify(t) 只触发对应 CLA 类型的扫描器 - Update 中 SetPendingCLAForLink 仅企业 CLA 更新时标记 - 个人 CLA 更新 → 只通知个人,不标记企业 - 企业 CLA 更新 → 只通知企业,不触发个人扫描
Welcome To opensourceways CommunityHey @JavaPythonAIForBAT , thanks for your contribution to the community. Bot Usage ManualI'm the Bot here serving you. You can find the instructions on how to interact with me at Here . That means you can comment below every pull request or issue to trigger Bot Commands. Contact GuideIf you have any questions, please contact the SIG: infratructure , |
CLA Signature Guide@JavaPythonAIForBAT , thanks for your pull request. The following commit(s) are not associated with a signed Contributor License Agreement (CLA).
To sign CLA, click here. To check if your email is configured correctly, refer to the FAQs. Once you've signed the CLA or updating your email, please comment |
Linking Issue Notice@JavaPythonAIForBAT , the pull request must be linked to at least one issue. |
There was a problem hiding this comment.
Code Review
This pull request refactors the CLA update process to conditionally set pending CLAs and trigger notifications based on the CLA type (individual vs. corporate). Specifically, TriggerNotify now accepts a CLAType parameter to selectively trigger the corresponding notification scanner. The review feedback recommends simplifying the notification logic in TriggerNotify using an if-else structure and adding a defensive check to handle cases where the CLA type might be nil to prevent unintended corporate notifications.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
| if !dp.IsCLATypeIndividual(t) { | ||
| select { | ||
| case notifyAdminWatchInstance.corpTrigger <- struct{}{}: | ||
| default: | ||
| } | ||
| } | ||
| select { | ||
| case notifyAdminWatchInstance.individualTrigger <- struct{}{}: | ||
| default: | ||
| if dp.IsCLATypeIndividual(t) { | ||
| select { | ||
| case notifyAdminWatchInstance.individualTrigger <- struct{}{}: | ||
| default: | ||
| } | ||
| } |
There was a problem hiding this comment.
The current implementation evaluates dp.IsCLATypeIndividual(t) twice and lacks a safety check for when t is nil. If t is nil, it would unexpectedly trigger the corporate notification scanner because !dp.IsCLATypeIndividual(t) evaluates to true.
We can simplify this logic using an if-else structure and add a defensive check to ensure t is not nil before proceeding.
if t == nil {
return
}
if dp.IsCLATypeIndividual(t) {
select {
case notifyAdminWatchInstance.individualTrigger <- struct{}{}:
default:
}
} else {
select {
case notifyAdminWatchInstance.corpTrigger <- struct{}{}:
default:
}
}
|
|||||||||||||||
Summary
问题
TriggerNotify() 无条件同时触发企业和个人两个扫描器,更新个人 CLA 时也给所有企业发邮件。
修复
改动
2 files: signing/app/cla.go, signing/watch/notify_corp_admin.go