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

Improve directory filtering to exclude archived providers #616

Merged
merged 18 commits into from
Aug 28, 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
4 changes: 3 additions & 1 deletion ansible/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
# - app2.thegreenwebfoundation.org
# - app3.thegreenwebfoundation.org
# - app4.thegreenwebfoundation.org
- app_servers
# - app5.thegreenwebfoundation.org

# - app_servers
# api servers are app1, app2, and app4, mainly serving API traffic
# - api_servers
# admin server is app3, mainly serving member portal traffic
Expand Down
9 changes: 5 additions & 4 deletions ansible/see_command_output.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,11 @@

hosts:
# - all
- app1.thegreenwebfoundation.org
- app2.thegreenwebfoundation.org
- app3.thegreenwebfoundation.org
- app4.thegreenwebfoundation.org
# - app1.thegreenwebfoundation.org
# - app2.thegreenwebfoundation.org
# - app3.thegreenwebfoundation.org
# - app4.thegreenwebfoundation.org
# - app5.thegreenwebfoundation.org

remote_user: deploy
vars:
Expand Down
36 changes: 17 additions & 19 deletions apps/accounts/admin_site.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@
from django.shortcuts import render
from django.urls import path, reverse
from django.views.generic.edit import FormView
from waffle import flag_is_active
from waffle.mixins import WaffleFlagMixin


from apps.greencheck.views import GreenUrlsView

Expand Down Expand Up @@ -89,11 +88,10 @@ def clean(self):
)


class CarbonTxtCheckView(LoginRequiredMixin, WaffleFlagMixin, FormView):
class CarbonTxtCheckView(LoginRequiredMixin, FormView):
template_name = "carbon_txt_preview.html"
form_class = CarbonTxtForm
success_url = "/admin/carbon-txt-preview"
waffle_flag = "carbon_txt_preview"

def form_valid(self, form):
"""Show the valid"""
Expand Down Expand Up @@ -240,21 +238,21 @@ def get_app_list(self, request, app_label=None):
if app_label:
return app_list

if flag_is_active(request, "provider_request"):
verification_request_item = {
"name": "New provider portal",
"app_label": "greencheck",
"app_url": reverse("provider_portal_home"),
"models": [
{
"name": "Move to a new version of provider portal",
"object_name": "greencheck_url",
"admin_url": reverse("provider_portal_home"),
"view_only": True,
}
],
}
app_list.insert(0, verification_request_item)

verification_request_item = {
"name": "New provider portal",
"app_label": "greencheck",
"app_url": reverse("provider_portal_home"),
"models": [
{
"name": "Move to a new version of provider portal",
"object_name": "greencheck_url",
"admin_url": reverse("provider_portal_home"),
"view_only": True,
}
],
}
app_list.insert(0, verification_request_item)

