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) { ...@@ -167,6 +167,9 @@ this.makeHtml = function(text) {
// attacklab: Restore tildes // attacklab: Restore tildes
text = text.replace(/~T/g,"~"); text = text.replace(/~T/g,"~");
text = text.replace(/&amp;lt;/g,"<");
text = text.replace(/&amp;gt;/g,">");
return text; return text;
} }
......
...@@ -28,8 +28,13 @@ function ajaxFileUpload(imageUrl) ...@@ -28,8 +28,13 @@ function ajaxFileUpload(imageUrl)
if(error != ''){ if(error != ''){
alert(error); alert(error);
}else{ }else{
if(fileURL == ''){
alert("There was an internal server error uploading your file.\nPermission denied.");
}
else{
imageUrl.attr('value', appUrl + fileURL); imageUrl.attr('value', appUrl + fileURL);
} }
}
}, },
error: function (data, status, e) error: function (data, status, e)
......
...@@ -20,7 +20,7 @@ class MultiUserMailMessage(template.Node): ...@@ -20,7 +20,7 @@ class MultiUserMailMessage(template.Node):
self.nodelist.render(context) self.nodelist.render(context)
messages.append((recipient, context['subject'], context['htmlcontent'], context['textcontent'], context['embeddedmedia'])) 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 @register.tag
def email(parser, token): def email(parser, token):
......
...@@ -24,9 +24,9 @@ from forum.context import application_settings ...@@ -24,9 +24,9 @@ from forum.context import application_settings
from forum.utils.html2text import HTML2Text from forum.utils.html2text import HTML2Text
from threading import Thread 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) 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)) t.render(Context(context))
def create_connection(): def create_connection():
...@@ -44,16 +44,23 @@ def create_connection(): ...@@ -44,16 +44,23 @@ def create_connection():
return 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: if not settings.EMAIL_HOST:
return return
sender = Header(unicode(settings.APP_SHORT_NAME), 'utf-8') sender = Header(unicode(settings.APP_SHORT_NAME), 'utf-8')
if sender_data == None:
sender.append('<%s>' % unicode(settings.DEFAULT_FROM_EMAIL)) sender.append('<%s>' % unicode(settings.DEFAULT_FROM_EMAIL))
sender = u'%s <%s>' % (unicode(settings.APP_SHORT_NAME), 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) reply_to = unicode(settings.DEFAULT_REPLY_TO_EMAIL)
else:
reply_to = unicode(reply_to)
try: try:
connection = None 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