Mercurial Hosting > freedit
diff src/lib/Post.luan @ 10:de0cbf515ef5
remove author_id
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Thu, 30 Jun 2022 11:11:00 -0600 |
parents | 9674275019bb |
children | bff178656073 |
line wrap: on
line diff
--- a/src/lib/Post.luan Thu Jun 30 00:02:28 2022 -0600 +++ b/src/lib/Post.luan Thu Jun 30 11:11:00 2022 -0600 @@ -2,8 +2,6 @@ local error = Luan.error local ipairs = Luan.ipairs or error() local set_metatable = Luan.set_metatable or error() -local Number = require "luan:Number.luan" -local long = Number.long or error() local Time = require "luan:Time.luan" local time_now = Time.now or error() local Html = require "luan:Html.luan" @@ -20,7 +18,6 @@ content = doc.content date = doc.date author_name = doc.post_author_name - author_id = doc.post_author_id root_id = doc.post_root_id -- root only @@ -39,8 +36,7 @@ content = post.content or error() date = post.date or time_now() post_author_name = post.author_name or error() - post_author_id = long(post.author_id) - post_root_id = post.root_id and long(post.root_id) + post_root_id = post.root_id -- root only subject = post.subject @@ -55,7 +51,7 @@ function metatable.__index(post,key) if key == "author" then local User = require "site:/lib/User.luan" - return User.get_by_id(post.author_id) + return User.get_by_name(post.author_name) end if key == "subject_html" then return post.subject and html_encode(post.subject) @@ -81,7 +77,6 @@ parent_id = post.id content = content author_name = author.name - author_id = author.id } post.save() return post @@ -103,7 +98,6 @@ subject = subject or error() content = content author_name = author.name - author_id = author.id is_root = true } post.save()