From c173fae026cb24381a52dda41d633e15b5190c85 Mon Sep 17 00:00:00 2001 From: Robin Malley Date: Tue, 26 Jan 2021 02:12:42 +0000 Subject: [PATCH] Throw a more descriptive error temporarily --- src/lua/endpoints/edit_post.lua | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/lua/endpoints/edit_post.lua b/src/lua/endpoints/edit_post.lua index 488420c..92a0927 100644 --- a/src/lua/endpoints/edit_post.lua +++ b/src/lua/endpoints/edit_post.lua @@ -77,6 +77,14 @@ local function edit_post(req) error("Failed to get a post's hash while trying to make it unlisted") end local hash = stmnt_hash:get_value(0) + -- TODO: Remove this + -- Posts added before the unlisted feature will throw errors + -- when their hash is used to display them, or their url's. + -- when proper database migration tools are in place, remove + -- this bit of code. + if hash == -1 then + error("This post was created before the unlisting feature was added. Temporarily, this breaks. You will be able to unlist it in the future.") + end loc = loc .. "?pwd=" .. util.encode_unlisted(hash) end --Turning something from not unlisted to unlisted should dirty all these