app_list += [
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,15 @@
</p>
<h4>What happens next?</h4>
<p>
We aim to review every
We review
{% if provider %}
{% comment %} If it's an update to an existing provider. {% endcomment %}
update
provider updates
{% else %}
{% comment %} If it's a new provider request. {% endcomment %}
new verification request
new verification requests
{% endif %}
within 3 working days. Once we have reviewed the verification request, we will contact you by email to let you know that it is approved, or that we need more information from you.
on Tuesday each week. Once we have reviewed the request, we will contact you by email to let you know that it is approved, or that we need more information from you.
</p>
<p>
If you have further questions, or need to edit your verification request, please contact <a href="mailto:[email protected]">[email protected]</a>.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Thank you for taking the time to {% if provider %}update the listing for {{ prov
{% endif %}
{{ link_to_verification_request }}
What happens next?
We aim to review every {% if provider %}update{% else %} new verification request{% endif %} within 3 working days. Once we have reviewed the verification request, we will contact you by email to let you know that it is approved, or that we need more information from you.
We review {% if provider %}provider updates{% else %}new verification requests{% endif %} on Tuesday each week. Once we have reviewed the request, we will contact you by email to let you know that it is approved, or that we need more information from you.
If you have further questions, or need to edit your verification request, please contact [email protected].
Many thanks,
Green Web Foundation
4 changes: 2 additions & 2 deletions apps/accounts/templates/provider_portal/before_starting.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{% extends 'base.html' %}

{% load i18n static humanize widget_tweaks tailwind_filters waffle_tags %}
{% load i18n static humanize widget_tweaks tailwind_filters %}

{% block content %}

Expand Down Expand Up @@ -38,4 +38,4 @@ <h3 class="font-bold text-xl uppercase mt-12">Ready?</h3>

</div>

{% endblock %}
{% endblock %}
3 changes: 2 additions & 1 deletion apps/accounts/templates/provider_portal/request_detail.html
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ <h1 class="text-6xl mb-0"><span class="uppercase">Summary of request</h1>
{% endif %}

{% if object.status|lower == "pending review" %}
We are currently reviewing this request. If you want to update the information relating to this provider, please get in touch using <a target="_blank" rel="noopener noreferrer" href="https://www.thegreenwebfoundation.org/support-form/">our support form</a>.
We are currently reviewing this request. All verification requests and updates are reviewed by a member of our team on Tuesday each week. <br/>
If you want to update the information relating to this provider, please get in touch using <a target="_blank" rel="noopener noreferrer" href="https://www.thegreenwebfoundation.org/support-form/">our support form</a>.
{% endif %}


Expand Down
6 changes: 1 addition & 5 deletions apps/accounts/tests/test_provider_portal.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,12 @@
from ..factories import ProviderRequestFactory, ProviderRequestLocationFactory
from django.test import RequestFactory
from django.urls import reverse
from waffle.testutils import override_flag


import pytest


@pytest.mark.django_db
@override_flag("provider_request", active=True)
def test_provider_portal_home_view_displays_only_authored_requests(client):
# given: 3 provider requests exist, created by different users
pr1 = ProviderRequestFactory.create()
Expand All @@ -30,7 +29,6 @@ def test_provider_portal_home_view_displays_only_authored_requests(client):


@pytest.mark.django_db
@override_flag("provider_request", active=True)
def test_provider_portal_home_view_returns_only_unapproved_requests(client):
# given: 1 pending verification request
pr1 = ProviderRequestFactory.create(status=ProviderRequestStatus.PENDING_REVIEW)
Expand All @@ -56,7 +54,6 @@ def test_provider_portal_home_view_returns_only_unapproved_requests(client):


@pytest.mark.django_db
@override_flag("provider_request", active=True)
def test_provider_portal_home_view_filters_out_removed_requests(client):
# given: 1 removed verification request
removed_request = ProviderRequestFactory.create(
Expand Down Expand Up @@ -84,7 +81,6 @@ def test_provider_portal_home_view_filters_out_removed_requests(client):


@pytest.mark.django_db
@override_flag("provider_request", active=True)
def test_provider_portal_home_view_items_sorted_by_name(client):
# given: 3 pending verification requests
pr1 = ProviderRequestFactory.create(status=ProviderRequestStatus.PENDING_REVIEW)
Expand Down
24 changes: 0 additions & 24 deletions apps/accounts/tests/test_provider_request.py
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,6 @@ def test_staff_can_access_admin(greenweb_staff_user, client):


@pytest.mark.django_db
@override_flag("provider_request", active=True)
def test_detail_view_accessible_by_creator(client):
# given: provider request exists
pr = ProviderRequestFactory.create()
Expand All @@ -269,7 +268,6 @@ def test_detail_view_accessible_by_creator(client):


@pytest.mark.django_db
@override_flag("provider_request", active=True)
def test_detail_view_accessible_by_admin(client, greenweb_staff_user):
# given: provider request exists
pr = ProviderRequestFactory.create()
Expand All @@ -284,7 +282,6 @@ def test_detail_view_accessible_by_admin(client, greenweb_staff_user):


@pytest.mark.django_db
@override_flag("provider_request", active=True)
def test_detail_view_forbidden_for_others(client, user):
# given: provider request exists
pr = ProviderRequestFactory.create()
Expand All @@ -298,7 +295,6 @@ def test_detail_view_forbidden_for_others(client, user):


@pytest.mark.django_db
@override_flag("provider_request", active=True)
def test_wizard_view_happy_path(
user,
client,
Expand Down Expand Up @@ -364,7 +360,6 @@ def _create_provider_request(client, form_data) -> HttpResponse:


@pytest.mark.django_db
@override_flag("provider_request", active=True)
def test_wizard_sends_email_on_submission(
user,
client,
Expand Down Expand Up @@ -940,7 +935,6 @@ def test_approve_skips_duplicate_evidence_when_existing_evidence_updated(


@pytest.mark.django_db
@override_flag("provider_request", active=True)
def test_wizard_view_with_just_network_explanation(
user,
client,
Expand Down Expand Up @@ -983,7 +977,6 @@ def test_wizard_view_with_just_network_explanation(


@pytest.mark.django_db
@override_flag("provider_request", active=True)
def test_wizard_records_if_location_import_needed(
user,
client,
Expand Down Expand Up @@ -1025,7 +1018,6 @@ def test_wizard_records_if_location_import_needed(


@pytest.mark.django_db
@override_flag("provider_request", active=True)
def test_new_submission_doesnt_modify_available_services(
user,
client,
Expand Down Expand Up @@ -1065,7 +1057,6 @@ def test_new_submission_doesnt_modify_available_services(


@pytest.mark.django_db
@override_flag("provider_request", active=True)
def test_edit_view_accessible_by_creator(client):
# given: an open provider request
pr = ProviderRequestFactory.create()
Expand All @@ -1079,7 +1070,6 @@ def test_edit_view_accessible_by_creator(client):


@pytest.mark.django_db
@override_flag("provider_request", active=True)
def test_edit_view_accessible_by_admin(client, greenweb_staff_user):
# given: an open provider request
pr = ProviderRequestFactory.create()
Expand All @@ -1093,7 +1083,6 @@ def test_edit_view_accessible_by_admin(client, greenweb_staff_user):


@pytest.mark.django_db
@override_flag("provider_request", active=True)
def test_edit_view_inaccessible_by_other_users(client, user):
# given: an open provider request
pr = ProviderRequestFactory.create()
Expand All @@ -1107,7 +1096,6 @@ def test_edit_view_inaccessible_by_other_users(client, user):


@pytest.mark.django_db
@override_flag("provider_request", active=True)
@pytest.mark.parametrize(
"request_status,status_code",
[
Expand All @@ -1130,7 +1118,6 @@ def test_edit_view_accessible_for_given_status(client, request_status, status_co


@pytest.mark.django_db
@override_flag("provider_request", active=True)
def test_edit_view_displays_form_with_prepopulated_data(client):
# given: an open provider request
pr = ProviderRequestFactory.create()
Expand All @@ -1154,7 +1141,6 @@ def test_edit_view_displays_form_with_prepopulated_data(client):


@pytest.mark.django_db
@override_flag("provider_request", active=True)
def test_editing_pr_updates_original_submission(
client,
wizard_form_org_details_data,
Expand Down Expand Up @@ -1339,7 +1325,6 @@ def test_editing_pr_updates_original_submission(


@pytest.mark.django_db
@override_flag("provider_request", active=True)
def test_provider_edit_view_accessible_by_user_with_required_perms(
client, hosting_provider_with_sample_user, sample_hoster_user
):
Expand All @@ -1355,7 +1340,6 @@ def test_provider_edit_view_accessible_by_user_with_required_perms(


@pytest.mark.django_db
@override_flag("provider_request", active=True)
def test_provider_edit_view_accessible_by_admins(
client, hosting_provider_with_sample_user, greenweb_staff_user
):
Expand All @@ -1371,7 +1355,6 @@ def test_provider_edit_view_accessible_by_admins(


@pytest.mark.django_db
@override_flag("provider_request", active=True)
def test_provider_edit_view_inaccessible_by_unauthorized_users(
client, hosting_provider_with_sample_user
):
Expand All @@ -1390,7 +1373,6 @@ def test_provider_edit_view_inaccessible_by_unauthorized_users(


@pytest.mark.django_db
@override_flag("provider_request", active=True)
def test_edit_view_inaccessible_for_nonexistent_provider(client, greenweb_staff_user):
client.force_login(greenweb_staff_user)
response = client.get(urls.reverse("provider_edit", args=[str(123456)]))
Expand All @@ -1400,7 +1382,6 @@ def test_edit_view_inaccessible_for_nonexistent_provider(client, greenweb_staff_


@pytest.mark.django_db
@override_flag("provider_request", active=True)
def test_editing_hp_creates_new_verification_request(
client,
hosting_provider_with_sample_user,
Expand Down Expand Up @@ -1578,7 +1559,6 @@ def test_editing_hp_creates_new_verification_request(


@pytest.mark.django_db
@override_flag("provider_request", active=True)
def test_saving_changes_to_verification_request_from_hp_via_wizard(
client,
hosting_provider_with_sample_user,
Expand Down Expand Up @@ -1795,7 +1775,6 @@ def test_saving_changes_to_verification_request_from_hp_via_wizard(


@pytest.mark.django_db
@override_flag("provider_request", active=True)
def test_saving_changes_to_hp_with_new_verification_request(
client,
hosting_provider_with_sample_user,
Expand Down Expand Up @@ -2090,7 +2069,6 @@ def test_request_from_host_provider_finishes_in_sensible_time():
),
),
)
@override_flag("provider_request", active=True)
def test_email_sent_on_approval(
hosting_provider_with_sample_user,
greenweb_staff_user,
Expand Down Expand Up @@ -2175,7 +2153,6 @@ def test_email_sent_on_approval(
),
),
)
@override_flag("provider_request", active=True)
def test_email_request_email_confirmation_is_sent(
hosting_provider_with_sample_user,
greenweb_staff_user,
Expand Down Expand Up @@ -2252,7 +2229,6 @@ def test_email_request_email_confirmation_is_sent(
("open", "Changes Requested"),
),
)
@override_flag("provider_request", active=True)
def test_staff_review_is_logged(
hosting_provider_with_sample_user,
greenweb_staff_user,
Expand Down
Loading
Loading