From 1925d4a2c60bd0bcb6693d5181e7f56d5377c012 Mon Sep 17 00:00:00 2001 From: Amy Gale Ruth Bowersox Date: Tue, 27 Jan 2026 12:46:36 -0700 Subject: [PATCH] fix to Topic.GetLastRead --- database/topic.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/database/topic.go b/database/topic.go index 0979964..3b4803c 100644 --- a/database/topic.go +++ b/database/topic.go @@ -11,6 +11,7 @@ package database import ( "context" + "database/sql" "errors" "fmt" "strings" @@ -82,6 +83,9 @@ func (t *Topic) GetLastRead(ctx context.Context, u *User) (int32, error) { row := amdb.QueryRowContext(ctx, "SELECT last_message FROM topicsettings WHERE topicid = ? AND uid = ?", t.TopicId, u.Uid) var rc int32 = -1 err := row.Scan(&rc) + if err == sql.ErrNoRows { + return -1, nil + } return rc, err }