diff --git a/h/models/feature.py b/h/models/feature.py index 9cc21f40ef6..3c06d855d63 100644 --- a/h/models/feature.py +++ b/h/models/feature.py @@ -15,7 +15,6 @@ "pdf_custom_text_layer": "Use custom text layer in PDFs for improved text selection", "styled_highlight_clusters": "Style different clusters of highlights in the client", "client_user_profile": "Enable client-side user profile and preferences management", - "preact_create_group_form": "Enable the new Preact version of the create group form", } diff --git a/h/templates/groups/legacy_create.html.jinja2 b/h/templates/groups/legacy_create.html.jinja2 deleted file mode 100644 index d72433619f0..00000000000 --- a/h/templates/groups/legacy_create.html.jinja2 +++ /dev/null @@ -1,20 +0,0 @@ -{% extends "h:templates/layouts/group.html.jinja2" %} - -{% set page_title = 'Create a new private group' %} - -{% block page_content %} -

Create a new private group

- {{ form }} - - -{% endblock page_content %} diff --git a/h/views/groups.py b/h/views/groups.py index 08089335464..943df405cc9 100644 --- a/h/views/groups.py +++ b/h/views/groups.py @@ -1,6 +1,4 @@ -import deform from pyramid import httpexceptions -from pyramid.config import not_ from pyramid.view import view_config, view_defaults from h import form, i18n @@ -10,67 +8,10 @@ _ = i18n.TranslationString -@view_defaults( - route_name="group_create", - renderer="h:templates/groups/legacy_create.html.jinja2", - is_authenticated=True, - feature=not_("preact_create_group_form"), -) -class LegacyGroupCreateController: - def __init__(self, request): - self.request = request - - self.schema = group_schema(autofocus_name=True).bind(request=self.request) - - submit = deform.Button( - title=_("Create group"), - css_class="primary-action-btn " - "group-form__submit-btn " - "js-create-group-create-btn", - ) - self.form = request.create_form( - self.schema, css_class="group-form__form", buttons=(submit,) - ) - - @view_config(request_method="GET") - def get(self): - """Render the form for creating a new group.""" - return self._template_data() - - @view_config(request_method="POST") - def post(self): - """Respond to a submission of the create group form.""" - - def on_success(appstruct): - group_create_service = self.request.find_service(name="group_create") - group = group_create_service.create_private_group( - name=appstruct["name"], - description=appstruct.get("description"), - userid=self.request.authenticated_userid, - ) - - url = self.request.route_path( - "group_read", pubid=group.pubid, slug=group.slug - ) - return httpexceptions.HTTPSeeOther(url) - - return form.handle_form_submission( - self.request, - self.form, - on_success=on_success, - on_failure=self._template_data, - ) - - def _template_data(self): - """Return the data needed to render this controller's page.""" - return {"form": self.form.render()} - - @view_defaults( route_name="group_create", renderer="h:templates/groups/create.html.jinja2", is_authenticated=True, - feature="preact_create_group_form", ) class GroupCreateController: def __init__(self, request): diff --git a/tests/functional/h/views/group_test.py b/tests/functional/h/views/group_test.py index 5c504412b2c..5487dca9033 100644 --- a/tests/functional/h/views/group_test.py +++ b/tests/functional/h/views/group_test.py @@ -4,33 +4,6 @@ pytestmark = pytest.mark.usefixtures("init_elasticsearch") -class TestGroupCreateController: - @pytest.mark.usefixtures("with_logged_in_user") - def test_submit_create_group_form_without_xhr_returns_full_html_page( - self, filled_out_group_form - ): - response = filled_out_group_form.submit().follow() - - assert response.text.startswith("") - - @pytest.mark.usefixtures("with_logged_in_user") - def test_submit_create_group_form_with_xhr_returns_partial_html_snippet( - self, filled_out_group_form - ): - response = filled_out_group_form.submit(xhr=True) - - assert response.body.strip(b"\n").startswith(b"