Commit d0922176 authored by Martin Mareš's avatar Martin Mareš
Browse files

Fixed bug in creation of topics

parent d4c6536a
......@@ -1175,11 +1175,14 @@ def admin_edit_topic(sident, cident, tid=None, copy_tid=None):
return render_template('admin-edit-topic.html', form=form, tid=None, copy_tid=None, post_count=None)
if tid is None:
assert form.copy_to.data is not None
db_query("INSERT INTO owl_topics(cid, type) VALUES(%s, 'H') RETURNING *", (form.copy_to.data,))
if copy_tid is None:
cid = g.course.cid
else:
cid = form.copy_to.data
assert cid is not None
db_query("INSERT INTO owl_topics(cid, type) VALUES(%s, 'H') RETURNING *", (cid,))
row = db.fetchone()
assert row
cid = row.cid
tid = row.tid
app.logger.info(f"Created topic: cid={cid} tid={tid} by_uid={g.uid}")
else:
......
Supports Markdown
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