Skip to content
Merged
Show file tree
Hide file tree
Changes from 7 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
1 change: 1 addition & 0 deletions doc/release/RELEASE-NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ Also was added sanitization on the server side by using the `Django-Bleach` libr
* [OSDEV-1795](https://opensupplyhub.atlassian.net/browse/OSDEV-1795) - Resolved database connection issue after PostgreSQL 16.3 upgrade by upgrading pg8000 module version.
* [OSDEV-1803](https://opensupplyhub.atlassian.net/browse/OSDEV-1803) - Updated text from `Facility Type` to `Location Type` and `Facility Name` to `Location Name` on the SLC `Thank You for Your Submission` page.
* [OSDEV-1838](https://opensupplyhub.atlassian.net/browse/OSDEV-1838) - Fixed an issue where the router redirected to an unsupported page when the OS ID contained a forward slash. The fix was implemented by encoding the OS ID value using the `encodeURIComponent()` function before passing it as a URL parameter.
* [OSDEV-1827](https://opensupplyhub.atlassian.net/browse/OSDEV-1827) - Fixed the condition logic for the email template when approving a contribution to an existing production location that has either been claimed or has a pending claim request.

### What's new
* [OSDEV-1814](https://opensupplyhub.atlassian.net/browse/OSDEV-1814) - Added toggle switch button for production location info page to render additional data if necessary. If toggle switch button is inactive (default behavior), additional data won't be send to the server along with name, address and country.
Expand Down
22 changes: 10 additions & 12 deletions src/django/api/mail.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,15 +53,6 @@ def make_pl_search_url(request):
)


def make_pl_claim_url(request, facility):
return (
"{}/facilities/{}/claim".format(
make_oshub_url(request),
facility.id,
)
)


def send_claim_facility_confirmation_email(request, facility_claim):
subj_template = get_template('mail/claim_facility_submitted_subject.txt')
text_template = get_template('mail/claim_facility_submitted_body.txt')
Expand Down Expand Up @@ -530,7 +521,13 @@ def send_slc_contribution_approval_email(
'mail/slc_contribution_approval_body.html'
)

is_claimed = FacilityClaim.objects.filter(
has_contributor_claimed = FacilityClaim.objects.filter(
facility=facility_list_item.facility,
status=FacilityClaimStatuses.PENDING,
contributor=moderation_event.contributor
).exists()

has_anyone_claimed = FacilityClaim.objects.filter(
facility=facility_list_item.facility,
status__in=[
FacilityClaimStatuses.APPROVED,
Expand All @@ -539,8 +536,9 @@ def send_slc_contribution_approval_email(
).exists()

approval_dictionary = {
'is_claimed': is_claimed,
'pl_claim_url': make_pl_claim_url(
'has_contributor_claimed': has_contributor_claimed,
'has_anyone_claimed': has_anyone_claimed,
'pl_claim_url': make_claim_url(
request,
facility_list_item.facility
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
<li>Public link: {{ location_url }}</li>
</ul>
</li>
{% if not is_claimed %}
{% if not has_anyone_claimed %}
<li>
<p>
<b>Claim your production location</b> to take control of
Expand All @@ -42,7 +42,7 @@
</p>
</li>
</ol>
{% if is_claimed %}
{% if has_contributor_claimed %}
<p>
<b>We will now review the documents you submitted to <a href="https://info.opensupplyhub.org/resources/claim-a-facility">claim the location</a>
and either approve or deny the claim.</b> Review of claims typically takes 7 - 10 business days.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ You can now:
with clients and stakeholders:
- OS ID: {{ os_id }}
- Public link: {{ location_url }}
{% if not is_claimed %}
{% if not has_anyone_claimed %}
2. Claim your production location to take control of
your data and make it visible to more global partners. It’s free and only takes a few
steps! Claim my production location now ({{ pl_claim_url }}).
Expand All @@ -17,7 +17,7 @@ steps! Claim my production location now ({{ pl_claim_url }}).
2. Learn more about the OS ID and how to use it to advance your business in this Guide for Facilities (https://info.opensupplyhub.org/facilities).
{% endif %}

{% if is_claimed %}
{% if has_contributor_claimed %}
We will now review the documents you submitted to claim the location (https://info.opensupplyhub.org/resources/claim-a-facility)
and either approve or deny the claim. Review of claims typically takes 7 - 10 business days.
You will receive another email when this stage is complete.
Expand Down