From c0bd4c8c61731f559936c51e3fd9cedbdd829d56 Mon Sep 17 00:00:00 2001
From: Jonathan Weth <git@jonathanweth.de>
Date: Wed, 30 Dec 2020 23:29:38 +0100
Subject: [PATCH] Remove "All" tab in preferences page

---
 aleksis/core/templates/dynamic_preferences/sections.html | 5 -----
 aleksis/core/views.py                                    | 4 ++++
 2 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/aleksis/core/templates/dynamic_preferences/sections.html b/aleksis/core/templates/dynamic_preferences/sections.html
index 39b97496f..344962dfd 100644
--- a/aleksis/core/templates/dynamic_preferences/sections.html
+++ b/aleksis/core/templates/dynamic_preferences/sections.html
@@ -1,11 +1,6 @@
 {% load i18n %}
 <ul class="tabs">
   <li class="tab ">
-    <a href="{% url registry_url %}"
-       class="{% if not active_section %}active{% endif %}"
-       target="_self">
-      {% trans "All" %}
-    </a>
     {% for section in registry.section_objects.values %}
       <li class="tab">
         <a class="{% if active_section == section.name %}active{% endif %}"
diff --git a/aleksis/core/views.py b/aleksis/core/views.py
index 016b49052..ff23d83fd 100644
--- a/aleksis/core/views.py
+++ b/aleksis/core/views.py
@@ -538,6 +538,10 @@ def preferences(
         # Invalid registry name passed from URL
         return HttpResponseNotFound()
 
+    if not section and len(registry.sections()) > 0:
+        default_section = list(registry.sections())[0]
+        return redirect(f"preferences_{registry_name}", default_section)
+
     # Build final form from dynamic-preferences
     form_class = preference_form_builder(form_class, instance=instance, section=section)
 
-- 
GitLab