FirstID and LastID are not nullable
This commit is contained in:
parent
b0f75675c8
commit
93318c378a
|
@ -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"`
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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]
|
||||
|
|
|
@ -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]
|
||||
|
|
Loading…
Reference in New Issue