prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  Remove contributor notification post account creation
  Once a user has successfully signed up, we show a banner similar to the one below either just below the page header, or generally at the top of the page.
  
  ![Screenshot 2019-10-30 at 16 06 16 16 41 01](https://user-images.githubusercontent.com/10350960/67869535-3ce5a700-fb36-11e9-930b-66b82f6fd141.png)
  
  
  Because of the changes to account roles, these no longer makes sense and should be removed.
  
  --- END ISSUE ---
  
  Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
  --- BEGIN FILES ---
  Path: `kuma/users/signal_handlers.py`
  Content:
  ```
  1 from allauth.account.signals import email_confirmed, user_signed_up
  2 from allauth.socialaccount.signals import social_account_removed
  3 from django.contrib import messages
  4 from django.core.exceptions import ObjectDoesNotExist
  5 from django.db import transaction
  6 from django.db.models.signals import post_delete, post_save, pre_delete
  7 from django.dispatch import receiver
  8 from django.utils.translation import ugettext_lazy as _
  9 from waffle import switch_is_active
  10 
  11 from kuma.core.urlresolvers import reverse
  12 from kuma.payments.utils import cancel_stripe_customer_subscription
  13 from kuma.wiki.jobs import DocumentContributorsJob
  14 
  15 from .models import User, UserBan
  16 from .tasks import send_welcome_email
  17 
  18 
  19 @receiver(user_signed_up, dispatch_uid='users.user_signed_up')
  20 def on_user_signed_up(sender, request, user, **kwargs):
  21     """
  22     Signal handler to be called when a given user has signed up.
  23     """
  24     url = reverse('wiki.document', args=['MDN/Getting_started'])
  25     msg = _('You have completed the first step of '
  26             '<a href="%s">getting started with MDN</a>') % url
  27     messages.success(request, msg)
  28     if switch_is_active('welcome_email'):
  29         # only send if the user has already verified
  30         # at least one email address
  31         if user.emailaddress_set.filter(verified=True).exists():
  32             transaction.on_commit(
  33                 lambda: send_welcome_email.delay(user.pk, request.LANGUAGE_CODE)
  34             )
  35 
  36 
  37 @receiver(email_confirmed, dispatch_uid='users.email_confirmed')
  38 def on_email_confirmed(sender, request, email_address, **kwargs):
  39     """
  40     Signal handler to be called when a given email address was confirmed
  41     by a user.
  42     """
  43     if switch_is_active('welcome_email'):
  44         # only send if the user has exactly one verified (the given)
  45         # email address, in other words if it was just confirmed
  46         user = email_address.user
  47         previous_emails = user.emailaddress_set.exclude(pk=email_address.pk)
  48         if not previous_emails.exists():
  49             transaction.on_commit(
  50                 lambda: send_welcome_email.delay(user.pk, request.LANGUAGE_CODE)
  51             )
  52 
  53 
  54 @receiver(social_account_removed, dispatch_uid='users.social_account_removed')
  55 def on_social_account_removed(sender, request, socialaccount, **kwargs):
  56     """
  57     Invoked just after a user successfully removed a social account
  58 
  59     We use it to reset the name of the socialaccount provider in
  60     the user's session to one that he also has.
  61     """
  62     user = socialaccount.user
  63     try:
  64         all_socialaccounts = user.socialaccount_set.all()
  65         next_socialaccount = all_socialaccounts[0]
  66         request.session['sociallogin_provider'] = next_socialaccount.provider
  67         request.session.modified = True
  68     except (ObjectDoesNotExist, IndexError):
  69         pass
  70 
  71 
  72 @receiver(post_save, sender=UserBan, dispatch_uid='users.user_ban.save')
  73 def on_ban_save(sender, instance, **kwargs):
  74     """
  75     Signal handler to be called when a given user ban is saved.
  76     """
  77     user = instance.user
  78     user.is_active = not instance.is_active
  79     user.save()
  80     invalidate_document_contribution(user)
  81 
  82 
  83 @receiver(post_delete, sender=UserBan, dispatch_uid='users.user_ban.delete')
  84 def on_ban_delete(sender, instance, **kwargs):
  85     """
  86     Signal handler to be called when a user ban is deleted.
  87     """
  88     user = instance.user
  89     user.is_active = True
  90     user.save()
  91     invalidate_document_contribution(user)
  92 
  93 
  94 def invalidate_document_contribution(user):
  95     """
  96     Invalidate the contributor list for Documents the user has edited.
  97 
  98     This will remove them if they have been banned, and add them if they
  99     have been unbanned.
  100     """
  101     revisions = user.created_revisions
  102     doc_ids = set(revisions.values_list('document_id', flat=True))
  103     job = DocumentContributorsJob()
  104     for doc_id in doc_ids:
  105         job.invalidate(doc_id)
  106 
  107 
  108 @receiver(pre_delete, sender=User, dispatch_uid='users.unsubscribe_payments')
  109 def unsubscribe_payments_on_user_delete(sender, instance, **kwargs):
  110     """Cancel Stripe subscriptions before deleting User."""
  111     user = instance
  112     if user.stripe_customer_id:
  113         # This may raise an exception if the Stripe API call fails.
  114         # This will stop User deletion while an admin investigates.
  115         cancel_stripe_customer_subscription(user.stripe_customer_id)
  116
  ```
  --- 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/kuma/users/signal_handlers.py b/kuma/users/signal_handlers.py
  --- a/kuma/users/signal_handlers.py
  +++ b/kuma/users/signal_handlers.py
  @@ -1,14 +1,11 @@
   from allauth.account.signals import email_confirmed, user_signed_up
   from allauth.socialaccount.signals import social_account_removed
  -from django.contrib import messages
   from django.core.exceptions import ObjectDoesNotExist
   from django.db import transaction
   from django.db.models.signals import post_delete, post_save, pre_delete
   from django.dispatch import receiver
  -from django.utils.translation import ugettext_lazy as _
   from waffle import switch_is_active
   
  -from kuma.core.urlresolvers import reverse
   from kuma.payments.utils import cancel_stripe_customer_subscription
   from kuma.wiki.jobs import DocumentContributorsJob
   
  @@ -21,10 +18,6 @@
       """
       Signal handler to be called when a given user has signed up.
       """
  -    url = reverse('wiki.document', args=['MDN/Getting_started'])
  -    msg = _('You have completed the first step of '
  -            '<a href="%s">getting started with MDN</a>') % url
  -    messages.success(request, msg)
       if switch_is_active('welcome_email'):
           # only send if the user has already verified
           # at least one email address
  
verification_info: {"golden_diff": "diff --git a/kuma/users/signal_handlers.py b/kuma/users/signal_handlers.py\n--- a/kuma/users/signal_handlers.py\n+++ b/kuma/users/signal_handlers.py\n@@ -1,14 +1,11 @@\n from allauth.account.signals import email_confirmed, user_signed_up\n from allauth.socialaccount.signals import social_account_removed\n-from django.contrib import messages\n from django.core.exceptions import ObjectDoesNotExist\n from django.db import transaction\n from django.db.models.signals import post_delete, post_save, pre_delete\n from django.dispatch import receiver\n-from django.utils.translation import ugettext_lazy as _\n from waffle import switch_is_active\n \n-from kuma.core.urlresolvers import reverse\n from kuma.payments.utils import cancel_stripe_customer_subscription\n from kuma.wiki.jobs import DocumentContributorsJob\n \n@@ -21,10 +18,6 @@\n     \"\"\"\n     Signal handler to be called when a given user has signed up.\n     \"\"\"\n-    url = reverse('wiki.document', args=['MDN/Getting_started'])\n-    msg = _('You have completed the first step of '\n-            '<a href=\"%s\">getting started with MDN</a>') % url\n-    messages.success(request, msg)\n     if switch_is_active('welcome_email'):\n         # only send if the user has already verified\n         # at least one email address\n", "issue": "Remove contributor notification post account creation\nOnce a user has successfully signed up, we show a banner similar to the one below either just below the page header, or generally at the top of the page.\r\n\r\n![Screenshot 2019-10-30 at 16 06 16 16 41 01](https://user-images.githubusercontent.com/10350960/67869535-3ce5a700-fb36-11e9-930b-66b82f6fd141.png)\r\n\r\n\r\nBecause of the changes to account roles, these no longer makes sense and should be removed.\n", "before_files": [{"content": "from allauth.account.signals import email_confirmed, user_signed_up\nfrom allauth.socialaccount.signals import social_account_removed\nfrom django.contrib import messages\nfrom django.core.exceptions import ObjectDoesNotExist\nfrom django.db import transaction\nfrom django.db.models.signals import post_delete, post_save, pre_delete\nfrom django.dispatch import receiver\nfrom django.utils.translation import ugettext_lazy as _\nfrom waffle import switch_is_active\n\nfrom kuma.core.urlresolvers import reverse\nfrom kuma.payments.utils import cancel_stripe_customer_subscription\nfrom kuma.wiki.jobs import DocumentContributorsJob\n\nfrom .models import User, UserBan\nfrom .tasks import send_welcome_email\n\n\n@receiver(user_signed_up, dispatch_uid='users.user_signed_up')\ndef on_user_signed_up(sender, request, user, **kwargs):\n    \"\"\"\n    Signal handler to be called when a given user has signed up.\n    \"\"\"\n    url = reverse('wiki.document', args=['MDN/Getting_started'])\n    msg = _('You have completed the first step of '\n            '<a href=\"%s\">getting started with MDN</a>') % url\n    messages.success(request, msg)\n    if switch_is_active('welcome_email'):\n        # only send if the user has already verified\n        # at least one email address\n        if user.emailaddress_set.filter(verified=True).exists():\n            transaction.on_commit(\n                lambda: send_welcome_email.delay(user.pk, request.LANGUAGE_CODE)\n            )\n\n\n@receiver(email_confirmed, dispatch_uid='users.email_confirmed')\ndef on_email_confirmed(sender, request, email_address, **kwargs):\n    \"\"\"\n    Signal handler to be called when a given email address was confirmed\n    by a user.\n    \"\"\"\n    if switch_is_active('welcome_email'):\n        # only send if the user has exactly one verified (the given)\n        # email address, in other words if it was just confirmed\n        user = email_address.user\n        previous_emails = user.emailaddress_set.exclude(pk=email_address.pk)\n        if not previous_emails.exists():\n            transaction.on_commit(\n                lambda: send_welcome_email.delay(user.pk, request.LANGUAGE_CODE)\n            )\n\n\n@receiver(social_account_removed, dispatch_uid='users.social_account_removed')\ndef on_social_account_removed(sender, request, socialaccount, **kwargs):\n    \"\"\"\n    Invoked just after a user successfully removed a social account\n\n    We use it to reset the name of the socialaccount provider in\n    the user's session to one that he also has.\n    \"\"\"\n    user = socialaccount.user\n    try:\n        all_socialaccounts = user.socialaccount_set.all()\n        next_socialaccount = all_socialaccounts[0]\n        request.session['sociallogin_provider'] = next_socialaccount.provider\n        request.session.modified = True\n    except (ObjectDoesNotExist, IndexError):\n        pass\n\n\n@receiver(post_save, sender=UserBan, dispatch_uid='users.user_ban.save')\ndef on_ban_save(sender, instance, **kwargs):\n    \"\"\"\n    Signal handler to be called when a given user ban is saved.\n    \"\"\"\n    user = instance.user\n    user.is_active = not instance.is_active\n    user.save()\n    invalidate_document_contribution(user)\n\n\n@receiver(post_delete, sender=UserBan, dispatch_uid='users.user_ban.delete')\ndef on_ban_delete(sender, instance, **kwargs):\n    \"\"\"\n    Signal handler to be called when a user ban is deleted.\n    \"\"\"\n    user = instance.user\n    user.is_active = True\n    user.save()\n    invalidate_document_contribution(user)\n\n\ndef invalidate_document_contribution(user):\n    \"\"\"\n    Invalidate the contributor list for Documents the user has edited.\n\n    This will remove them if they have been banned, and add them if they\n    have been unbanned.\n    \"\"\"\n    revisions = user.created_revisions\n    doc_ids = set(revisions.values_list('document_id', flat=True))\n    job = DocumentContributorsJob()\n    for doc_id in doc_ids:\n        job.invalidate(doc_id)\n\n\n@receiver(pre_delete, sender=User, dispatch_uid='users.unsubscribe_payments')\ndef unsubscribe_payments_on_user_delete(sender, instance, **kwargs):\n    \"\"\"Cancel Stripe subscriptions before deleting User.\"\"\"\n    user = instance\n    if user.stripe_customer_id:\n        # This may raise an exception if the Stripe API call fails.\n        # This will stop User deletion while an admin investigates.\n        cancel_stripe_customer_subscription(user.stripe_customer_id)\n", "path": "kuma/users/signal_handlers.py"}], "after_files": [{"content": "from allauth.account.signals import email_confirmed, user_signed_up\nfrom allauth.socialaccount.signals import social_account_removed\nfrom django.core.exceptions import ObjectDoesNotExist\nfrom django.db import transaction\nfrom django.db.models.signals import post_delete, post_save, pre_delete\nfrom django.dispatch import receiver\nfrom waffle import switch_is_active\n\nfrom kuma.payments.utils import cancel_stripe_customer_subscription\nfrom kuma.wiki.jobs import DocumentContributorsJob\n\nfrom .models import User, UserBan\nfrom .tasks import send_welcome_email\n\n\n@receiver(user_signed_up, dispatch_uid='users.user_signed_up')\ndef on_user_signed_up(sender, request, user, **kwargs):\n    \"\"\"\n    Signal handler to be called when a given user has signed up.\n    \"\"\"\n    if switch_is_active('welcome_email'):\n        # only send if the user has already verified\n        # at least one email address\n        if user.emailaddress_set.filter(verified=True).exists():\n            transaction.on_commit(\n                lambda: send_welcome_email.delay(user.pk, request.LANGUAGE_CODE)\n            )\n\n\n@receiver(email_confirmed, dispatch_uid='users.email_confirmed')\ndef on_email_confirmed(sender, request, email_address, **kwargs):\n    \"\"\"\n    Signal handler to be called when a given email address was confirmed\n    by a user.\n    \"\"\"\n    if switch_is_active('welcome_email'):\n        # only send if the user has exactly one verified (the given)\n        # email address, in other words if it was just confirmed\n        user = email_address.user\n        previous_emails = user.emailaddress_set.exclude(pk=email_address.pk)\n        if not previous_emails.exists():\n            transaction.on_commit(\n                lambda: send_welcome_email.delay(user.pk, request.LANGUAGE_CODE)\n            )\n\n\n@receiver(social_account_removed, dispatch_uid='users.social_account_removed')\ndef on_social_account_removed(sender, request, socialaccount, **kwargs):\n    \"\"\"\n    Invoked just after a user successfully removed a social account\n\n    We use it to reset the name of the socialaccount provider in\n    the user's session to one that he also has.\n    \"\"\"\n    user = socialaccount.user\n    try:\n        all_socialaccounts = user.socialaccount_set.all()\n        next_socialaccount = all_socialaccounts[0]\n        request.session['sociallogin_provider'] = next_socialaccount.provider\n        request.session.modified = True\n    except (ObjectDoesNotExist, IndexError):\n        pass\n\n\n@receiver(post_save, sender=UserBan, dispatch_uid='users.user_ban.save')\ndef on_ban_save(sender, instance, **kwargs):\n    \"\"\"\n    Signal handler to be called when a given user ban is saved.\n    \"\"\"\n    user = instance.user\n    user.is_active = not instance.is_active\n    user.save()\n    invalidate_document_contribution(user)\n\n\n@receiver(post_delete, sender=UserBan, dispatch_uid='users.user_ban.delete')\ndef on_ban_delete(sender, instance, **kwargs):\n    \"\"\"\n    Signal handler to be called when a user ban is deleted.\n    \"\"\"\n    user = instance.user\n    user.is_active = True\n    user.save()\n    invalidate_document_contribution(user)\n\n\ndef invalidate_document_contribution(user):\n    \"\"\"\n    Invalidate the contributor list for Documents the user has edited.\n\n    This will remove them if they have been banned, and add them if they\n    have been unbanned.\n    \"\"\"\n    revisions = user.created_revisions\n    doc_ids = set(revisions.values_list('document_id', flat=True))\n    job = DocumentContributorsJob()\n    for doc_id in doc_ids:\n        job.invalidate(doc_id)\n\n\n@receiver(pre_delete, sender=User, dispatch_uid='users.unsubscribe_payments')\ndef unsubscribe_payments_on_user_delete(sender, instance, **kwargs):\n    \"\"\"Cancel Stripe subscriptions before deleting User.\"\"\"\n    user = instance\n    if user.stripe_customer_id:\n        # This may raise an exception if the Stripe API call fails.\n        # This will stop User deletion while an admin investigates.\n        cancel_stripe_customer_subscription(user.stripe_customer_id)\n", "path": "kuma/users/signal_handlers.py"}]}