Rename ThreadUnread to just Unread

This commit is contained in:
Asaf Gartner 2021-09-24 03:15:29 +03:00
parent f8985e6ee3
commit a3e7e2afc0
3 changed files with 5 additions and 5 deletions

View File

@ -293,7 +293,7 @@ func fetchAllPosts(c *RequestContext, offset int, limit int) ([]templates.PostLi
&postAndStuff.Thread,
&postAndStuff.Post,
postAndStuff.Author,
postAndStuff.ThreadUnread,
postAndStuff.Unread,
true,
c.Theme,
)

View File

@ -142,7 +142,7 @@ func Index(c *RequestContext) ResponseData {
Url: hmnurl.BuildBlogThread(proj.Slug, projectPost.Thread.ID, projectPost.Thread.Title),
User: templates.UserToTemplate(projectPost.Author, c.Theme),
Date: projectPost.Post.PostDate,
Unread: projectPost.ThreadUnread,
Unread: projectPost.Unread,
Content: template.HTML(content),
}
} else {
@ -154,7 +154,7 @@ func Index(c *RequestContext) ResponseData {
&projectPost.Thread,
&projectPost.Post,
projectPost.Author,
projectPost.ThreadUnread,
projectPost.Unread,
false,
c.Theme,
),

View File

@ -279,7 +279,7 @@ type PostsQuery struct {
type PostAndStuff struct {
Project models.Project `db:"project"`
Thread models.Thread `db:"thread"`
ThreadUnread bool
Unread bool
Post models.Post `db:"post"`
CurrentVersion models.PostVersion `db:"ver"`
Author *models.User `db:"author"` // Can be nil in case of a deleted user
@ -408,7 +408,7 @@ func FetchPosts(
} else if row.ForumLastReadTime != nil && row.ForumLastReadTime.After(row.Post.PostDate) {
hasRead = true
}
row.ThreadUnread = !hasRead
row.Unread = !hasRead
if row.ReplyPost != nil && row.ReplyAuthor != nil {
replyAuthorIsNotApproved := row.ReplyAuthor.Status != models.UserStatusApproved