prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  Event creation mails do not include event description
  
  
  --- END ISSUE ---
  
  Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
  --- BEGIN FILES ---
  Path: `ephios/event_management/mail.py`
  Content:
  ```
  1 from django.core import mail
  2 from django.core.mail import EmailMultiAlternatives
  3 from django.template.loader import render_to_string
  4 from django.utils.translation import gettext as _
  5 from guardian.shortcuts import get_users_with_perms
  6 
  7 from ephios.event_management.models import AbstractParticipation
  8 from ephios.extra.permissions import get_groups_with_perms
  9 from ephios.settings import SITE_URL
  10 from ephios.user_management.models import UserProfile
  11 
  12 
  13 def new_event(event):
  14     messages = []
  15     users = UserProfile.objects.filter(
  16         groups__in=get_groups_with_perms(event, only_with_perms_in=["view_event"]), is_active=True
  17     ).distinct()
  18     responsible_users = get_users_with_perms(event, only_with_perms_in=["change_event"]).distinct()
  19     responsible_persons_mails = list(responsible_users.values_list("email", flat=True))
  20 
  21     subject = _("New {type}: {title}").format(type=event.type, title=event.title)
  22     text_content = _(
  23         "A new {type} ({title}) has been added. \n You can view it here: {link}"
  24     ).format(type=event.type, title=event.title, link=event.get_absolute_url())
  25     html_content = render_to_string(
  26         "event_management/mails/new_event.html", {"event": event, "site_url": SITE_URL}
  27     )
  28 
  29     for user in users:
  30         message = EmailMultiAlternatives(
  31             to=[user.email], subject=subject, body=text_content, reply_to=responsible_persons_mails
  32         )
  33         message.attach_alternative(html_content, "text/html")
  34         messages.append(message)
  35     mail.get_connection().send_messages(messages)
  36 
  37 
  38 def participation_state_changed(participation: AbstractParticipation):
  39     if participation.state != AbstractParticipation.States.USER_DECLINED:
  40         messages = []
  41 
  42         # send mail to the participant whose participation has been changed
  43         if participation.participant.email is not None:
  44             text_content = _(
  45                 "The status for your participation for {shift} has changed. It is now {status}."
  46             ).format(shift=participation.shift, status=participation.get_state_display())
  47             html_content = render_to_string("email_base.html", {"message_text": text_content})
  48             message = EmailMultiAlternatives(
  49                 to=[participation.participant.email],
  50                 subject=_("Your participation state changed"),
  51                 body=text_content,
  52             )
  53             message.attach_alternative(html_content, "text/html")
  54             messages.append(message)
  55 
  56         # send mail to responsible users
  57         responsible_users = get_users_with_perms(
  58             participation.shift.event, only_with_perms_in=["change_event"]
  59         ).distinct()
  60         subject = _("Participation was changed for your event")
  61         text_content = _(
  62             "The participation of {participant} for {shift} was changed. The status is now {status}"
  63         ).format(
  64             participant=participation.participant,
  65             shift=participation.shift,
  66             status=participation.get_state_display(),
  67         )
  68         html_content = render_to_string("email_base.html", {"message_text": text_content})
  69         for user in responsible_users:
  70             message = EmailMultiAlternatives(to=[user.email], subject=subject, body=text_content)
  71             message.attach_alternative(html_content, "text/html")
  72             messages.append(message)
  73 
  74         mail.get_connection().send_messages(messages)
  75
  ```
  
  Path: `ephios/user_management/mail.py`
  Content:
  ```
  1 from django.contrib.auth.tokens import default_token_generator
  2 from django.core.mail import EmailMultiAlternatives
  3 from django.template.loader import render_to_string
  4 from django.urls import reverse
  5 from django.utils.encoding import force_bytes
  6 from django.utils.http import urlsafe_base64_encode
  7 from django.utils.translation import gettext as _
  8 
  9 from ephios.settings import SITE_URL
  10 
  11 
  12 def send_account_creation_info(userprofile):
  13     subject = _("Welcome to ephios!")
  14     uid = urlsafe_base64_encode(force_bytes(userprofile.id))
  15     token = default_token_generator.make_token(userprofile)
  16     reset_link = reverse("password_reset_confirm", kwargs={"uidb64": uid, "token": token})
  17     text_content = _(
  18         "You're receiving this email because a new account has been created for you at ephios.\n"
  19         "Please go to the following page and choose a password: {url}{reset_link}\n"
  20         "Your username is your email address: {email}\n"
  21     ).format(url=SITE_URL, reset_link=reset_link, email=userprofile.email)
  22 
  23     html_content = render_to_string(
  24         "user_management/new_account_email.html",
  25         {"uid": uid, "token": token, "site_url": SITE_URL, "email": userprofile.email},
  26     )
  27     message = EmailMultiAlternatives(to=[userprofile.email], subject=subject, body=text_content)
  28     message.attach_alternative(html_content, "text/html")
  29     message.send()
  30 
  31 
  32 def send_account_update_info(userprofile):
  33     subject = _("ephios account updated")
  34     url = reverse("user_management:profile")
  35     text_content = _(
  36         "You're receiving this email because your account at ephios has been updated.\n"
  37         "You can see the changes in your profile: {site_url}{url}\n"
  38         "Your username is your email address: {email}\n"
  39     ).format(site_url=SITE_URL, url=url, email=userprofile.email)
  40 
  41     html_content = render_to_string(
  42         "user_management/account_updated_email.html",
  43         {"site_url": SITE_URL, "url": url, "email": userprofile.email},
  44     )
  45     message = EmailMultiAlternatives(to=[userprofile.email], subject=subject, body=text_content)
  46     message.attach_alternative(html_content, "text/html")
  47     message.send()
  48
  ```
  --- 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/ephios/event_management/mail.py b/ephios/event_management/mail.py
  --- a/ephios/event_management/mail.py
  +++ b/ephios/event_management/mail.py
  @@ -1,3 +1,5 @@
  +from urllib.parse import urljoin
  +
   from django.core import mail
   from django.core.mail import EmailMultiAlternatives
   from django.template.loader import render_to_string
  @@ -20,8 +22,16 @@
   
       subject = _("New {type}: {title}").format(type=event.type, title=event.title)
       text_content = _(
  -        "A new {type} ({title}) has been added. \n You can view it here: {link}"
  -    ).format(type=event.type, title=event.title, link=event.get_absolute_url())
  +        "A new {type} ({title}, {location}) has been added.\n"
  +        "Further information: {description}\n"
  +        "You can view the event here: {url}"
  +    ).format(
  +        type=event.type,
  +        title=event.title,
  +        location=event.location,
  +        description=event.description,
  +        url=urljoin(SITE_URL, event.get_absolute_url()),
  +    )
       html_content = render_to_string(
           "event_management/mails/new_event.html", {"event": event, "site_url": SITE_URL}
       )
  diff --git a/ephios/user_management/mail.py b/ephios/user_management/mail.py
  --- a/ephios/user_management/mail.py
  +++ b/ephios/user_management/mail.py
  @@ -1,3 +1,5 @@
  +from urllib.parse import urljoin
  +
   from django.contrib.auth.tokens import default_token_generator
   from django.core.mail import EmailMultiAlternatives
   from django.template.loader import render_to_string
  @@ -16,9 +18,9 @@
       reset_link = reverse("password_reset_confirm", kwargs={"uidb64": uid, "token": token})
       text_content = _(
           "You're receiving this email because a new account has been created for you at ephios.\n"
  -        "Please go to the following page and choose a password: {url}{reset_link}\n"
  +        "Please go to the following page and choose a password: {url}\n"
           "Your username is your email address: {email}\n"
  -    ).format(url=SITE_URL, reset_link=reset_link, email=userprofile.email)
  +    ).format(url=urljoin(SITE_URL, reset_link), email=userprofile.email)
   
       html_content = render_to_string(
           "user_management/new_account_email.html",
  @@ -34,9 +36,9 @@
       url = reverse("user_management:profile")
       text_content = _(
           "You're receiving this email because your account at ephios has been updated.\n"
  -        "You can see the changes in your profile: {site_url}{url}\n"
  +        "You can see the changes in your profile: {url}\n"
           "Your username is your email address: {email}\n"
  -    ).format(site_url=SITE_URL, url=url, email=userprofile.email)
  +    ).format(url=urljoin(SITE_URL, url), email=userprofile.email)
   
       html_content = render_to_string(
           "user_management/account_updated_email.html",
  
verification_info: {"golden_diff": "diff --git a/ephios/event_management/mail.py b/ephios/event_management/mail.py\n--- a/ephios/event_management/mail.py\n+++ b/ephios/event_management/mail.py\n@@ -1,3 +1,5 @@\n+from urllib.parse import urljoin\n+\n from django.core import mail\n from django.core.mail import EmailMultiAlternatives\n from django.template.loader import render_to_string\n@@ -20,8 +22,16 @@\n \n     subject = _(\"New {type}: {title}\").format(type=event.type, title=event.title)\n     text_content = _(\n-        \"A new {type} ({title}) has been added. \\n You can view it here: {link}\"\n-    ).format(type=event.type, title=event.title, link=event.get_absolute_url())\n+        \"A new {type} ({title}, {location}) has been added.\\n\"\n+        \"Further information: {description}\\n\"\n+        \"You can view the event here: {url}\"\n+    ).format(\n+        type=event.type,\n+        title=event.title,\n+        location=event.location,\n+        description=event.description,\n+        url=urljoin(SITE_URL, event.get_absolute_url()),\n+    )\n     html_content = render_to_string(\n         \"event_management/mails/new_event.html\", {\"event\": event, \"site_url\": SITE_URL}\n     )\ndiff --git a/ephios/user_management/mail.py b/ephios/user_management/mail.py\n--- a/ephios/user_management/mail.py\n+++ b/ephios/user_management/mail.py\n@@ -1,3 +1,5 @@\n+from urllib.parse import urljoin\n+\n from django.contrib.auth.tokens import default_token_generator\n from django.core.mail import EmailMultiAlternatives\n from django.template.loader import render_to_string\n@@ -16,9 +18,9 @@\n     reset_link = reverse(\"password_reset_confirm\", kwargs={\"uidb64\": uid, \"token\": token})\n     text_content = _(\n         \"You're receiving this email because a new account has been created for you at ephios.\\n\"\n-        \"Please go to the following page and choose a password: {url}{reset_link}\\n\"\n+        \"Please go to the following page and choose a password: {url}\\n\"\n         \"Your username is your email address: {email}\\n\"\n-    ).format(url=SITE_URL, reset_link=reset_link, email=userprofile.email)\n+    ).format(url=urljoin(SITE_URL, reset_link), email=userprofile.email)\n \n     html_content = render_to_string(\n         \"user_management/new_account_email.html\",\n@@ -34,9 +36,9 @@\n     url = reverse(\"user_management:profile\")\n     text_content = _(\n         \"You're receiving this email because your account at ephios has been updated.\\n\"\n-        \"You can see the changes in your profile: {site_url}{url}\\n\"\n+        \"You can see the changes in your profile: {url}\\n\"\n         \"Your username is your email address: {email}\\n\"\n-    ).format(site_url=SITE_URL, url=url, email=userprofile.email)\n+    ).format(url=urljoin(SITE_URL, url), email=userprofile.email)\n \n     html_content = render_to_string(\n         \"user_management/account_updated_email.html\",\n", "issue": "Event creation mails do not include event description\n\n", "before_files": [{"content": "from django.core import mail\nfrom django.core.mail import EmailMultiAlternatives\nfrom django.template.loader import render_to_string\nfrom django.utils.translation import gettext as _\nfrom guardian.shortcuts import get_users_with_perms\n\nfrom ephios.event_management.models import AbstractParticipation\nfrom ephios.extra.permissions import get_groups_with_perms\nfrom ephios.settings import SITE_URL\nfrom ephios.user_management.models import UserProfile\n\n\ndef new_event(event):\n    messages = []\n    users = UserProfile.objects.filter(\n        groups__in=get_groups_with_perms(event, only_with_perms_in=[\"view_event\"]), is_active=True\n    ).distinct()\n    responsible_users = get_users_with_perms(event, only_with_perms_in=[\"change_event\"]).distinct()\n    responsible_persons_mails = list(responsible_users.values_list(\"email\", flat=True))\n\n    subject = _(\"New {type}: {title}\").format(type=event.type, title=event.title)\n    text_content = _(\n        \"A new {type} ({title}) has been added. \\n You can view it here: {link}\"\n    ).format(type=event.type, title=event.title, link=event.get_absolute_url())\n    html_content = render_to_string(\n        \"event_management/mails/new_event.html\", {\"event\": event, \"site_url\": SITE_URL}\n    )\n\n    for user in users:\n        message = EmailMultiAlternatives(\n            to=[user.email], subject=subject, body=text_content, reply_to=responsible_persons_mails\n        )\n        message.attach_alternative(html_content, \"text/html\")\n        messages.append(message)\n    mail.get_connection().send_messages(messages)\n\n\ndef participation_state_changed(participation: AbstractParticipation):\n    if participation.state != AbstractParticipation.States.USER_DECLINED:\n        messages = []\n\n        # send mail to the participant whose participation has been changed\n        if participation.participant.email is not None:\n            text_content = _(\n                \"The status for your participation for {shift} has changed. It is now {status}.\"\n            ).format(shift=participation.shift, status=participation.get_state_display())\n            html_content = render_to_string(\"email_base.html\", {\"message_text\": text_content})\n            message = EmailMultiAlternatives(\n                to=[participation.participant.email],\n                subject=_(\"Your participation state changed\"),\n                body=text_content,\n            )\n            message.attach_alternative(html_content, \"text/html\")\n            messages.append(message)\n\n        # send mail to responsible users\n        responsible_users = get_users_with_perms(\n            participation.shift.event, only_with_perms_in=[\"change_event\"]\n        ).distinct()\n        subject = _(\"Participation was changed for your event\")\n        text_content = _(\n            \"The participation of {participant} for {shift} was changed. The status is now {status}\"\n        ).format(\n            participant=participation.participant,\n            shift=participation.shift,\n            status=participation.get_state_display(),\n        )\n        html_content = render_to_string(\"email_base.html\", {\"message_text\": text_content})\n        for user in responsible_users:\n            message = EmailMultiAlternatives(to=[user.email], subject=subject, body=text_content)\n            message.attach_alternative(html_content, \"text/html\")\n            messages.append(message)\n\n        mail.get_connection().send_messages(messages)\n", "path": "ephios/event_management/mail.py"}, {"content": "from django.contrib.auth.tokens import default_token_generator\nfrom django.core.mail import EmailMultiAlternatives\nfrom django.template.loader import render_to_string\nfrom django.urls import reverse\nfrom django.utils.encoding import force_bytes\nfrom django.utils.http import urlsafe_base64_encode\nfrom django.utils.translation import gettext as _\n\nfrom ephios.settings import SITE_URL\n\n\ndef send_account_creation_info(userprofile):\n    subject = _(\"Welcome to ephios!\")\n    uid = urlsafe_base64_encode(force_bytes(userprofile.id))\n    token = default_token_generator.make_token(userprofile)\n    reset_link = reverse(\"password_reset_confirm\", kwargs={\"uidb64\": uid, \"token\": token})\n    text_content = _(\n        \"You're receiving this email because a new account has been created for you at ephios.\\n\"\n        \"Please go to the following page and choose a password: {url}{reset_link}\\n\"\n        \"Your username is your email address: {email}\\n\"\n    ).format(url=SITE_URL, reset_link=reset_link, email=userprofile.email)\n\n    html_content = render_to_string(\n        \"user_management/new_account_email.html\",\n        {\"uid\": uid, \"token\": token, \"site_url\": SITE_URL, \"email\": userprofile.email},\n    )\n    message = EmailMultiAlternatives(to=[userprofile.email], subject=subject, body=text_content)\n    message.attach_alternative(html_content, \"text/html\")\n    message.send()\n\n\ndef send_account_update_info(userprofile):\n    subject = _(\"ephios account updated\")\n    url = reverse(\"user_management:profile\")\n    text_content = _(\n        \"You're receiving this email because your account at ephios has been updated.\\n\"\n        \"You can see the changes in your profile: {site_url}{url}\\n\"\n        \"Your username is your email address: {email}\\n\"\n    ).format(site_url=SITE_URL, url=url, email=userprofile.email)\n\n    html_content = render_to_string(\n        \"user_management/account_updated_email.html\",\n        {\"site_url\": SITE_URL, \"url\": url, \"email\": userprofile.email},\n    )\n    message = EmailMultiAlternatives(to=[userprofile.email], subject=subject, body=text_content)\n    message.attach_alternative(html_content, \"text/html\")\n    message.send()\n", "path": "ephios/user_management/mail.py"}], "after_files": [{"content": "from urllib.parse import urljoin\n\nfrom django.core import mail\nfrom django.core.mail import EmailMultiAlternatives\nfrom django.template.loader import render_to_string\nfrom django.utils.translation import gettext as _\nfrom guardian.shortcuts import get_users_with_perms\n\nfrom ephios.event_management.models import AbstractParticipation\nfrom ephios.extra.permissions import get_groups_with_perms\nfrom ephios.settings import SITE_URL\nfrom ephios.user_management.models import UserProfile\n\n\ndef new_event(event):\n    messages = []\n    users = UserProfile.objects.filter(\n        groups__in=get_groups_with_perms(event, only_with_perms_in=[\"view_event\"]), is_active=True\n    ).distinct()\n    responsible_users = get_users_with_perms(event, only_with_perms_in=[\"change_event\"]).distinct()\n    responsible_persons_mails = list(responsible_users.values_list(\"email\", flat=True))\n\n    subject = _(\"New {type}: {title}\").format(type=event.type, title=event.title)\n    text_content = _(\n        \"A new {type} ({title}, {location}) has been added.\\n\"\n        \"Further information: {description}\\n\"\n        \"You can view the event here: {url}\"\n    ).format(\n        type=event.type,\n        title=event.title,\n        location=event.location,\n        description=event.description,\n        url=urljoin(SITE_URL, event.get_absolute_url()),\n    )\n    html_content = render_to_string(\n        \"event_management/mails/new_event.html\", {\"event\": event, \"site_url\": SITE_URL}\n    )\n\n    for user in users:\n        message = EmailMultiAlternatives(\n            to=[user.email], subject=subject, body=text_content, reply_to=responsible_persons_mails\n        )\n        message.attach_alternative(html_content, \"text/html\")\n        messages.append(message)\n    mail.get_connection().send_messages(messages)\n\n\ndef participation_state_changed(participation: AbstractParticipation):\n    if participation.state != AbstractParticipation.States.USER_DECLINED:\n        messages = []\n\n        # send mail to the participant whose participation has been changed\n        if participation.participant.email is not None:\n            text_content = _(\n                \"The status for your participation for {shift} has changed. It is now {status}.\"\n            ).format(shift=participation.shift, status=participation.get_state_display())\n            html_content = render_to_string(\"email_base.html\", {\"message_text\": text_content})\n            message = EmailMultiAlternatives(\n                to=[participation.participant.email],\n                subject=_(\"Your participation state changed\"),\n                body=text_content,\n            )\n            message.attach_alternative(html_content, \"text/html\")\n            messages.append(message)\n\n        # send mail to responsible users\n        responsible_users = get_users_with_perms(\n            participation.shift.event, only_with_perms_in=[\"change_event\"]\n        ).distinct()\n        subject = _(\"Participation was changed for your event\")\n        text_content = _(\n            \"The participation of {participant} for {shift} was changed. The status is now {status}\"\n        ).format(\n            participant=participation.participant,\n            shift=participation.shift,\n            status=participation.get_state_display(),\n        )\n        html_content = render_to_string(\"email_base.html\", {\"message_text\": text_content})\n        for user in responsible_users:\n            message = EmailMultiAlternatives(to=[user.email], subject=subject, body=text_content)\n            message.attach_alternative(html_content, \"text/html\")\n            messages.append(message)\n\n        mail.get_connection().send_messages(messages)\n", "path": "ephios/event_management/mail.py"}, {"content": "from urllib.parse import urljoin\n\nfrom django.contrib.auth.tokens import default_token_generator\nfrom django.core.mail import EmailMultiAlternatives\nfrom django.template.loader import render_to_string\nfrom django.urls import reverse\nfrom django.utils.encoding import force_bytes\nfrom django.utils.http import urlsafe_base64_encode\nfrom django.utils.translation import gettext as _\n\nfrom ephios.settings import SITE_URL\n\n\ndef send_account_creation_info(userprofile):\n    subject = _(\"Welcome to ephios!\")\n    uid = urlsafe_base64_encode(force_bytes(userprofile.id))\n    token = default_token_generator.make_token(userprofile)\n    reset_link = reverse(\"password_reset_confirm\", kwargs={\"uidb64\": uid, \"token\": token})\n    text_content = _(\n        \"You're receiving this email because a new account has been created for you at ephios.\\n\"\n        \"Please go to the following page and choose a password: {url}\\n\"\n        \"Your username is your email address: {email}\\n\"\n    ).format(url=urljoin(SITE_URL, reset_link), email=userprofile.email)\n\n    html_content = render_to_string(\n        \"user_management/new_account_email.html\",\n        {\"uid\": uid, \"token\": token, \"site_url\": SITE_URL, \"email\": userprofile.email},\n    )\n    message = EmailMultiAlternatives(to=[userprofile.email], subject=subject, body=text_content)\n    message.attach_alternative(html_content, \"text/html\")\n    message.send()\n\n\ndef send_account_update_info(userprofile):\n    subject = _(\"ephios account updated\")\n    url = reverse(\"user_management:profile\")\n    text_content = _(\n        \"You're receiving this email because your account at ephios has been updated.\\n\"\n        \"You can see the changes in your profile: {url}\\n\"\n        \"Your username is your email address: {email}\\n\"\n    ).format(url=urljoin(SITE_URL, url), email=userprofile.email)\n\n    html_content = render_to_string(\n        \"user_management/account_updated_email.html\",\n        {\"site_url\": SITE_URL, \"url\": url, \"email\": userprofile.email},\n    )\n    message = EmailMultiAlternatives(to=[userprofile.email], subject=subject, body=text_content)\n    message.attach_alternative(html_content, \"text/html\")\n    message.send()\n", "path": "ephios/user_management/mail.py"}]}