From b6a0f780f0802fbb78b6c84259c1d4ef5be90ca8 Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Fri, 7 Dec 2012 19:10:16 +0530 Subject: [PATCH] fix in assign notifications --- utilities/page/messages/messages.py | 30 +++++++++++++++++------------ 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/utilities/page/messages/messages.py b/utilities/page/messages/messages.py index a7c7acb6d5..b46e03c5a6 100644 --- a/utilities/page/messages/messages.py +++ b/utilities/page/messages/messages.py @@ -94,21 +94,27 @@ def notify(arg=None): else: fn = webnotes.user.name - message = '''A new comment has been posted on your page by %s: + url = get_url() + message = '''You have a message by %s: - Comment: %s + %s - To answer, please login to your erpnext account! - ''' % (fn, arg['txt']) + To answer, please login to your erpnext account at \ + %s + ''' % (fn, arg['txt'], url, url) - from webnotes.model.code import get_obj - note = get_obj('Notification Control') - email_msg = note.prepare_message({ - 'type': 'New Comment', - 'message': message - }) - sender = webnotes.user.name!='Administrator' and webnotes.user.name or 'support+admin_post@erpnext.com' from webnotes.utils.email_lib import sendmail - sendmail([arg['contact']], sender, email_msg, fn + ' has posted a new comment') + sendmail([arg['contact']], sender, message, fn + ' has posted a new comment') + +def get_url(): + from webnotes.utils import get_request_site_address + url = get_request_site_address() + if not url or "localhost" in url: + subdomain = webnotes.conn.get_value("Website Settings", "Website Settings", + "subdomain") + if subdomain: + if "http" not in subdomain: + url = "http://" + subdomain + return url