Repository: liqd/a4-meinberlin

Issue:
Breadcrumb in modul "Priorisierung mit Karte" is saying always "list" 
**URL:** https://meinberlin-dev.liqd.net/maptopicprio/2022-00910/
**user:** any
**expected behaviour:** When coming from map I don't want to get confused by a button which says "list" even though you going back to the map.
**behaviour:** In modul "Priorisierung mit Karte" in the detail view the breadcrumb says always list. When you for example come from the map, you go back to map but breadcrumb says "list".
**important screensize:** -
**device & browser:** mac ff
**Comment/Question:** in the other moduls with ideas/proposals (except Bürger*innenhaushalt), it's saying "Back" ("Zurück") and neither "list" nor "map". Probably related to this issue: https://github.com/liqd/a4-meinberlin/issues/4816

Screenshot?



Discussion:
Oh, this is the priorisierung, that should not happen..
@fuzzylogic2000 it was changed to list [here](https://github.com/liqd/a4-meinberlin/commit/5502c3e2b3227decc9e5035b86a99e6f04cf9bec), do you remember what was the idea there?
@Rineee Yes, it was in the first story about the back-link to change the wording to list, so I changed it everywhere. And then, I didn't change it back in the second story. So, still needs to be changed back.
But maybe it would be good to have decision about the back/map/list wording for the default for the budgeting first. That is currently also "back" when coming from outside directly to an idea. Should that change @CarolingerSeilchenspringer ?

Also, I just saw that changing back for the item detail, I used "back" instead of the "go back" that was there before. I guess it doesn't matter shich one we use, we should just stick to the same for the item and the topic deatil views.

Resolving patch:
diff --git a/meinberlin/apps/budgeting/views.py b/meinberlin/apps/budgeting/views.py
--- a/meinberlin/apps/budgeting/views.py
+++ b/meinberlin/apps/budgeting/views.py
@@ -140,21 +140,22 @@ def get_back(self):
         are remembered when going back, we check if the referer is a
         module or project detail view and add the appropriate back url.
         """
+        back_link = self.module.get_detail_url
+        back_string = _("map")
         if "Referer" in self.request.headers:
             referer = self.request.headers["Referer"]
             parsed_url = urlparse(referer)
             match = resolve(parsed_url.path)
             if match.url_name == "project-detail" or match.url_name == "module-detail":
                 back_mode = None
-                back_string = _("map")
                 if "mode" in parse_qs(parsed_url.query):
                     back_mode = parse_qs(parsed_url.query)["mode"][0]
                     if back_mode == "list":
                         back_string = _("list")
                 back_link = referer + "#proposal_{}".format(self.object.id)
                 return back_link, back_string
-            return None, None
-        return None, None
+            return back_link, back_string
+        return back_link, back_string
 
     def has_valid_token_in_session(self, request):
         """Return whether a valid token is stored in the session.


Test patch:
diff --git a/tests/budgeting/test_views_integration.py b/tests/budgeting/test_views_integration.py
--- a/tests/budgeting/test_views_integration.py
+++ b/tests/budgeting/test_views_integration.py
@@ -208,7 +208,7 @@ def test_detail_view_back_link(client, phase_factory, proposal_factory):
     url = item.get_absolute_url()
     project_referer = reverse("project-detail", kwargs={"slug": item.project.slug})
     module_referer = reverse("module-detail", kwargs={"module_slug": item.module.slug})
-    filter_string = "?is_archived=&page=1&search="
+    filter_string = "?mode=list&is_archived=&page=1&search="
     filtered_project_referer = project_referer + filter_string
     filtered_module_referer = module_referer + filter_string
     with freeze_phase(phase):
@@ -216,24 +216,30 @@ def test_detail_view_back_link(client, phase_factory, proposal_factory):
         assert response.context["back"] == "{}#proposal_{}".format(
             project_referer, item.id
         )
+        assert response.context["back_string"] == "map"
         response = client.get(url, HTTP_referer=module_referer)
         assert response.context["back"] == "{}#proposal_{}".format(
             module_referer, item.id
         )
+        assert response.context["back_string"] == "map"
 
         response = client.get(url, HTTP_referer=filtered_project_referer)
         assert response.context["back"] == "{}#proposal_{}".format(
             filtered_project_referer, item.id
         )
+        assert response.context["back_string"] == "list"
         response = client.get(url, HTTP_referer=filtered_module_referer)
         assert response.context["back"] == "{}#proposal_{}".format(
             filtered_module_referer, item.id
         )
+        assert response.context["back_string"] == "list"
 
         response = client.get(url, HTTP_referer="/")
-        assert not response.context["back"]
+        assert response.context["back"] == module.get_detail_url
+        assert response.context["back_string"] == "map"
         response = client.get(url)
-        assert not response.context["back"]
+        assert response.context["back"] == module.get_detail_url
+        assert response.context["back_string"] == "map"
 
 
 @pytest.mark.django_db