prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  moderators for b-plans
  if an initiator starts a b-plan via meinBerlin (as e.g. SenWohn does, they don't have imperia) or an external project he/she is automatically added as moderator and gets mails as the one below. This is confusing because:
  a) you don't see moderators in dashboard
  b) you can't follow a b-plan/external project
  c) the link does not go to the external page (in this case it goes here: https://mein.berlin.de/projects/bebauungsplan-8-66-buckower-felder/)
  
  Should we take out this rule for these two templates or stop sending mails?
  
  
  <img width="698" alt="bildschirmfoto 2019-02-04 um 13 32 08" src="https://user-images.githubusercontent.com/35491681/52208589-762c0780-2881-11e9-9781-21826347abe4.png">
  
  
  --- END ISSUE ---
  
  Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
  --- BEGIN FILES ---
  Path: `meinberlin/apps/notifications/signals.py`
  Content:
  ```
  1 from django.contrib.auth import get_user_model
  2 from django.db.models import signals
  3 from django.dispatch import receiver
  4 
  5 from adhocracy4.actions.models import Action
  6 from adhocracy4.actions.verbs import Verbs
  7 from adhocracy4.dashboard import signals as dashboard_signals
  8 from adhocracy4.follows.models import Follow
  9 from adhocracy4.projects.models import Project
  10 
  11 from . import emails
  12 
  13 User = get_user_model()
  14 
  15 
  16 @receiver(signals.post_save, sender=Action)
  17 def send_notifications(instance, created, **kwargs):
  18     action = instance
  19     verb = Verbs(action.verb)
  20 
  21     if action.type in ('item', 'comment') \
  22             and verb in (Verbs.CREATE, Verbs.ADD):
  23         emails.NotifyCreatorEmail.send(action)
  24 
  25         if action.project:
  26             emails.NotifyModeratorsEmail.send(action)
  27 
  28     elif action.type == 'phase':
  29         if verb == Verbs.START:
  30             emails.NotifyFollowersOnPhaseStartedEmail.send(action)
  31         elif verb == Verbs.SCHEDULE:
  32             emails.NotifyFollowersOnPhaseIsOverSoonEmail.send(action)
  33 
  34     elif action.type == 'offlineevent' and verb == Verbs.START:
  35         emails.NotifyFollowersOnUpcommingEventEmail.send(action)
  36 
  37 
  38 @receiver(dashboard_signals.project_created)
  39 def send_project_created_notifications(**kwargs):
  40     project = kwargs.get('project')
  41     creator = kwargs.get('user')
  42     emails.NotifyInitiatorsOnProjectCreatedEmail.send(
  43         project, creator_pk=creator.pk)
  44 
  45 
  46 @receiver(signals.m2m_changed, sender=Project.moderators.through)
  47 def autofollow_project_moderators(instance, action, pk_set, reverse, **kwargs):
  48     if action == 'post_add':
  49         autofollow_project(instance, pk_set, reverse)
  50 
  51 
  52 def autofollow_project(instance, pk_set, reverse):
  53     if not reverse:
  54         project = instance
  55         users_pks = pk_set
  56 
  57         for user_pk in users_pks:
  58             Follow.objects.update_or_create(
  59                 project=project,
  60                 creator_id=user_pk,
  61                 defaults={
  62                     'enabled': True
  63                 }
  64             )
  65     else:
  66         user = instance
  67         project_pks = pk_set
  68 
  69         for project_pk in project_pks:
  70             Follow.objects.update_or_create(
  71                 project_id=project_pk,
  72                 creator=user,
  73                 defaults={
  74                     'enabled': True
  75                 }
  76             )
  77
  ```
  --- 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/meinberlin/apps/notifications/signals.py b/meinberlin/apps/notifications/signals.py
  --- a/meinberlin/apps/notifications/signals.py
  +++ b/meinberlin/apps/notifications/signals.py
  @@ -25,7 +25,8 @@
           if action.project:
               emails.NotifyModeratorsEmail.send(action)
   
  -    elif action.type == 'phase':
  +    elif (action.type == 'phase' and
  +          action.project.project_type == 'a4projects.Project'):
           if verb == Verbs.START:
               emails.NotifyFollowersOnPhaseStartedEmail.send(action)
           elif verb == Verbs.SCHEDULE:
  
verification_info: {"golden_diff": "diff --git a/meinberlin/apps/notifications/signals.py b/meinberlin/apps/notifications/signals.py\n--- a/meinberlin/apps/notifications/signals.py\n+++ b/meinberlin/apps/notifications/signals.py\n@@ -25,7 +25,8 @@\n         if action.project:\n             emails.NotifyModeratorsEmail.send(action)\n \n-    elif action.type == 'phase':\n+    elif (action.type == 'phase' and\n+          action.project.project_type == 'a4projects.Project'):\n         if verb == Verbs.START:\n             emails.NotifyFollowersOnPhaseStartedEmail.send(action)\n         elif verb == Verbs.SCHEDULE:\n", "issue": "moderators for b-plans\nif an initiator starts a b-plan via meinBerlin (as e.g. SenWohn does, they don't have imperia) or an external project he/she is automatically added as moderator and gets mails as the one below. This is confusing because:\r\na) you don't see moderators in dashboard\r\nb) you can't follow a b-plan/external project\r\nc) the link does not go to the external page (in this case it goes here: https://mein.berlin.de/projects/bebauungsplan-8-66-buckower-felder/)\r\n\r\nShould we take out this rule for these two templates or stop sending mails?\r\n\r\n\r\n<img width=\"698\" alt=\"bildschirmfoto 2019-02-04 um 13 32 08\" src=\"https://user-images.githubusercontent.com/35491681/52208589-762c0780-2881-11e9-9781-21826347abe4.png\">\r\n\n", "before_files": [{"content": "from django.contrib.auth import get_user_model\nfrom django.db.models import signals\nfrom django.dispatch import receiver\n\nfrom adhocracy4.actions.models import Action\nfrom adhocracy4.actions.verbs import Verbs\nfrom adhocracy4.dashboard import signals as dashboard_signals\nfrom adhocracy4.follows.models import Follow\nfrom adhocracy4.projects.models import Project\n\nfrom . import emails\n\nUser = get_user_model()\n\n\n@receiver(signals.post_save, sender=Action)\ndef send_notifications(instance, created, **kwargs):\n    action = instance\n    verb = Verbs(action.verb)\n\n    if action.type in ('item', 'comment') \\\n            and verb in (Verbs.CREATE, Verbs.ADD):\n        emails.NotifyCreatorEmail.send(action)\n\n        if action.project:\n            emails.NotifyModeratorsEmail.send(action)\n\n    elif action.type == 'phase':\n        if verb == Verbs.START:\n            emails.NotifyFollowersOnPhaseStartedEmail.send(action)\n        elif verb == Verbs.SCHEDULE:\n            emails.NotifyFollowersOnPhaseIsOverSoonEmail.send(action)\n\n    elif action.type == 'offlineevent' and verb == Verbs.START:\n        emails.NotifyFollowersOnUpcommingEventEmail.send(action)\n\n\n@receiver(dashboard_signals.project_created)\ndef send_project_created_notifications(**kwargs):\n    project = kwargs.get('project')\n    creator = kwargs.get('user')\n    emails.NotifyInitiatorsOnProjectCreatedEmail.send(\n        project, creator_pk=creator.pk)\n\n\n@receiver(signals.m2m_changed, sender=Project.moderators.through)\ndef autofollow_project_moderators(instance, action, pk_set, reverse, **kwargs):\n    if action == 'post_add':\n        autofollow_project(instance, pk_set, reverse)\n\n\ndef autofollow_project(instance, pk_set, reverse):\n    if not reverse:\n        project = instance\n        users_pks = pk_set\n\n        for user_pk in users_pks:\n            Follow.objects.update_or_create(\n                project=project,\n                creator_id=user_pk,\n                defaults={\n                    'enabled': True\n                }\n            )\n    else:\n        user = instance\n        project_pks = pk_set\n\n        for project_pk in project_pks:\n            Follow.objects.update_or_create(\n                project_id=project_pk,\n                creator=user,\n                defaults={\n                    'enabled': True\n                }\n            )\n", "path": "meinberlin/apps/notifications/signals.py"}], "after_files": [{"content": "from django.contrib.auth import get_user_model\nfrom django.db.models import signals\nfrom django.dispatch import receiver\n\nfrom adhocracy4.actions.models import Action\nfrom adhocracy4.actions.verbs import Verbs\nfrom adhocracy4.dashboard import signals as dashboard_signals\nfrom adhocracy4.follows.models import Follow\nfrom adhocracy4.projects.models import Project\n\nfrom . import emails\n\nUser = get_user_model()\n\n\n@receiver(signals.post_save, sender=Action)\ndef send_notifications(instance, created, **kwargs):\n    action = instance\n    verb = Verbs(action.verb)\n\n    if action.type in ('item', 'comment') \\\n            and verb in (Verbs.CREATE, Verbs.ADD):\n        emails.NotifyCreatorEmail.send(action)\n\n        if action.project:\n            emails.NotifyModeratorsEmail.send(action)\n\n    elif (action.type == 'phase' and\n          action.project.project_type == 'a4projects.Project'):\n        if verb == Verbs.START:\n            emails.NotifyFollowersOnPhaseStartedEmail.send(action)\n        elif verb == Verbs.SCHEDULE:\n            emails.NotifyFollowersOnPhaseIsOverSoonEmail.send(action)\n\n    elif action.type == 'offlineevent' and verb == Verbs.START:\n        emails.NotifyFollowersOnUpcommingEventEmail.send(action)\n\n\n@receiver(dashboard_signals.project_created)\ndef send_project_created_notifications(**kwargs):\n    project = kwargs.get('project')\n    creator = kwargs.get('user')\n    emails.NotifyInitiatorsOnProjectCreatedEmail.send(\n        project, creator_pk=creator.pk)\n\n\n@receiver(signals.m2m_changed, sender=Project.moderators.through)\ndef autofollow_project_moderators(instance, action, pk_set, reverse, **kwargs):\n    if action == 'post_add':\n        autofollow_project(instance, pk_set, reverse)\n\n\ndef autofollow_project(instance, pk_set, reverse):\n    if not reverse:\n        project = instance\n        users_pks = pk_set\n\n        for user_pk in users_pks:\n            Follow.objects.update_or_create(\n                project=project,\n                creator_id=user_pk,\n                defaults={\n                    'enabled': True\n                }\n            )\n    else:\n        user = instance\n        project_pks = pk_set\n\n        for project_pk in project_pks:\n            Follow.objects.update_or_create(\n                project_id=project_pk,\n                creator=user,\n                defaults={\n                    'enabled': True\n                }\n            )\n", "path": "meinberlin/apps/notifications/signals.py"}]}