-
Notifications
You must be signed in to change notification settings - Fork 12
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
base: main
Are you sure you want to change the base?
Add cla support #1026
Conversation
That looks good to me, feels like it's going the right way. |
Great, I'll keep going in that case. Currently wondering how to make a button actually update the CLA setting (and refresh the proposal). |
99a7835
to
98699ab
Compare
|
||
# TODO this takes a while | ||
# Can the proposal states be updated in the background? | ||
@user.proposed.each do |pr| |
There was a problem hiding this comment.
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.)
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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 :)
@Floppy I think it's mostly working now- probably needs some tests though!! |
a95b93d
to
72389df
Compare
There was a problem hiding this 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? |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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...
There was a problem hiding this comment.
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!
app/models/proposal.rb
Outdated
@@ -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?) |
There was a problem hiding this comment.
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.
e651835
to
6b3b7be
Compare
Signed-off-by: James Taylor <[email protected]>
Signed-off-by: James Taylor [email protected]