prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  Spatial Idea Challenge: No comments possible
  In the blueprint Spatial Idea Challenge, in phase 1 comments cannot be made (be sure to test with normal user account). We need to fix the blueprint, apparently. See here https://opin-stage.liqd.net/de/maps/test-the-comments/ for an example.
  
  --- END ISSUE ---
  
  Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
  --- BEGIN FILES ---
  Path: `euth/maps/views.py`
  Content:
  ```
  1 from django.conf import settings
  2 from easy_thumbnails.files import get_thumbnailer
  3 
  4 from euth.ideas import views as idea_views
  5 
  6 from . import forms
  7 from .models import MapIdea
  8 
  9 
  10 class MapIdeaListView(idea_views.IdeaListView):
  11     model = MapIdea
  12 
  13     def dump_geojson(self):
  14         result = {}
  15         result['type'] = 'FeatureCollection'
  16         feature_list = []
  17 
  18         for item in self.get_queryset():
  19 
  20             url = ''
  21 
  22             if item.image:
  23                 image = get_thumbnailer(item.image)['map_thumbnail']
  24                 url = image.url
  25 
  26             properties = {
  27                 'name': item.name,
  28                 'slug': item.slug,
  29                 'image':  url,
  30                 'comments_count': item.comment_count,
  31                 'positive_rating_count': item.positive_rating_count,
  32                 'negative_rating_count': item.negative_rating_count,
  33                 'url': item.get_absolute_url()
  34             }
  35             point_dict = item.point
  36             point_dict['properties'] = properties
  37             feature_list.append(point_dict)
  38 
  39         result['features'] = feature_list
  40         return result
  41 
  42     def get_context_data(self, **kwargs):
  43         context = super().get_context_data(**kwargs)
  44         context['mapideas_json'] = self.dump_geojson()
  45         context['map_url'] = settings.BASE_MAP
  46         context['polygon'] = self.module.settings_instance.polygon
  47         return context
  48 
  49 
  50 class MapIdeaCreateView(idea_views.IdeaCreateView):
  51     model = MapIdea
  52     form_class = forms.MapIdeaForm
  53     permission_required = 'euth_maps.propose_idea'
  54 
  55     def get_form_kwargs(self):
  56         kwargs = super().get_form_kwargs()
  57         kwargs['settings_instance'] = self.module.settings_instance
  58         return kwargs
  59 
  60 
  61 class MapIdeaUpdateView(idea_views.IdeaUpdateView):
  62     model = MapIdea
  63     form_class = forms.MapIdeaForm
  64 
  65     def get_form_kwargs(self):
  66         kwargs = super().get_form_kwargs()
  67         kwargs['settings_instance'] = self.object.module.settings_instance
  68         return kwargs
  69 
  70 
  71 class MapIdeaDeleteView(idea_views.IdeaDeleteView):
  72     model = MapIdea
  73 
  74 
  75 class MapIdeaDetailView(idea_views.IdeaDetailView):
  76     model = MapIdea
  77     queryset = MapIdea.objects.annotate_positive_rating_count()\
  78         .annotate_negative_rating_count()
  79 
  80     def get_context_data(self, **kwargs):
  81         context = super().get_context_data(**kwargs)
  82         context['map_url'] = settings.BASE_MAP
  83         return context
  84
  ```
  
  Path: `euth/maps/rules.py`
  Content:
  ```
  1 import rules
  2 from rules.predicates import is_superuser
  3 
  4 from adhocracy4.modules.predicates import (is_context_initiator,
  5                                            is_context_member,
  6                                            is_context_moderator)
  7 from adhocracy4.phases.predicates import phase_allows_create
  8 
  9 from .models import MapIdea
  10 
  11 rules.add_perm('euth_maps.propose_idea',
  12                is_superuser | is_context_moderator | is_context_initiator |
  13                (is_context_member & phase_allows_create(MapIdea)))
  14
  ```
  --- END FILES ---
  
  Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.
  
  Here is an example:
  
  ```diff
  diff --git a/examples/server_async.py b/examples/server_async.py
  --- a/examples/server_async.py
  +++ b/examples/server_async.py
  @@ -313,4 +313,4 @@
   
   
   if __name__ == "__main__":
  -    asyncio.run(run_async_server("."), debug=True)
  +    asyncio.run(run_async_server(), debug=True)
  diff --git a/examples/server_sync.py b/examples/server_sync.py
  --- a/examples/server_sync.py
  +++ b/examples/server_sync.py
  @@ -313,5 +313,5 @@
   
   
   if __name__ == "__main__":
  -    server = run_sync_server(".")
  +    server = run_sync_server()
       server.shutdown()
  
  ```
  
