mirror of
https://github.com/discourse/discourse.git
synced 2025-03-07 00:25:30 +08:00

In the commit d8bf2810ffe49619077371d854fc12cba81f80fa we hoisted the userOptionFields array to a module-level variable, but kept the code inside save() the same. This causes an issue where if save() is called twice on the same user with some array of user option fields, the userOptionFields array is mutated, which means the second save is likely not saving the fields intended. This commit fixes the issue by not mutating the array. We cannot change them into consts though, because we have an API to add more items to the array.