Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@rjsparks
Copy link
Member

@rjsparks rjsparks commented Oct 2, 2025

No description provided.

@rjsparks rjsparks changed the title Ballotemail feat: preview ballot email before save Oct 2, 2025
@codecov
Copy link

codecov bot commented Oct 2, 2025

Codecov Report

❌ Patch coverage is 95.14563% with 5 lines in your changes missing coverage. Please review.
⚠️ Please upload report for BASE (feat/ballotemail@4be83ce). Learn more about missing BASE report.

Files with missing lines Patch % Lines
ietf/doc/views_ballot.py 95.14% 5 Missing ⚠️
Additional details and impacted files
@@                 Coverage Diff                 @@
##             feat/ballotemail    #9646   +/-   ##
===================================================
  Coverage                    ?   88.88%           
===================================================
  Files                       ?      319           
  Lines                       ?    41950           
  Branches                    ?        0           
===================================================
  Hits                        ?    37289           
  Misses                      ?     4661           
  Partials                    ?        0           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Member

@jennifer-richards jennifer-richards left a comment

Choose a reason for hiding this comment

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

Some minor refactoring / additional validation is suggested inline. No objection to accepting this as-is and cleaning up in a future PR, though.

if key not in post_data:
errors.append(f"{key} not found in post_data")
if len(errors) == 0:
person = Person.objects.filter(pk=post_data.get("balloter")).first()
Copy link
Member

Choose a reason for hiding this comment

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

Ideally should validate, at least for null characters, before using the parameters to build a query. Given the restricted access to this endpoint, it's not essential, but probably good practice. We have ietf.utils.validators.validate_no_nulls() for this purpose.

(Could also validate things through a form using data from the JSON body, but that is probably a distraction at this point)

discussToggle($("input[name=position]:checked").val());
</script>

<script>
Copy link
Member

Choose a reason for hiding this comment

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

Should probably refactor away from inline scripts

addrs, frm, subject, body = build_position_email_from_dict(wanted)

recipient_slugs = post_data.get("cc_choices")
# Consider refactoring gather_address_lists so this isn't duplicated from there
Copy link
Member

Choose a reason for hiding this comment

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

Seems worthwhile - it's just separating the "to" and "cc" gathering, I think? If that's all, it looks minor enough it could be included in this PR.

"errors": errors,
}
else:
wanted = dict() # consider named tuple instead
Copy link
Member

Choose a reason for hiding this comment

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

Don't object to this, but I think a dict is fine

@rjsparks
Copy link
Member Author

rjsparks commented Oct 8, 2025

I'd like to move this forward as is then - we can split some of the improvements into separate PRs, but the bigger energy should go into replacing the UX for balloting with Vue/Nuxt.

@rjsparks
Copy link
Member Author

rjsparks commented Oct 8, 2025

I'm going to retarget this to a feature branch and deploy that so the IESG can preview the change to their workflow.

@rjsparks rjsparks changed the base branch from main to feat/ballotemail October 8, 2025 18:37
@rjsparks rjsparks merged commit fad9fcc into ietf-tools:feat/ballotemail Oct 8, 2025
10 checks passed
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 12, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants