feat(cla): limit CLA sign button display to CL authors only#2027
Merged
Conversation
juanlou1217
commented
Mar 18, 2026
Contributor
- 在 MergeBox 组件中添加 author 参数,用于接收 CL 作者信息
- 新增 isClAuthor 判断逻辑,比对当前用户与 CL 作者
- 在 MergeSection 组件中添加 isClAuthor 属性,控制 CLA 签署按钮显示权限
- 修改 ConversationTab 组件,从 clDetail 中提取 author 并传递给 MergeBox
- CLA 签署按钮现在仅在 CLA 检查未通过且当前用户为 CL 作者时显示
- 在 MergeBox 组件中添加 author 参数,用于接收 CL 作者信息 - 新增 isClAuthor 判断逻辑,比对当前用户与 CL 作者 - 在 MergeSection 组件中添加 isClAuthor 属性,控制 CLA 签署按钮显示权限 - 修改 ConversationTab 组件,从 clDetail 中提取 author 并传递给 MergeBox - CLA 签署按钮现在仅在 CLA 检查未通过且当前用户为 CL 作者时显示
Contributor
There was a problem hiding this comment.
Pull request overview
This PR restricts the “Sign CLA” button in the CL merge UI so it only appears for the CL author when the CLA check is failing, aligning the UI with expected permissions around CLA signing.
Changes:
- Passes CL author information from
ConversationTabintoMergeBox. - Adds
isClAuthorgating logic inMergeBoxand forwards it toMergeSection. - Updates
MergeSectionto only render the “Sign CLA” button whenclaCheckfails and the viewer is the CL author.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| moon/apps/web/components/ClView/ConversationTab.tsx | Passes clDetail.author to MergeBox for author-based UI gating. |
| moon/apps/web/components/ClBox/MergeBox.tsx | Computes isClAuthor by comparing current user to passed author and forwards it to MergeSection. |
| moon/apps/web/components/ClBox/MergeSection.tsx | Adds isClAuthor prop and uses it to conditionally display the “Sign CLA” button. |
| <div className='w-full'> | ||
| {clDetail && (clDetail.status === 'Open' || clDetail.status === 'Draft') && ( | ||
| <MergeBox prId={id} status={clDetail.status} /> | ||
| <MergeBox prId={id} status={clDetail.status} author={clDetail.author} /> |
| const claCondition = additionalChecks.find((c) => c.type === CheckType.ClaSign) | ||
| const claCheck = claCondition ? claCondition.result === ConditionResult.PASSED : true | ||
|
|
||
| const isClAuthor = data?.username === author |
Comment on lines
+22
to
23
| export const MergeBox = React.memo<{ prId: string; status?: string; author?: string }>(({ prId, status, author }) => { | ||
| const { checks } = useMergeChecks(prId) |
benjamin-747
approved these changes
Mar 19, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.