Skip to content
This repository has been archived by the owner on Nov 20, 2024. It is now read-only.

UAT/Prod release #1009

Merged
merged 25 commits into from
Feb 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
5cd5716
Bump version of directory components
boxadesign Feb 8, 2024
5b60bdc
Update requirements
lewis-coulson-dit Feb 12, 2024
e6f2e54
Merge pull request #1006 from uktrade/KLS-1926-replace-og-image
hal274 Feb 12, 2024
c25776a
POLS-94 Add codeowners file
hal274 Feb 14, 2024
d5bf814
Removing contact us across app and conditional logic for showing eyb …
stuart-mindt Feb 15, 2024
48586dc
Fixing does not redirect test
stuart-mindt Feb 15, 2024
7baaeda
Removing contact triage test as no longer needed
stuart-mindt Feb 15, 2024
d4211f7
Removing unused imports
stuart-mindt Feb 15, 2024
926c81a
Removing international triage contact view
stuart-mindt Feb 15, 2024
ebbe2ce
Adding test to check contact page is gone
stuart-mindt Feb 15, 2024
5c713c8
Flake fix
stuart-mindt Feb 15, 2024
4e96b55
Removing contact view
stuart-mindt Feb 15, 2024
af2e93d
Removing unused imports
stuart-mindt Feb 15, 2024
f92bacf
Merge pull request #1008 from uktrade/feature/ioo-1120_alignment-to-eyb
stuart-mindt Feb 15, 2024
807ef74
Merge branch 'develop' into add-code-owners
bobby-didcoding Feb 16, 2024
84be288
Merge pull request #1007 from uktrade/add-code-owners
bobby-didcoding Feb 16, 2024
938702f
KLS-1918: Update URL redirection and check safe url
divyaparameswaran Feb 9, 2024
cff7f81
KLS-1918: Indentation
divyaparameswaran Feb 9, 2024
15babc2
KLS-1918: Return to home page if unsafe url
divyaparameswaran Feb 9, 2024
d09c79c
KLS-1918: Remove unused
divyaparameswaran Feb 9, 2024
f1dfc7e
KLS-1918:Update
divyaparameswaran Feb 9, 2024
5725ed5
KLS-1918:Remove unused
divyaparameswaran Feb 9, 2024
315eb8a
Cannot test
divyaparameswaran Feb 20, 2024
f2b99ae
unreachable code
divyaparameswaran Feb 20, 2024
e04f88c
Merge pull request #1005 from uktrade/KLS-1918
divyaparameswaran Feb 20, 2024
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 .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* @uktrade/great-gov-admins
divyaparameswaran marked this conversation as resolved.
Show resolved Hide resolved
1 change: 0 additions & 1 deletion conf/tests/test_redirects.py
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,6 @@ def test_redirects(url, expected, client):
'/international/invest/perfectfit/', # needs PIR API call mocked

# just a light check of SOME but not all views
'/international/contact/',
'/international/invest/contact/',
'/international/invest/contact/success/',
'/international/expand/contact/',
Expand Down
20 changes: 0 additions & 20 deletions conf/tests/test_urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,23 +60,3 @@ def test_url_redirect_industries_to_about_uk_page_off(client, settings):

with pytest.raises(NoReverseMatch):
reverse('industries-to-about-uk-redirect')


def test_url_redirect_international_contact_triage_on(client, settings):
settings.FEATURE_FLAGS['INTERNATIONAL_TRIAGE_ON'] = True
reload_urlconf(settings)

assert reverse('international-contact-triage')

with pytest.raises(NoReverseMatch):
reverse('contact-page-international')


def test_url_redirect_international_contact_triage_off(client, settings):
settings.FEATURE_FLAGS['INTERNATIONAL_TRIAGE_ON'] = False
reload_urlconf(settings)

assert reverse('contact-page-international')

with pytest.raises(NoReverseMatch):
reverse('international-contact-triage')
17 changes: 0 additions & 17 deletions conf/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,23 +113,6 @@
),
]

# This route remains in use after the Atlas refactor
if settings.FEATURE_FLAGS['INTERNATIONAL_TRIAGE_ON']:
urlpatterns += [
re_path(
r'^international/contact/$',
core.views.InternationalContactTriageView.as_view(),
name='international-contact-triage'
),
]
else:
urlpatterns += [
re_path(
r'^international/contact/$',
core.views.InternationalContactPageView.as_view(),
name='contact-page-international'
),
]

urlpatterns += [
re_path(
Expand Down
2 changes: 1 addition & 1 deletion core/header_config/tier_two_nav_items.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@

WHY_INVEST_IN_UK = NavItem(
name='why-invest-in-the-uk',
title=_('Why choose the UK?'),
title=_('Why choose the UK'),
Copy link
Contributor

Choose a reason for hiding this comment

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

NITPICK: Removing the ? looks grammatically incorrect to me.

Copy link
Contributor Author

@divyaparameswaran divyaparameswaran Feb 21, 2024

Choose a reason for hiding this comment

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

I think this might be just for the top nav bar but @stuart-madetech might be a good person to answer this .

url=WHY_INVEST_IN_THE_UK_URL
)

Expand Down
2 changes: 1 addition & 1 deletion core/templates/atlas/components/footer.html
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
href="https://www.great.gov.uk/accessibility-statement/" target="_blank">{% trans 'Accessibility' %}</a>
</li>
<li>
<a id="footer-contact" href="{{ services_urls.contact_us_international }}">
<a id="footer-contact" href="/international/expand-your-business-in-the-uk/contact">
{% trans 'Contact us' %}</a>
</li>
<li>
Expand Down
57 changes: 1 addition & 56 deletions core/tests/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,11 @@
from django.urls import reverse

from conf.tests.test_urls import reload_urlconf
from core import constants
from core.forms import CapitalInvestContactForm
from core.tests.helpers import create_response, stub_page, dummy_page
from core.tests.helpers import create_response, stub_page
from core.views import (
MultilingualCMSPageFromPathView,
CapitalInvestContactFormView,
InternationalContactTriageView,
WhyBuyFromUKFormView,
WhyBuyFromUKFormViewSuccess
)
Expand Down Expand Up @@ -247,19 +245,6 @@ def test_capital_invest_contact_form_success_page_returns_404_when_feature_flag_
assert response.status_code == 404


@patch('directory_cms_client.client.cms_api_client.lookup_by_path')
def test_international_contact_form(mock_cms_response, client, settings):
settings.FEATURE_FLAGS['INTERNATIONAL_TRIAGE_ON'] = False
reload_urlconf(settings)

mock_cms_response.return_value = create_response(dummy_page)

url = reverse('contact-page-international')
response = client.get(url)

assert response.status_code == 200


@pytest.fixture
def capital_invest_contact_form_data(captcha_stub):
return {
Expand Down Expand Up @@ -632,46 +617,6 @@ def test_about_uk_breadcrumbs_article_page_feature_off(
assert response.context_data['page']['tree_based_breadcrumbs'][0]['title'] == 'Why choose the UK'


@pytest.mark.parametrize(
'choice_contact_url',
[constants.INVEST_CONTACT_URL, constants.CAPITAL_INVEST_CONTACT_URL, constants.EXPORTING_TO_UK_CONTACT_URL,
constants.BUYING_CONTACT_URL]
)
def test_international_contact_triage_redirects(
choice_contact_url, client, feature_flags
):
feature_flags['INTERNATIONAL_TRIAGE_ON'] = True
feature_flags['EXPORTING_TO_UK_ON'] = True
feature_flags['CAPITAL_INVEST_CONTACT_IN_TRIAGE_ON'] = True

response = client.post('/international/contact/', {'choice': choice_contact_url})
assert response.status_code == 302
assert response.url == choice_contact_url


@patch('directory_cms_client.client.cms_api_client.lookup_by_path')
def test_international_contact_triage_view(
mock_cms_response, rf
):
page = {
'title': 'Midlands',
'meta': {
'languages': [
['en-gb', 'English'],
]
}
}

mock_cms_response.return_value = create_response(page)

request = rf.get('/international/contact/')
request.LANGUAGE_CODE = 'en-gb'
response = InternationalContactTriageView.as_view()(
request, path='/international/contact/')

assert 'domestic_contact_home' in response.context_data


@pytest.fixture
def why_buy_from_uk_form_data(captcha_stub):
return {
Expand Down
53 changes: 1 addition & 52 deletions core/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
from directory_constants import urls
from directory_components.helpers import SocialLinkBuilder
from directory_components.mixins import (
CMSLanguageSwitcherMixin, GA360Mixin, CountryDisplayMixin, EnableTranslationsMixin)
CMSLanguageSwitcherMixin, GA360Mixin, EnableTranslationsMixin)

from core import forms, helpers, constants
from core.context_modifiers import register_context_modifier, registry as context_modifier_registry
Expand Down Expand Up @@ -162,27 +162,6 @@ def sector_landing_page_context_modifier(context, request):
}


class InternationalContactPageView(CountryDisplayMixin, InternationalView):
template_name = 'core/contact_page.html'
header_section = tier_one_nav_items.CONTACT

def __init__(self):
super().__init__()
self.set_ga360_payload(
page_id='InternationalContactPage',
business_unit='GreatInternational',
site_section='Contact',
site_subsection='ContactForm'
)

def get_context_data(self, *args, **kwargs):
return super().get_context_data(
hide_language_selector=True,
invest_contact_us_url=urls.international.EXPAND_CONTACT,
*args, **kwargs
)


class SendContactNotifyMessagesMixin:
def send_company_message(self, form):
sender = directory_forms_api_client.helpers.Sender(
Expand Down Expand Up @@ -522,33 +501,3 @@ def handler404(request, *args, **kwargs):

def handler500(request, *args, **kwargs):
return render(request, '500.html', status=500)


class InternationalContactTriageView(
GA360Mixin,
EnableTranslationsMixin,
InternationalHeaderMixin,
FormView,
):
template_name = 'core/contact_international_triage.html'
form_class = forms.InternationalRoutingForm
success_url = urls.domestic.CONTACT_US + 'international/'
header_section = tier_one_nav_items.CONTACT

def __init__(self):
super().__init__()
self.set_ga360_payload(
page_id='GreatInternationalContactTriage',
business_unit='GreatInternational',
site_section='GreatInternational',
site_subsection='ContactTriage'
)

def form_valid(self, form):
return redirect(form.cleaned_data['choice'])

def get_context_data(self, *args, **kwargs):
return super().get_context_data(
domestic_contact_home=urls.domestic.CONTACT_US,
*args, **kwargs,
)
8 changes: 5 additions & 3 deletions find_a_supplier/views.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from django.utils.http import url_has_allowed_host_and_scheme
from django.urls import reverse, reverse_lazy
from django.conf import settings
from django.core.paginator import EmptyPage, Paginator
Expand Down Expand Up @@ -60,9 +61,10 @@ def __init__(self):
def dispatch(self, *args, **kwargs):
if 'term' in self.request.GET or 'sectors' in self.request.GET:
url = self.request.get_full_path()
return redirect(
url.replace('term=', 'q=').replace('sectors=', 'industries=')
)
if url_has_allowed_host_and_scheme(url, allowed_hosts=None):
return redirect(
url.replace('term=', 'q=').replace('sectors=', 'industries=')
)
return super().dispatch(*args, **kwargs)

def form_valid(self, form):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,4 @@
{% endfor %}
</div>

{% include 'investment_atlas/includes/speak_to_us.html' %}

{% endblock content %}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<div class="atlas-bg--grey-darker atlas-colour--white">
<div class="atlas-container">
<div class="atlas-opportunity__contact atlas-grid">

<div class="atlas-grid__column atlas-grid__column atlas-p-t-xs">
<div class="atlas-opportunity__contact-cta">
{% if button_preamble %}
<h3 class="atlas-h--xs atlas-m-b-xs atlas-m-h-xs">
{{ button_preamble }}
</h3>
{% endif %}
<a href="/international/expand-your-business-in-the-uk/" class="atlas-button atlas-button--white atlas-m-b-xs">
Find out more
</a>
</div>
</div>

</div>
</div>
</div>

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,11 @@
</div>
</div>

{% if page.investment_type == 'Foreign direct investment' or page.investment_type == 'Freeport' %}
{% include 'investment_atlas/includes/contact_eyb.html' with button_preamble="Take advantage of this opportunity to expand and grow your business in the UK" %}
{% else %}
{% include 'investment_atlas/includes/contact.html' with button_preamble="Contact the opportunity lead" %}
{% endif %}

<div class="atlas-alternate-bg">
{% for section in page.main_content %}
Expand Down Expand Up @@ -131,6 +135,4 @@ <h2 class="atlas-h--l">Other opportunities</h2>
</section>
{% endif %}

{% include 'investment_atlas/includes/speak_to_us.html' %}

{% endblock %}
2 changes: 0 additions & 2 deletions investment_atlas/templates/investment_atlas/region.html
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,4 @@ <h2 class="atlas-h--l">{{ page.case_study_title }}</h2>
</section>
{% endif %}


{% include 'investment_atlas/includes/speak_to_us.html' %}
{% endblock %}
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,4 @@ <h2 class="atlas-h--l">Explore more of the Investment Atlas</h2>
</section>
{% endif %}

{% include 'investment_atlas/includes/speak_to_us.html' %}

{% endblock %}
2 changes: 0 additions & 2 deletions investment_atlas/templates/investment_atlas/topic_list.html
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,4 @@ <h2 class="atlas-h--l">Explore more of the Investment Atlas</h2>
</section>
{% endif %}

{% include 'investment_atlas/includes/speak_to_us.html' %}

{% endblock %}
Original file line number Diff line number Diff line change
Expand Up @@ -46,5 +46,4 @@ <h3 class="atlas-h--m">
</div>
</section>

{% include 'investment_atlas/includes/speak_to_us.html' %}
{% endblock %}
2 changes: 1 addition & 1 deletion requirements.in
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ djangorestframework==3.14.0
directory-api-client==26.4.5
directory-client-core==7.2.9
directory-cms-client==12.3.3
directory-components==40.1.1
directory-components==40.2.1
directory-constants==24.1.0
directory-forms-api-client==7.3.2
directory-healthcheck==3.3
Expand Down
Loading