openedx / openedx/forum

Errors unless `FORUM_MONGODB_DATABASE` and `FORUM_MONGODB_CLIENT_PARAMETERS` are defined

Open
#137 9 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
5
Forks
26
Avg merge
7d 11h
Merged PRs (30d)
2

Description

By default, we had intended for sites running master to require no changes at all to their configuration to keep the old experience. We currently break this, as @regisb notes in this post. The code is currently doing this because we sometimes need to derive the course_id to know which code path to take, and that's not always available from the request itself.

Is it feasible to add checking to forum.backends.mongodb.api.get_course_id_by_thread_id to explicitly check to see if FORUM_MONGODB_DATABASE and FORUM_MONGODB_CLIENT_PARAMETERS exist, and return None if they don't? That should make the public api call get_course_id_by_thread return None. (And the same for get_course_id_by_comment.) When passing a course_id of None to the CourseWaffleFlag check, it should return the default value for the site as a whole. Which I think will do what we want in a backwards compatible way?

Would that work? Are there other places where we need to try to infer the course_id?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in forum/backends/mongodb/api.py at get_course_id_by_thread_id, then trace forum/api/threads.py at get_course_id_by_thread and the corresponding comment path. Check how missing FORUM_MONGODB_DATABASE and FORUM_MONGODB_CLIENT_PARAMETERS are handled, identify any other course_id inference points, and verify that absent configuration returns None so CourseWaffleFlag uses the site-wide default.

Written by the indexing model from the issue text.

Assessment

Tech stack
mongodb, python
Domain
backend, databases
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.