Repository: fossasia/open-event-server

Issue:
URL in ticket confirmation mail is hardcoded to eventyay.com
The ticket-purchased and ticket-cancelled message templates have the phrase '.Login to manage your orders at https://eventyay.com' hardcoded. 

**Affected Version**
Backend 1.3.0
Frontend 1.1.0

**To Reproduce**
* Set the frontend URL in system settings to something other than eventyay.com
* Have a ticket purchase / cancel message sent to you.

**Expected behaviour**
The messages should include the frontend URL specified in system settings.


Discussion:
Issue-Label Bot is automatically applying the label `bug` to this issue, with a confidence of 0.89. Please mark this comment with :thumbsup: or :thumbsdown: to give our bot feedback! 

 Links: [app homepage](https://github.com/marketplace/issue-label-bot), [dashboard](https://mlbot.net/data/fossasia/open-event-server) and [code](https://github.com/hamelsmu/MLapp) for this bot.
Will fix this right away

Resolving patch:
diff --git a/app/api/helpers/mail.py b/app/api/helpers/mail.py
--- a/app/api/helpers/mail.py
+++ b/app/api/helpers/mail.py
@@ -335,11 +335,13 @@ def send_email_to_attendees(order, purchaser_id, attachments=None):
                 action=TICKET_PURCHASED,
                 subject=MAILS[TICKET_PURCHASED]['subject'].format(
                     event_name=order.event.name,
-                    invoice_id=order.invoice_number
+                    invoice_id=order.invoice_number,
+                    frontend_url=get_settings()['frontend_url']
                 ),
                 html=MAILS[TICKET_PURCHASED]['message'].format(
                     pdf_url=holder.pdf_url,
-                    event_name=order.event.name
+                    event_name=order.event.name,
+                    frontend_url=get_settings()['frontend_url']
                 ),
                 attachments=attachments
             )
@@ -366,11 +368,13 @@ def send_order_cancel_email(order):
         action=TICKET_CANCELLED,
         subject=MAILS[TICKET_CANCELLED]['subject'].format(
             event_name=order.event.name,
-            invoice_id=order.invoice_number
+            invoice_id=order.invoice_number,
+            frontend_url=get_settings()['frontend_url']
         ),
         html=MAILS[TICKET_CANCELLED]['message'].format(
             event_name=order.event.name,
             order_url=make_frontend_url('/orders/{identifier}'.format(identifier=order.identifier)),
-            cancel_note=order.cancel_note
+            cancel_note=order.cancel_note,
+            frontend_url=get_settings()['frontend_url']
         )
     )
diff --git a/app/api/helpers/system_mails.py b/app/api/helpers/system_mails.py
--- a/app/api/helpers/system_mails.py
+++ b/app/api/helpers/system_mails.py
@@ -9,6 +9,8 @@
     MONTHLY_PAYMENT_FOLLOWUP_EMAIL, EVENT_IMPORTED, EVENT_IMPORT_FAIL, TICKET_PURCHASED_ORGANIZER, TICKET_CANCELLED, \
     TICKET_PURCHASED_ATTENDEE, PASSWORD_CHANGE, PASSWORD_RESET_AND_VERIFY, USER_EVENT_ROLE, TEST_MAIL
 
+
+
 MAILS = {
     EVENT_PUBLISH: {
         'recipient': 'Owner, Organizer, Speaker',
@@ -157,7 +159,7 @@
             u"<br/>Your order has been processed successfully." +
             u"<br/> You can find your Tickets and Order Invoice attached to this mail."
             u"<br><br><em>Looking forward to seeing you at the event."
-            u"<br/>Login to manage your orders at https://eventyay.com </em>"
+            u"<br/>Login to manage your orders at {frontend_url} </em>"
         )
     },
     TICKET_PURCHASED_ATTENDEE: {
@@ -178,7 +180,7 @@
             u"Hi, {buyer_email} just bought tickets for the event {event_name}"
             u"<br/>The order has been processed successfully." +
             u"<br/> <a href='{order_url}'>Click here</a> to view/download the invoice."
-            u"<br/>Login to manage the orders at https://eventyay.com </em>"
+            u"<br/>Login to manage the orders at {frontend_url} </em>"
         )
     },
     TICKET_CANCELLED: {
@@ -189,7 +191,7 @@
             u"<br/>Please contact the organizer for more info" +
             u"<br/>Message from the organizer: {cancel_note}"
             u"<br/> <a href='{order_url}'>Click here</a> to view/download the invoice."
-            u"<br/>Login to manage the orders at https://eventyay.com </em>"
+            u"<br/>Login to manage the orders at {frontend_url} </em>"
         )
     },
     EVENT_EXPORTED: {


Test patch: