From 93318c378aaa90db339b33353e157d573dec1b94 Mon Sep 17 00:00:00 2001 From: Ben Visness Date: Fri, 30 Jul 2021 15:01:40 -0500 Subject: [PATCH] FirstID and LastID are not nullable --- src/models/thread.go | 4 ++-- src/website/forums.go | 2 +- src/website/landing.go | 2 +- src/website/post_helper.go | 2 +- src/website/timeline_helper.go | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/models/thread.go b/src/models/thread.go index 5e7bac9..f35a2ae 100644 --- a/src/models/thread.go +++ b/src/models/thread.go @@ -25,6 +25,6 @@ type Thread struct { Locked bool `db:"locked"` Deleted bool `db:"deleted"` - FirstID *int `db:"first_id"` - LastID *int `db:"last_id"` + FirstID int `db:"first_id"` + LastID int `db:"last_id"` } diff --git a/src/website/forums.go b/src/website/forums.go index 6f869d2..707e502 100644 --- a/src/website/forums.go +++ b/src/website/forums.go @@ -505,7 +505,7 @@ func ForumThread(c *RequestContext) ResponseData { Thread: templates.ThreadToTemplate(&thread), Posts: posts, SubforumUrl: hmnurl.BuildForum(c.CurrentProject.Slug, currentSubforumSlugs, 1), - ReplyUrl: hmnurl.BuildForumPostReply(c.CurrentProject.Slug, currentSubforumSlugs, thread.ID, *thread.FirstID), + ReplyUrl: hmnurl.BuildForumPostReply(c.CurrentProject.Slug, currentSubforumSlugs, thread.ID, thread.FirstID), Pagination: pagination, }, c.Perf) return res diff --git a/src/website/landing.go b/src/website/landing.go index b0877eb..533ea43 100644 --- a/src/website/landing.go +++ b/src/website/landing.go @@ -156,7 +156,7 @@ func Index(c *RequestContext) ResponseData { featurable := (!proj.IsHMN() && projectPost.Post.ThreadType == models.ThreadTypeProjectArticle && - *projectPost.Thread.FirstID == projectPost.Post.ID && + projectPost.Thread.FirstID == projectPost.Post.ID && landingPageProject.FeaturedPost == nil) if featurable { diff --git a/src/website/post_helper.go b/src/website/post_helper.go index 6adf487..d1f7e8f 100644 --- a/src/website/post_helper.go +++ b/src/website/post_helper.go @@ -78,7 +78,7 @@ func MakePostListItem( postTypeOptions, found := PostTypeMap[post.ThreadType] if found { isNotFirst := 0 - if *thread.FirstID != post.ID { + if thread.FirstID != post.ID { isNotFirst = 1 } postType = postTypeOptions[isNotFirst] diff --git a/src/website/timeline_helper.go b/src/website/timeline_helper.go index b7d7c40..a13d719 100644 --- a/src/website/timeline_helper.go +++ b/src/website/timeline_helper.go @@ -51,7 +51,7 @@ func PostToTimelineItem(lineageBuilder *models.SubforumLineageBuilder, post *mod typeByCatKind, found := TimelineTypeMap[post.ThreadType] if found { isNotFirst := 0 - if *thread.FirstID != post.ID { + if thread.FirstID != post.ID { isNotFirst = 1 } itemType = typeByCatKind[isNotFirst]