c2corg / c2c_ui

User interface for https://www.camptocamp.org
https://www.camptocamp.org
GNU Affero General Public License v3.0
26 stars 32 forks source link

Bug: Excluded categories for forum widget not working #2612

Open flob38 opened 2 years ago

flob38 commented 2 years ago

Describe the bug Some categories which are in EXCLUDED_CATEGORIES are not excluded. Example : 23/03/22 13h55 image

https://forum.camptocamp.org/t/cherche-partenaire-alpi-4000m/295879

const EXCLUDED_CATEGORIES = [
  // https://forum.camptocamp.org/c/comments
  // document's comments
  29,
[...]
  // https://forum.camptocamp.org/c/partenaires/partenaires-alpinisme-cascade-de-glace
  // mountaineering buddy finder
  113,

I found this because I'm working on a widget which would show only "not mountaineering" categories (Site and Association, contributeurs...), but whatever changes I've done on the constant EXCLUDED_CATEGORIES, it stay still.

Reproduce On local server, delete all categories in the constant EXCLUDED_CATEGORIES, this change nothing on the result.

flob38 commented 2 years ago

After searching on Discourse API, it seems that no parameter can be posted for the "latest" request. Filter must be done somehow on Discourse admin.

flob38 commented 2 years ago

Désolée, je continue en français. L'url qui sert à aller chercher les derniers sujets du forum est la suivante : https://forum.camptocamp.org/latest.json?exclude_category_ids[]=29&exclude_category_ids[]=40&exclude_category_ids[]=41&exclude_category_ids[]=42&exclude_category_ids[]=43&exclude_category_ids[]=44&exclude_category_ids[]=45&exclude_category_ids[]=47&exclude_category_ids[]=54&exclude_category_ids[]=55&exclude_category_ids[]=56&exclude_category_ids[]=64&exclude_category_ids[]=94&exclude_category_ids[]=95&exclude_category_ids[]=96&exclude_category_ids[]=97&exclude_category_ids[]=113&exclude_category_ids[]=136&exclude_category_ids[]=146 Elle donne les mêmes résultats que https://forum.camptocamp.org/latest.json Pourtant un filtre supplémentaire est bien appliqué puisqu'on ne voit pas le bistrot ni les forums avec accès réservé. Pour le comment du pourquoi je ne sais pas.

brunobesson commented 1 year ago

We have an outdated version of discourse, however I couldn't find the exclude_category_ids param in the API? Did you find such thing @flob38?

@asaunier @cbeauchesne some hints?

flob38 commented 1 year ago

We retrive topics with "latest" function. A piori, this function doesn't filter. https://docs.discourse.org/#tag/Topics/operation/listLatestTopics

I've found a post where the syntax of the exclude_category_ids was mentionning : https://meta.discourse.org/t/api-endpoint-for-latest-topics-in-public-categories/118305 Reponse : call the API with an account that can't see private categories. Maybe it's the way we call Discourse API ?