Compare commits

..

No commits in common. "738b4163a890574c2785f4d7475364c54c1b76ad" and "12269dd9b3ab210d630bb23a90a62d01a79d28c2" have entirely different histories.

3 changed files with 4 additions and 16 deletions

View File

@ -62,10 +62,5 @@ return {
[8] = function ()
schema.add_column("topics", "sort_order", types.integer{default = 0})
db.query("UPDATE topics SET sort_order = (SELECT COUNT(*) FROM topics t2 WHERE t2.ROWID <= topics.ROWID)")
end,
[9] = function ()
schema.add_column("post_history", "original_markup", types.text{null = false})
schema.add_column("post_history", "markup_language", types.text{default = "babycode"})
end,
end
}

View File

@ -3,7 +3,6 @@
set -e
start() {
lapis migrate
lapis serve
}

View File

@ -214,8 +214,7 @@ function util.destroy_avatar(avatar_id)
end
end
function util.create_post(thread_id, user_id, content, markup_language)
markup_language = markup_language or "babycode"
function util.create_post(thread_id, user_id, content)
db.query("BEGIN")
local post = Posts:create({
thread_id = thread_id,
@ -223,17 +222,12 @@ function util.create_post(thread_id, user_id, content, markup_language)
current_revision_id = db.NULL,
})
local parsed_content = ""
if markup_language == "babycode" then
parsed_content = babycode.to_html(content, html_escape)
end
local bb_content = babycode.to_html(content, html_escape)
local revision = PostHistory:create({
post_id = post.id,
content = parsed_content,
content = bb_content,
is_initial_revision = true,
original_markup = content,
markup_language = "babycode",
})
post:update({current_revision_id = revision.id})