From 0ba9e22f70d8175eb2900242155d87071707a467 Mon Sep 17 00:00:00 2001 From: Robin Malley Date: Tue, 19 May 2020 20:14:22 -0400 Subject: [PATCH] Make the anonymous account id = -1 This change also simplifies the site index query. --- src/sql/insert_anon_author.sql | 2 ++ src/sql/select_site_index.sql | 11 ----------- 2 files changed, 2 insertions(+), 11 deletions(-) diff --git a/src/sql/insert_anon_author.sql b/src/sql/insert_anon_author.sql index f7f3629..b2ff0e6 100644 --- a/src/sql/insert_anon_author.sql +++ b/src/sql/insert_anon_author.sql @@ -1,10 +1,12 @@ INSERT OR IGNORE INTO authors ( + id, name, salt, passhash, joindate, biography ) VALUES ( + -1, 'anonymous', '', '', diff --git a/src/sql/select_site_index.sql b/src/sql/select_site_index.sql index a5bb6fe..024b692 100644 --- a/src/sql/select_site_index.sql +++ b/src/sql/select_site_index.sql @@ -9,17 +9,6 @@ FROM authors WHERE posts.authorid = authors.id -UNION -SELECT - posts.id, - posts.post_title, - posts.isanon, - posts.post_time, - 'Anonymous' -FROM - posts -WHERE - posts.authorid = -1 ORDER BY posts.post_time DESC LIMIT 10;