link forum list last topics to last pages
This commit is contained in:
parent
9fd88bd6bc
commit
40783f00da
|
@ -40,6 +40,7 @@ type Forum struct {
|
|||
LastReplyer *User
|
||||
LastReplyerID int
|
||||
LastTopicTime string // So that we can re-calculate the relative time on the spot in /forums/
|
||||
LastPage int
|
||||
}
|
||||
|
||||
// ? - What is this for?
|
||||
|
|
|
@ -130,6 +130,9 @@ func (s *MemoryForumStore) LoadForums() error {
|
|||
f.Link = BuildForumURL(NameToSlug(f.Name), f.ID)
|
||||
f.LastTopic = Topics.DirtyGet(f.LastTopicID)
|
||||
f.LastReplyer = Users.DirtyGet(f.LastReplyerID)
|
||||
// TODO: Create a specialised function with a bit less overhead for getting the last page for a post count
|
||||
_, _, lastPage := PageOffset(f.LastTopic.PostCount, 1, Config.ItemsPerPage)
|
||||
f.LastPage = lastPage
|
||||
addForum(f)
|
||||
}
|
||||
s.forumView.Store(forumView)
|
||||
|
@ -211,6 +214,9 @@ func (s *MemoryForumStore) BypassGet(id int) (*Forum, error) {
|
|||
f.Link = BuildForumURL(NameToSlug(f.Name), f.ID)
|
||||
f.LastTopic = Topics.DirtyGet(f.LastTopicID)
|
||||
f.LastReplyer = Users.DirtyGet(f.LastReplyerID)
|
||||
// TODO: Create a specialised function with a bit less overhead for getting the last page for a post count
|
||||
_, _, lastPage := PageOffset(f.LastTopic.PostCount, 1, Config.ItemsPerPage)
|
||||
f.LastPage = lastPage
|
||||
//TopicListThaw.Thaw()
|
||||
|
||||
return f, err
|
||||
|
|
Loading…
Reference in New Issue