From f9dedc9691b184484b2781a32b058d740d4da32d Mon Sep 17 00:00:00 2001 From: Azareal Date: Mon, 27 Aug 2018 19:06:00 +1000 Subject: [PATCH] Fixed a bug with users slipping past the topic list cache. --- common/topic_list.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/common/topic_list.go b/common/topic_list.go index 6c120baa..9dc13847 100644 --- a/common/topic_list.go +++ b/common/topic_list.go @@ -129,6 +129,9 @@ func (tList *DefaultTopicList) RebuildPermTree() error { } func (tList *DefaultTopicList) GetListByGroup(group *Group, page int) (topicList []*TopicsRow, forumList []Forum, paginator Paginator, err error) { + if page == 0 { + page = 1 + } // TODO: Cache the first three pages not just the first along with all the topics on this beaten track if page == 1 { var holder *TopicListHolder @@ -148,6 +151,7 @@ func (tList *DefaultTopicList) GetListByGroup(group *Group, page int) (topicList } // TODO: Make CanSee a method on *Group with a canSee field? Have a CanSee method on *User to cover the case of superadmins? + //log.Printf("deoptimising for %d on page %d\n", group.ID, page) return tList.GetListByCanSee(group.CanSee, page) }