golden_diff: diff --git a/euth/maps/rules.py b/euth/maps/rules.py
  --- a/euth/maps/rules.py
  +++ b/euth/maps/rules.py
  @@ -3,11 +3,36 @@
   
   from adhocracy4.modules.predicates import (is_context_initiator,
                                              is_context_member,
  -                                           is_context_moderator)
  -from adhocracy4.phases.predicates import phase_allows_create
  -
  +                                           is_context_moderator,
  +                                           is_owner,
  +                                           is_public_context)
  +from adhocracy4.phases.predicates import (phase_allows_comment,
  +                                          phase_allows_create,
  +                                          phase_allows_modify,
  +                                          phase_allows_rate)
   from .models import MapIdea
   
  -rules.add_perm('euth_maps.propose_idea',
  +
  +rules.add_perm('euth_maps.rate_mapidea',
  +               is_superuser | is_context_moderator | is_context_initiator |
  +               (is_context_member & phase_allows_rate))
  +
  +
  +rules.add_perm('euth_maps.comment_mapidea',
  +               is_superuser | is_context_moderator | is_context_initiator |
  +               (is_context_member & phase_allows_comment))
  +
  +
  +rules.add_perm('euth_maps.modify_mapidea',
  +               is_superuser | is_context_moderator | is_context_initiator |
  +               (is_context_member & is_owner & phase_allows_modify))
  +
  +
  +rules.add_perm('euth_maps.propose_mapidea',
                  is_superuser | is_context_moderator | is_context_initiator |
                  (is_context_member & phase_allows_create(MapIdea)))
  +
  +
  +rules.add_perm('euth_maps.view_mapidea',
  +               is_superuser | is_context_moderator | is_context_initiator |
  +               is_context_member | is_public_context)
  diff --git a/euth/maps/views.py b/euth/maps/views.py
  --- a/euth/maps/views.py
  +++ b/euth/maps/views.py
  @@ -50,7 +50,7 @@
   class MapIdeaCreateView(idea_views.IdeaCreateView):
       model = MapIdea
       form_class = forms.MapIdeaForm
  -    permission_required = 'euth_maps.propose_idea'
  +    permission_required = 'euth_maps.propose_mapidea'
   
       def get_form_kwargs(self):
           kwargs = super().get_form_kwargs()
  @@ -60,6 +60,7 @@
   
   class MapIdeaUpdateView(idea_views.IdeaUpdateView):
       model = MapIdea
  +    permission_required = 'euth_maps.modify_mapidea'
       form_class = forms.MapIdeaForm
   
       def get_form_kwargs(self):
  @@ -70,10 +71,12 @@
   
   class MapIdeaDeleteView(idea_views.IdeaDeleteView):
       model = MapIdea
  +    permission_required = 'euth_maps.modify_mapidea'
   
   
   class MapIdeaDetailView(idea_views.IdeaDetailView):
       model = MapIdea
  +    permission_required = 'euth_maps.view_mapidea'
       queryset = MapIdea.objects.annotate_positive_rating_count()\
           .annotate_negative_rating_count()
  
verification_info: {"golden_diff": "diff --git a/euth/maps/rules.py b/euth/maps/rules.py\n--- a/euth/maps/rules.py\n+++ b/euth/maps/rules.py\n@@ -3,11 +3,36 @@\n \n from adhocracy4.modules.predicates import (is_context_initiator,\n                                            is_context_member,\n-                                           is_context_moderator)\n-from adhocracy4.phases.predicates import phase_allows_create\n-\n+                                           is_context_moderator,\n+                                           is_owner,\n+                                           is_public_context)\n+from adhocracy4.phases.predicates import (phase_allows_comment,\n+                                          phase_allows_create,\n+                                          phase_allows_modify,\n+                                          phase_allows_rate)\n from .models import MapIdea\n \n-rules.add_perm('euth_maps.propose_idea',\n+\n+rules.add_perm('euth_maps.rate_mapidea',\n+               is_superuser | is_context_moderator | is_context_initiator |\n+               (is_context_member & phase_allows_rate))\n+\n+\n+rules.add_perm('euth_maps.comment_mapidea',\n+               is_superuser | is_context_moderator | is_context_initiator |\n+               (is_context_member & phase_allows_comment))\n+\n+\n+rules.add_perm('euth_maps.modify_mapidea',\n+               is_superuser | is_context_moderator | is_context_initiator |\n+               (is_context_member & is_owner & phase_allows_modify))\n+\n+\n+rules.add_perm('euth_maps.propose_mapidea',\n                is_superuser | is_context_moderator | is_context_initiator |\n                (is_context_member & phase_allows_create(MapIdea)))\n+\n+\n+rules.add_perm('euth_maps.view_mapidea',\n+               is_superuser | is_context_moderator | is_context_initiator |\n+               is_context_member | is_public_context)\ndiff --git a/euth/maps/views.py b/euth/maps/views.py\n--- a/euth/maps/views.py\n+++ b/euth/maps/views.py\n@@ -50,7 +50,7 @@\n class MapIdeaCreateView(idea_views.IdeaCreateView):\n     model = MapIdea\n     form_class = forms.MapIdeaForm\n-    permission_required = 'euth_maps.propose_idea'\n+    permission_required = 'euth_maps.propose_mapidea'\n \n     def get_form_kwargs(self):\n         kwargs = super().get_form_kwargs()\n@@ -60,6 +60,7 @@\n \n class MapIdeaUpdateView(idea_views.IdeaUpdateView):\n     model = MapIdea\n+    permission_required = 'euth_maps.modify_mapidea'\n     form_class = forms.MapIdeaForm\n \n     def get_form_kwargs(self):\n@@ -70,10 +71,12 @@\n \n class MapIdeaDeleteView(idea_views.IdeaDeleteView):\n     model = MapIdea\n+    permission_required = 'euth_maps.modify_mapidea'\n \n \n class MapIdeaDetailView(idea_views.IdeaDetailView):\n     model = MapIdea\n+    permission_required = 'euth_maps.view_mapidea'\n     queryset = MapIdea.objects.annotate_positive_rating_count()\\\n         .annotate_negative_rating_count()\n", "issue": "Spatial Idea Challenge: No comments possible\nIn the blueprint Spatial Idea Challenge, in phase 1 comments cannot be made (be sure to test with normal user account). We need to fix the blueprint, apparently. See here https://opin-stage.liqd.net/de/maps/test-the-comments/ for an example.\n", "before_files": [{"content": "from django.conf import settings\nfrom easy_thumbnails.files import get_thumbnailer\n\nfrom euth.ideas import views as idea_views\n\nfrom . import forms\nfrom .models import MapIdea\n\n\nclass MapIdeaListView(idea_views.IdeaListView):\n    model = MapIdea\n\n    def dump_geojson(self):\n        result = {}\n        result['type'] = 'FeatureCollection'\n        feature_list = []\n\n        for item in self.get_queryset():\n\n            url = ''\n\n            if item.image:\n                image = get_thumbnailer(item.image)['map_thumbnail']\n                url = image.url\n\n            properties = {\n                'name': item.name,\n                'slug': item.slug,\n                'image':  url,\n                'comments_count': item.comment_count,\n                'positive_rating_count': item.positive_rating_count,\n                'negative_rating_count': item.negative_rating_count,\n                'url': item.get_absolute_url()\n            }\n            point_dict = item.point\n            point_dict['properties'] = properties\n            feature_list.append(point_dict)\n\n        result['features'] = feature_list\n        return result\n\n    def get_context_data(self, **kwargs):\n        context = super().get_context_data(**kwargs)\n        context['mapideas_json'] = self.dump_geojson()\n        context['map_url'] = settings.BASE_MAP\n        context['polygon'] = self.module.settings_instance.polygon\n        return context\n\n\nclass MapIdeaCreateView(idea_views.IdeaCreateView):\n    model = MapIdea\n    form_class = forms.MapIdeaForm\n    permission_required = 'euth_maps.propose_idea'\n\n    def get_form_kwargs(self):\n        kwargs = super().get_form_kwargs()\n        kwargs['settings_instance'] = self.module.settings_instance\n        return kwargs\n\n\nclass MapIdeaUpdateView(idea_views.IdeaUpdateView):\n    model = MapIdea\n    form_class = forms.MapIdeaForm\n\n    def get_form_kwargs(self):\n        kwargs = super().get_form_kwargs()\n        kwargs['settings_instance'] = self.object.module.settings_instance\n        return kwargs\n\n\nclass MapIdeaDeleteView(idea_views.IdeaDeleteView):\n    model = MapIdea\n\n\nclass MapIdeaDetailView(idea_views.IdeaDetailView):\n    model = MapIdea\n    queryset = MapIdea.objects.annotate_positive_rating_count()\\\n        .annotate_negative_rating_count()\n\n    def get_context_data(self, **kwargs):\n        context = super().get_context_data(**kwargs)\n        context['map_url'] = settings.BASE_MAP\n        return context\n", "path": "euth/maps/views.py"}, {"content": "import rules\nfrom rules.predicates import is_superuser\n\nfrom adhocracy4.modules.predicates import (is_context_initiator,\n                                           is_context_member,\n                                           is_context_moderator)\nfrom adhocracy4.phases.predicates import phase_allows_create\n\nfrom .models import MapIdea\n\nrules.add_perm('euth_maps.propose_idea',\n               is_superuser | is_context_moderator | is_context_initiator |\n               (is_context_member & phase_allows_create(MapIdea)))\n", "path": "euth/maps/rules.py"}], "after_files": [{"content": "from django.conf import settings\nfrom easy_thumbnails.files import get_thumbnailer\n\nfrom euth.ideas import views as idea_views\n\nfrom . import forms\nfrom .models import MapIdea\n\n\nclass MapIdeaListView(idea_views.IdeaListView):\n    model = MapIdea\n\n    def dump_geojson(self):\n        result = {}\n        result['type'] = 'FeatureCollection'\n        feature_list = []\n\n        for item in self.get_queryset():\n\n            url = ''\n\n            if item.image:\n                image = get_thumbnailer(item.image)['map_thumbnail']\n                url = image.url\n\n            properties = {\n                'name': item.name,\n                'slug': item.slug,\n                'image':  url,\n                'comments_count': item.comment_count,\n                'positive_rating_count': item.positive_rating_count,\n                'negative_rating_count': item.negative_rating_count,\n                'url': item.get_absolute_url()\n            }\n            point_dict = item.point\n            point_dict['properties'] = properties\n            feature_list.append(point_dict)\n\n        result['features'] = feature_list\n        return result\n\n    def get_context_data(self, **kwargs):\n        context = super().get_context_data(**kwargs)\n        context['mapideas_json'] = self.dump_geojson()\n        context['map_url'] = settings.BASE_MAP\n        context['polygon'] = self.module.settings_instance.polygon\n        return context\n\n\nclass MapIdeaCreateView(idea_views.IdeaCreateView):\n    model = MapIdea\n    form_class = forms.MapIdeaForm\n    permission_required = 'euth_maps.propose_mapidea'\n\n    def get_form_kwargs(self):\n        kwargs = super().get_form_kwargs()\n        kwargs['settings_instance'] = self.module.settings_instance\n        return kwargs\n\n\nclass MapIdeaUpdateView(idea_views.IdeaUpdateView):\n    model = MapIdea\n    permission_required = 'euth_maps.modify_mapidea'\n    form_class = forms.MapIdeaForm\n\n    def get_form_kwargs(self):\n        kwargs = super().get_form_kwargs()\n        kwargs['settings_instance'] = self.object.module.settings_instance\n        return kwargs\n\n\nclass MapIdeaDeleteView(idea_views.IdeaDeleteView):\n    model = MapIdea\n    permission_required = 'euth_maps.modify_mapidea'\n\n\nclass MapIdeaDetailView(idea_views.IdeaDetailView):\n    model = MapIdea\n    permission_required = 'euth_maps.view_mapidea'\n    queryset = MapIdea.objects.annotate_positive_rating_count()\\\n        .annotate_negative_rating_count()\n\n    def get_context_data(self, **kwargs):\n        context = super().get_context_data(**kwargs)\n        context['map_url'] = settings.BASE_MAP\n        return context\n", "path": "euth/maps/views.py"}, {"content": "import rules\nfrom rules.predicates import is_superuser\n\nfrom adhocracy4.modules.predicates import (is_context_initiator,\n                                           is_context_member,\n                                           is_context_moderator,\n                                           is_owner,\n                                           is_public_context)\nfrom adhocracy4.phases.predicates import (phase_allows_comment,\n                                          phase_allows_create,\n                                          phase_allows_modify,\n                                          phase_allows_rate)\nfrom .models import MapIdea\n\n\nrules.add_perm('euth_maps.rate_mapidea',\n               is_superuser | is_context_moderator | is_context_initiator |\n               (is_context_member & phase_allows_rate))\n\n\nrules.add_perm('euth_maps.comment_mapidea',\n               is_superuser | is_context_moderator | is_context_initiator |\n               (is_context_member & phase_allows_comment))\n\n\nrules.add_perm('euth_maps.modify_mapidea',\n               is_superuser | is_context_moderator | is_context_initiator |\n               (is_context_member & is_owner & phase_allows_modify))\n\n\nrules.add_perm('euth_maps.propose_mapidea',\n               is_superuser | is_context_moderator | is_context_initiator |\n               (is_context_member & phase_allows_create(MapIdea)))\n\n\nrules.add_perm('euth_maps.view_mapidea',\n               is_superuser | is_context_moderator | is_context_initiator |\n               is_context_member | is_public_context)\n", "path": "euth/maps/rules.py"}]}