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
|
LastReplyer *User
|
||||||
LastReplyerID int
|
LastReplyerID int
|
||||||
LastTopicTime string // So that we can re-calculate the relative time on the spot in /forums/
|
LastTopicTime string // So that we can re-calculate the relative time on the spot in /forums/
|
||||||
|
LastPage int
|
||||||
}
|
}
|
||||||
|
|
||||||
// ? - What is this for?
|
// ? - What is this for?
|
||||||
|
|
|
@ -130,6 +130,9 @@ func (s *MemoryForumStore) LoadForums() error {
|
||||||
f.Link = BuildForumURL(NameToSlug(f.Name), f.ID)
|
f.Link = BuildForumURL(NameToSlug(f.Name), f.ID)
|
||||||
f.LastTopic = Topics.DirtyGet(f.LastTopicID)
|
f.LastTopic = Topics.DirtyGet(f.LastTopicID)
|
||||||
f.LastReplyer = Users.DirtyGet(f.LastReplyerID)
|
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)
|
addForum(f)
|
||||||
}
|
}
|
||||||
s.forumView.Store(forumView)
|
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.Link = BuildForumURL(NameToSlug(f.Name), f.ID)
|
||||||
f.LastTopic = Topics.DirtyGet(f.LastTopicID)
|
f.LastTopic = Topics.DirtyGet(f.LastTopicID)
|
||||||
f.LastReplyer = Users.DirtyGet(f.LastReplyerID)
|
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()
|
//TopicListThaw.Thaw()
|
||||||
|
|
||||||
return f, err
|
return f, err
|
||||||
|
|
Loading…
Reference in New Issue