JSON requests don't exclude categories from filters


(Vikhyat Korrapati) #1

Steps to reproduce:

  1. Go to http://forums.hummingbird.me/. The “forum games” category, which is excluded from the “latest” filter in our site settings isn’t shown as expected.
  2. Click on “Community” in the header, which triggers a request to /latest.json. Topics from the “forum games” category are now visible.

This is the problem line:

Not sure why the format is checked at all.


(Vikhyat Korrapati) #2

Also it looks like navigating to the forum games category shows topics, but either refreshing after that or clicking on an external link (http://forums.hummingbird.me/category/forum-games) doesn’t show any topics.


(Régis Hanol) #3

I see no reason why this should be the case. Just pushed a fix :wink:

https://github.com/discourse/discourse/commit/ae401f0dc7c446b4b26c712f460fcb22ebe068fa


(Vikhyat Korrapati) #4

Unfortunately that ends up making the second issue worse, since now even the JSON request returns no results so there’s no way at all to view topics in an excluded category.

The problem is that build_topic_list_options generates these options (when Lounge is excluded and we are trying to view the lounge category):

{:page=>nil, :topic_ids=>nil, :exclude_category=>"Lounge", :category=>"lounge", :sort_order=>nil, :sort_descending=>nil, :status=>nil}

Also since the format isn’t checked anymore this comment probably needs to go.

    # html format means we need to parse exclude category (aka filter) from the site options top menu

(Vikhyat Korrapati) #5

PR if it makes things easier:

https://github.com/discourse/discourse/pull/1890


(Régis Hanol) #6

You’re right! I will merge that tomorrow. Thanks!


(Sam Saffron) #7

I have a feeling this broke htg


(Régis Hanol) #8

Yeah :(… @radq had already fixed it in PR#1890 :slight_smile:


(Jeff Atwood) #9