Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add cla support #1026

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft

Add cla support #1026

wants to merge 1 commit into from

Conversation

jt-nti
Copy link
Collaborator

@jt-nti jt-nti commented Feb 15, 2021

Signed-off-by: James Taylor [email protected]

@jt-nti
Copy link
Collaborator Author

jt-nti commented Feb 15, 2021

Not finished yet but is this along the right lines for #72 @Floppy?

@Floppy
Copy link
Member

Floppy commented Feb 16, 2021

That looks good to me, feels like it's going the right way.

@jt-nti
Copy link
Collaborator Author

jt-nti commented Feb 16, 2021

Great, I'll keep going in that case. Currently wondering how to make a button actually update the CLA setting (and refresh the proposal).

@jt-nti jt-nti force-pushed the user-cla branch 3 times, most recently from 99a7835 to 98699ab Compare February 19, 2021 15:31

# TODO this takes a while
# Can the proposal states be updated in the background?
@user.proposed.each do |pr|
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Floppy any idea how to make this happen in the background or is it not worth worrying about? (There's a noticeable delay, especially if you have lots of PRs open but that's unlikely in normal circumstances I guess.)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, there's a background job runner that will do it. If you do UpdateProposalJob.perform_later pr.number I think that will work.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, that was a lot easier than I was expecting! Thanks.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Helps that I had basically the exact same problem a while back :)

@jt-nti
Copy link
Collaborator Author

jt-nti commented Feb 19, 2021

@Floppy I think it's mostly working now- probably needs some tests though!!

@jt-nti jt-nti force-pushed the user-cla branch 4 times, most recently from a95b93d to 72389df Compare February 22, 2021 20:54
Copy link
Member

@Floppy Floppy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks very nice. Made a few suggestions around DRYing up the code a little, but in general this looks great :)

@@ -20,6 +20,10 @@ def show
# Get activity list
presenter = ProposalPresenter.new(@proposal)
@activity = presenter.activity_log
# Does the proposer still need to sign the CLA?
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As this is in both here and the edit controller, it feels like it could be pushed into the User model?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That was bugging me as well, I'll move it

set_build_status(:pending, I18n.t("build_status.cla.pending"), status)
end
else
set_build_status(:success, I18n.t("build_status.cla.none"), status)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to set the build status at all if there's no CLA? Probably not...

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea, I hadn't thought of just not adding it, doh!

@@ -90,7 +98,7 @@ def closed_state
def open_state
return nil if pr_closed?
return "dead" if too_old?
return "blocked" if blocked?
return "blocked" if blocked? || (cla_required? && !cla_accepted?)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This logic happens quite a lot. I feel like there's a combined method like User#needs_to_sign_cla? that would reduce the places where both have to be checked.

@jt-nti jt-nti force-pushed the user-cla branch 2 times, most recently from e651835 to 6b3b7be Compare February 24, 2021 21:47
Signed-off-by: James Taylor <[email protected]>
Base automatically changed from master to main March 2, 2021 09:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants