From 1797c4170c8b9f65ae2dc819fe7c9577850db2aa Mon Sep 17 00:00:00 2001 From: Rowan Seymour Date: Tue, 2 Apr 2024 16:44:20 -0500 Subject: [PATCH] Remove unused option on assets endpoint to return environment --- temba/flows/tests.py | 23 ----------------------- temba/flows/views.py | 12 ++++-------- templates/flows/flow_editor.html | 1 - 3 files changed, 4 insertions(+), 32 deletions(-) diff --git a/temba/flows/tests.py b/temba/flows/tests.py index a514541f8bf..83cdf23de04 100644 --- a/temba/flows/tests.py +++ b/temba/flows/tests.py @@ -5485,29 +5485,6 @@ def test_list(self): class AssetServerTest(TembaTest): - def test_environment(self): - self.login(self.admin) - - date_formats = {"D": "DD-MM-YYYY", "M": "MM-DD-YYYY", "Y": "YYYY-MM-DD"} - - for org_date_format, date_format in date_formats.items(): - self.org.date_format = org_date_format - self.org.save() - - response = self.client.get("/flow/assets/%d/1234/environment/" % self.org.id) - self.assertEqual( - response.json(), - { - "date_format": date_format, - "time_format": "tt:mm", - "timezone": "Africa/Kigali", - "allowed_languages": ["eng", "kin"], - "default_country": "RW", - "redaction_policy": "none", - "input_collation": "default", - }, - ) - def test_languages(self): self.login(self.admin) response = self.client.get("/flow/assets/%d/1234/language/" % self.org.id) diff --git a/temba/flows/views.py b/temba/flows/views.py index 4c466eb6ed8..ce0d985ccd0 100644 --- a/temba/flows/views.py +++ b/temba/flows/views.py @@ -1720,12 +1720,12 @@ def form_valid(self, form): class Assets(OrgPermsMixin, SmartTemplateView): """ - Provides environment and languages to the new editor + TODO update editor to use API endpoint instead of this """ @classmethod def derive_url_pattern(cls, path, action): - return rf"^{path}/{action}/(?P\d+)/(?P[\w-]+)/(?Penvironment|language)/((?P[a-z0-9-]{{36}})/)?$" + return rf"^{path}/{action}/(?P\d+)/(?P[\w-]+)/(?Planguage)/((?P[a-z0-9-]{{36}})/)?$" def derive_org(self): if not hasattr(self, "org"): @@ -1734,13 +1734,9 @@ def derive_org(self): def get(self, *args, **kwargs): org = self.derive_org() - asset_type_name = kwargs["type"] - if asset_type_name == "environment": - return JsonResponse(org.as_environment_def()) - else: - results = [{"iso": code, "name": languages.get_name(code)} for code in org.flow_languages] - return JsonResponse({"results": sorted(results, key=lambda lang: lang["name"])}) + results = [{"iso": code, "name": languages.get_name(code)} for code in org.flow_languages] + return JsonResponse({"results": sorted(results, key=lambda lang: lang["name"])}) # this is just for adhoc testing of the preprocess url diff --git a/templates/flows/flow_editor.html b/templates/flows/flow_editor.html index 553b703b41b..20769293535 100644 --- a/templates/flows/flow_editor.html +++ b/templates/flows/flow_editor.html @@ -215,7 +215,6 @@ recents: '/flow/recent_contacts/{{object.uuid}}/', attachments: '{% url "msgs.media_upload" %}', languages: base + 'language', - environment: base + 'environment', activity: '/flow/activity/{{object.uuid}}/', recipients: '/contact/omnibox?v=2&types=gc', contacts: '/contact/omnibox?v=2&types=c',