Archived
1
0

fix making new threads

This commit is contained in:
Jeff Becker 2016-11-06 17:55:02 -05:00
parent 64b345a7f0
commit 2a744c45a2
No known key found for this signature in database
GPG Key ID: AB950234D6EA286B
2 changed files with 4 additions and 3 deletions

View File

@ -49,8 +49,9 @@ def createPost(newsgroup, ref, form, files):
msg["Subject"] = form["subject"] or "None"
msg['Date'] = email.utils.format_datetime(datetime.now())
msg['Message-ID'] = email.utils.make_msgid(randstr(13), settings.FRONTEND_NAME)
if not msgid_valid(ref):
if ref and not msgid_valid(ref):
return None, "invalid reference: {}".format(ref)
if ref:
msg["References"] = ref
msg["Newsgroups"] = newsgroup
msg["From"] = '{} <anon@django.nntpchan.tld>'.format(form['name'] or 'Anonymous')

View File

@ -57,7 +57,7 @@ class BoardView(generic.View, Postable):
name = 'overchan.{}'.format(name)
if not util.newsgroup_valid(name):
return None, "invalid newsgroup: {}".format(name)
return util.createPost(name, '', request.POST, request.FILES)
return util.createPost(name, None, request.POST, request.FILES)
def get(self, request, name):