Doc Categoriesの最近のアップデート後のサイドバーのアクティベーションの問題

As of these changes to Doc Categories

the sidebar no longer activates. I am running version 3.6.0.beta1-dev (17d735b3ad) with the Horizon theme, and there is nothing in the error logs. I also ensured there is a set index topic, rebuilt the launcher, and ran bundle exec rake doc_categories:build_sidebar.

「いいね!」 2

Thanks for the report, we will take a look shortly.

「いいね!」 2

Oh no, that’s not great.

Do you still have the output of bundle exec rake doc_categories:build_sidebar? (Feel free to send me a PM if it’s private)

So far I have not seen issues here on Meta + Horizon but there could be a state I am missing. If you have data explorer, can you check if there are indexes, sections, and links created?

query
SELECT
  i.category_id,
  i.index_topic_id,
  sec.section_names,
  lnk.section_links
FROM doc_categories_indexes i
LEFT JOIN LATERAL (
  SELECT
    string_agg(COALESCE(s.title, ''), ', ' ORDER BY s.position) AS section_names
  FROM doc_categories_sidebar_sections s
  WHERE s.index_id = i.id
) AS sec ON TRUE
LEFT JOIN LATERAL (
  SELECT
    string_agg(l.href, ', ' ORDER BY s.position, l.position) AS section_links
  FROM doc_categories_sidebar_sections s
  LEFT JOIN doc_categories_sidebar_links l
    ON l.sidebar_section_id = s.id
  WHERE s.index_id = i.id
) AS lnk ON TRUE
ORDER BY i.category_id, i.index_topic_id;

One vector is the site cache. Since categories are cached for 30 minutes, the update may have happened and the regular sidebar is cached prior to the running of the rake task.

1. migration to table
2. cache miss -> sees normal sidebar instead of docs sidebar
3. rake task to build sidebar
4. should see rebuilt sidebar

Technically, (4) should happen and reset the cache. If that’s the issue, you should be seeing them by now.

「いいね!」 3

Thanks for the quick reply! It seems not to be the cache as the issue is persisting. I’m sending you a PM with the Data Explorer query results and the bundle exec rake doc_categories:build_sidebar output. It aborts with a fatal

「いいね!」 2

Just a report back for future onlookers that the rake task that was run in OP was using

bundle exec rake doc_categories:build_sidebar

and met with the error

ActiveRecord::NoDatabaseError: We could not find your database: discourse. Available database configurations can be found in config/database.yml. (ActiveRecord::NoDatabaseError)

Depending on self-hosted setups, it is likely that the task needs to be run with the discourse user to get to the database.

sudo -E -u discourse bundle exec rake doc_categories:build_sidebar

@MachineScholar has confirmed that the sections and links have thus been successfully created. :ok_hand:t2:

「いいね!」 3