Skip to content

Commit f48c948

Browse files
committed
fix: do not update LMS user during retirement
1. Modifying users is already handled by the LMS retirement pipeline. The `forum` library should not alter LMS users during retirement. 2. Changing the email to an empty string results in integrity errors in the MySQL backend, because the email must be unique.
1 parent 4254215 commit f48c948

File tree

3 files changed

+15
-10
lines changed

3 files changed

+15
-10
lines changed

CHANGELOG.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,14 @@ Unreleased
1616

1717
*
1818

19+
0.3.8 - 2025-10-21
20+
******************
21+
22+
Fixed
23+
-----
24+
25+
* Do not modify LMS users during retirement — this is handled by the LMS retirement pipeline.
26+
1927
0.3.4 – 2025-08-13
2028
******************
2129

forum/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
Openedx forum app.
33
"""
44

5-
__version__ = "0.3.7"
5+
__version__ = "0.3.8"

forum/api/users.py

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
import math
77
from typing import Any, Optional
88

9-
from forum.backend import get_backend
9+
from forum.backend import get_backend, is_mysql_backend_enabled
1010
from forum.constants import FORUM_DEFAULT_PAGE, FORUM_DEFAULT_PER_PAGE
1111
from forum.serializers.thread import ThreadSerializer
1212
from forum.serializers.users import UserSerializer
@@ -135,14 +135,11 @@ def retire_user(
135135
user = backend.get_user(user_id)
136136
if not user:
137137
raise ForumV2RequestError(f"user not found with id: {user_id}")
138-
backend.update_user(
139-
user_id,
140-
data={
141-
"email": "",
142-
"username": retired_username,
143-
"read_states": [],
144-
},
145-
)
138+
data: dict[str, Any] = {"read_states": []}
139+
if not is_mysql_backend_enabled(course_id):
140+
data["username"] = retired_username
141+
data["email"] = ""
142+
backend.update_user(user_id, data=data)
146143
backend.unsubscribe_all(user_id)
147144
backend.retire_all_content(user_id, retired_username)
148145

0 commit comments

Comments
 (0)