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

[GEN-233] Masquage de l’adresse email du prescripteur ou de l'employeur dans la page candidature pour le candidat #3961

Merged
merged 1 commit into from
Apr 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 15 additions & 11 deletions itou/templates/apply/includes/job_application_sender_info.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,21 @@
</li>
<li>
<small>Adresse e-mail</small>
<strong>{{ job_application.sender.email }}</strong>
<button class="btn-link"
data-bs-toggle="tooltip"
data-bs-placement="top"
data-bs-trigger="manual"
data-bs-title="Copié!"
data-it-clipboard-button="copy"
data-it-copy-to-clipboard="{{ job_application.sender.email }}"
{% matomo_event "candidature" "clic" "copied_sender_email" %}>
<i class="ri-file-copy-line"></i>
</button>
{% if request.user.is_job_seeker and job_application.sender_kind != SenderKind.JOB_SEEKER %}
<strong>Non communiquée</strong>
{% else %}
<strong>{{ job_application.sender.email }}</strong>
<button class="btn-link"
data-bs-toggle="tooltip"
data-bs-placement="top"
data-bs-trigger="manual"
data-bs-title="Copié!"
data-it-clipboard-button="copy"
data-it-copy-to-clipboard="{{ job_application.sender.email }}"
{% matomo_event "candidature" "clic" "copied_sender_email" %}>
<i class="ri-file-copy-line"></i>
</button>
{% endif %}
</li>

{% if job_application.sender_prescriber_organization %}
Expand Down
38 changes: 38 additions & 0 deletions tests/www/apply/test_process.py
Original file line number Diff line number Diff line change
Expand Up @@ -2741,6 +2741,44 @@ def test_details_for_jobseeker_geiq_with_prior_actions(client):
assertNotContains(response, delete_button)


def test_details_sender_email_display_for_job_seeker(client):
SENDER_EMAIL_HIDDEN = "<small>Adresse e-mail</small><strong>Non communiquée</strong>"

# Email hidden for prescriber
job_application = JobApplicationFactory(sent_by_authorized_prescriber_organisation=True)
job_seeker = job_application.job_seeker

client.force_login(job_seeker)

url = reverse("apply:details_for_jobseeker", kwargs={"job_application_id": job_application.pk})
response = client.get(url)
assertNotContains(
response, f"<small>Adresse e-mail</small><strong>{job_application.sender.email}</strong>", html=True
)
assertContains(response, SENDER_EMAIL_HIDDEN, html=True)

# Email hidden for employer
employer = job_application.to_company.members.first()
job_application.sender = employer
job_application.sender_kind = job_applications_enums.SenderKind.EMPLOYER
job_application.save(update_fields=["sender", "sender_kind"])
response = client.get(url)
assertNotContains(
response, f"<small>Adresse e-mail</small><strong>{job_application.sender.email}</strong>", html=True
)
assertContains(response, SENDER_EMAIL_HIDDEN, html=True)

# Email shown for job seeker
job_application.sender = job_seeker
job_application.sender_kind = job_applications_enums.SenderKind.JOB_SEEKER
job_application.save(update_fields=["sender", "sender_kind"])
response = client.get(url)
assertContains(
response, f"<small>Adresse e-mail</small><strong>{job_application.sender.email}</strong>", html=True
)
assertNotContains(response, SENDER_EMAIL_HIDDEN, html=True)


def test_accept_button(client):
job_application = JobApplicationFactory(
state=job_applications_enums.JobApplicationState.PROCESSING,
Expand Down