Commit 031ee228 authored by Giuseppe Terrasi's avatar Giuseppe Terrasi

merge from lp:~giuseppeterrasi/ubuntu-it-ask/sync-with-upstream
sync with upstream rev 1277
parents ad1a5116 734a9031
......@@ -167,6 +167,9 @@ this.makeHtml = function(text) {
// attacklab: Restore tildes
text = text.replace(/~T/g,"~");
text = text.replace(/&amp;lt;/g,"<");
text = text.replace(/&amp;gt;/g,">");
return text;
}
......@@ -1328,4 +1331,4 @@ var Showdown = Attacklab.showdown;
// If anyone's interested, tell the world that this file's been loaded
if (Attacklab.fileLoaded) {
Attacklab.fileLoaded("showdown.js");
}
\ No newline at end of file
}
......@@ -28,7 +28,12 @@ function ajaxFileUpload(imageUrl)
if(error != ''){
alert(error);
}else{
imageUrl.attr('value', appUrl + fileURL);
if(fileURL == ''){
alert("There was an internal server error uploading your file.\nPermission denied.");
}
else{
imageUrl.attr('value', appUrl + fileURL);
}
}
},
......
......@@ -20,7 +20,7 @@ class MultiUserMailMessage(template.Node):
self.nodelist.render(context)
messages.append((recipient, context['subject'], context['htmlcontent'], context['textcontent'], context['embeddedmedia']))
create_and_send_mail_messages(messages)
create_and_send_mail_messages(messages, sender_data=context['sender'], reply_to=context['reply_to'])
@register.tag
def email(parser, token):
......
......@@ -24,9 +24,9 @@ from forum.context import application_settings
from forum.utils.html2text import HTML2Text
from threading import Thread
def send_template_email(recipients, template, context):
def send_template_email(recipients, template, context, sender=None, reply_to = None):
t = loader.get_template(template)
context.update(dict(recipients=recipients, settings=settings))
context.update(dict(recipients=recipients, settings=settings, sender=sender, reply_to=reply_to))
t.render(Context(context))
def create_connection():
......@@ -44,16 +44,23 @@ def create_connection():
return connection
def create_and_send_mail_messages(messages):
def create_and_send_mail_messages(messages, sender_data=None, reply_to=None):
if not settings.EMAIL_HOST:
return
sender = Header(unicode(settings.APP_SHORT_NAME), 'utf-8')
sender.append('<%s>' % unicode(settings.DEFAULT_FROM_EMAIL))
sender = u'%s <%s>' % (unicode(settings.APP_SHORT_NAME), unicode(settings.DEFAULT_FROM_EMAIL))
reply_to = unicode(settings.DEFAULT_REPLY_TO_EMAIL)
if sender_data == None:
sender.append('<%s>' % unicode(settings.DEFAULT_FROM_EMAIL))
sender = u'%s <%s>' % (unicode(settings.APP_SHORT_NAME), unicode(settings.DEFAULT_FROM_EMAIL))
else:
sender.append('<%s>' % unicode(sender_data['email']))
sender = u'%s <%s>' % (unicode(sender_data['name']), unicode(sender_data['email']))
if reply_to == None:
reply_to = unicode(settings.DEFAULT_REPLY_TO_EMAIL)
else:
reply_to = unicode(reply_to)
try:
connection = None
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment