Skip to content

Add Co-applicants feature to submissions#4492

Merged
frjo merged 19 commits into
mainfrom
enhancement/gh-3919-co-applicant-feature
May 22, 2025
Merged

Add Co-applicants feature to submissions#4492
frjo merged 19 commits into
mainfrom
enhancement/gh-3919-co-applicant-feature

Conversation

@sandeepsajan0

@sandeepsajan0 sandeepsajan0 commented Apr 10, 2025

Copy link
Copy Markdown
Member

Fixes #3919

Applicant UI, default open
image

Invite co-applicant, (on click invite button).
image

Update roles, after accept
image

Staff UI, default collapsed.
image

Co-applicant UI, invite landing page
image

Invalid invite page

image

Test Steps

@frjo

frjo commented Apr 22, 2025

Copy link
Copy Markdown
Member

@sandeepsajan0 Add some sane max limit and ratelimit the feature. @frankduncan mentioned on a meeting today that they had issues with spammers etc. misusing the ability to create accounts.

Account creation is ratelimited and since this feature will be a way to create accounts we should rarelimit.

Adding a sane max number of co-applicants is a good precaution as well.

@wes-otf Maybe ten (10)?

@wes-otf

wes-otf commented Apr 22, 2025

Copy link
Copy Markdown
Contributor

yeah I think 10 would be perfect

@sandeepsajan0 sandeepsajan0 force-pushed the enhancement/gh-3919-co-applicant-feature branch from c55867f to be48f51 Compare April 24, 2025 07:09
@frjo frjo added Type: Feature This is something new (not an enhancement of an existing thing). Type: Minor Minor change, used in release drafter labels May 6, 2025
@frjo frjo changed the title Co-applicants feature Add Co-applicants feature to submissions May 6, 2025
@sandeepsajan0 sandeepsajan0 force-pushed the enhancement/gh-3919-co-applicant-feature branch from ed56b85 to 1bc2891 Compare May 12, 2025 12:34
@sandeepsajan0 sandeepsajan0 marked this pull request as ready for review May 14, 2025 09:51
@sandeepsajan0

sandeepsajan0 commented May 14, 2025

Copy link
Copy Markdown
Member Author

Add some sane max limit and ratelimit the feature. @frankduncan mentioned on a meeting today that they had issues with spammers etc. misusing the ability to create accounts.

@frjo We are creating users after the co-applicant accepts the invite, so we are safe from user creation spam.

Also, there is an env var for the max number of invites for a submission, so invite spam is also handled.

image

@sandeepsajan0 sandeepsajan0 requested review from frjo, theskumar and wes-otf and removed request for theskumar and wes-otf May 14, 2025 10:35
@wes-otf

wes-otf commented May 14, 2025

Copy link
Copy Markdown
Contributor

This functionality is so fantastic! Been playing with it a little bit locally today and will have a few tweaks, but overall really nice job!

@frjo frjo left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Works really well overall, nice! Some minor text changes.

{% if not can_accept %}
{% trans "But You can't accept this invite because you already hold a responsible position in" %} {{ ORG_SHORT_NAME }}
{% else %}
{% blocktrans %} Click on link if you want to accept it.{% endblocktrans %}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Remove space before "Click". Also add empty line after.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Updated

<div class="bg-gray-100 max-w-[70%] mx-auto mt-6 px-10 pt-6 pb-4 border border-gray-300 rounded-sm">
{% if is_valid %}
<p>{% trans "You've been invited to join the submission" %} "{{ invite.submission.title }}" {% trans "as a co-applicant with email" %} <i>{{ invite.invited_user_email }}</i>. {% trans "Please respond to the invitation by choosing accept or decline." %}</p>
<p>{% trans "If you accept, you’ll be automatically signed up or logged in and taken directly to" %} {% if two_factor_required %}{% trans "two factor authentication and then to" %} {% endif %} {% trans "the submission." %}</p>

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

"the application" instead of "the submission"

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Updated

{% if is_valid %}
<p>{% trans "You've been invited to join the submission" %} "{{ invite.submission.title }}" {% trans "as a co-applicant with email" %} <i>{{ invite.invited_user_email }}</i>. {% trans "Please respond to the invitation by choosing accept or decline." %}</p>
<p>{% trans "If you accept, you’ll be automatically signed up or logged in and taken directly to" %} {% if two_factor_required %}{% trans "two factor authentication and then to" %} {% endif %} {% trans "the submission." %}</p>
<p>{% trans "We recommend updating your profile after accepting the invite. You’ll also have the option to update your name and email in 'My account' section." %}</p>

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

These two sentences can be merged it to one I believe.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

updated

hx-target="#htmx-modal"
{% if object.co_applicant_invites.count >= invite_max_limit %}disabled title='{% trans "Max limit reached" %}'{% endif %}
role="button"
aria-label="{% trans "Invite CoApplicant" %}"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

User facing text should say "co-applicant".

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

updated

@wes-otf wes-otf left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

really nice work! all my changes were super minor things, the functionality seems great.

Comment on lines +4 to +8
<details {% if user.is_applicant %} open {% endif %}>
<summary class="flex gap-4 justify-between items-center">
<p class="flex items-center text-lg font-bold">
{% trans "Co-applicants" %}
{% heroicon_solid "chevron-down" size="16" class="w-4 h-4 ms-2" %}

@wes-otf wes-otf May 14, 2025

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
<details {% if user.is_applicant %} open {% endif %}>
<summary class="flex gap-4 justify-between items-center">
<p class="flex items-center text-lg font-bold">
{% trans "Co-applicants" %}
{% heroicon_solid "chevron-down" size="16" class="w-4 h-4 ms-2" %}
<details {% if user.is_applicant or not co_applicants %} open {% endif %} class="group">
<summary class="flex gap-4 justify-between items-center list-none">
<p class="flex items-center text-lg font-bold">
{% trans "Co-applicants" %}
{% heroicon_solid "chevron-down" size="16" class="rotate-90 w-4 h-4 ms-2 group-open:rotate-0" %}

This might make things a bit more intuitive - don't hide no applicants and have the chevron indicate when things are hidden

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

also might be nice to include the number of co-applicants next to the Co-applicants text just to get the idea at a glace

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Updated! It looks better. The number of co-applicants is also included there.

</div>
{% else %}
<div>
{% trans "No co-applicant yet" %}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
{% trans "No co-applicant yet" %}
{% trans "No co-applicants yet." %}

To be consistent with the other blocks

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

updated

Comment on lines +28 to +40
class="font-bold line-clamp-2"
href="{% url 'apply:submissions:edit_co_applicant' invite_pk=invite.id %}"
hx-get="{% url 'apply:submissions:edit_co_applicant' invite_pk=invite.id %}"
hx-target="#htmx-modal"
>
<div class="flex justify-between">
{% if invite.status == "accepted" %}
{{ invite.co_applicant.user }}
{% else %}
{{ invite.invited_user_email }}
{% endif %}

{% heroicon_solid "pencil" class="inline align-middle me-1" width=16 height=16 stroke_width=2 aria_hidden=true %}

@wes-otf wes-otf May 15, 2025

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
class="font-bold line-clamp-2"
href="{% url 'apply:submissions:edit_co_applicant' invite_pk=invite.id %}"
hx-get="{% url 'apply:submissions:edit_co_applicant' invite_pk=invite.id %}"
hx-target="#htmx-modal"
>
<div class="flex justify-between">
{% if invite.status == "accepted" %}
{{ invite.co_applicant.user }}
{% else %}
{{ invite.invited_user_email }}
{% endif %}
{% heroicon_solid "pencil" class="inline align-middle me-1" width=16 height=16 stroke_width=2 aria_hidden=true %}
class="font-bold line-clamp-2 group/coapplicant"
href="{% url 'apply:submissions:edit_co_applicant' invite_pk=invite.id %}"
hx-get="{% url 'apply:submissions:edit_co_applicant' invite_pk=invite.id %}"
hx-target="#htmx-modal"
>
<div class="flex justify-between">
{% if invite.status == "accepted" %}
{{ invite.co_applicant.user }}
{% else %}
{{ invite.invited_user_email }}
{% endif %}
{% heroicon_solid "pencil" class="hidden align-middle me-1 group-hover/coapplicant:inline" width=16 height=16 stroke_width=2 aria_hidden=true %}

I think @theskumar mentioned this in the last dev call but might make sense to keep this similar to the todo list's functionality and only show the edit button on hover.

(edited to not conflict w groups in this comment)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Updated

def handle_co_applicant_invite(self, source, related, **kwargs):
from hypha.apply.funds.utils import generate_invite_path

invited_user = User.objects.filter(email=related.invited_user_email).first()

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

if you're already querying for the existing user here it might be cool to pass their name to the template so they won't get something different in the salutation than their set name in Hypha. not mission critical though

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Updated. Using the invited user name if it exists, else the trimmed email name.

@wes-otf

wes-otf commented May 15, 2025

Copy link
Copy Markdown
Contributor

My last comment is for permissions I think it might make more sense to always allow commenting (both read only & editing) and maybe renaming read only to view?

@frjo frjo added Status: Needs testing Tickets that need testing/qa Status: Needs dev testing 🧑‍💻 Tasks that should be tested by the dev team and removed Status: Needs testing Tickets that need testing/qa Status: Needs dev testing 🧑‍💻 Tasks that should be tested by the dev team labels May 16, 2025
@sandeepsajan0 sandeepsajan0 force-pushed the enhancement/gh-3919-co-applicant-feature branch from 9f43d3e to c47fd00 Compare May 20, 2025 13:12
@sandeepsajan0

Copy link
Copy Markdown
Member Author

@frjo It is ready for testing.

My last comment is for permissions I think it might make more sense to always allow commenting (both read only & editing) and maybe renaming read only to view?

@wes-otf As I will work on the project part permissions, we can decide about it and use the same pattern for both.

@frjo frjo added Status: Needs testing Tickets that need testing/qa Status: Needs dev testing 🧑‍💻 Tasks that should be tested by the dev team labels May 20, 2025
@frjo frjo temporarily deployed to test-hypha-app May 20, 2025 15:34 Inactive
@frjo frjo removed Status: Needs testing Tickets that need testing/qa Status: Needs dev testing 🧑‍💻 Tasks that should be tested by the dev team labels May 22, 2025
@frjo frjo requested review from frjo and wes-otf May 22, 2025 07:58
@frjo frjo merged commit ddd37e6 into main May 22, 2025
12 checks passed
frjo pushed a commit that referenced this pull request Jun 7, 2025
@theskumar theskumar deleted the enhancement/gh-3919-co-applicant-feature branch July 20, 2025 09:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Type: Feature This is something new (not an enhancement of an existing thing). Type: Minor Minor change, used in release drafter

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Co-applicant functionality

3 participants