Resolve "New project form errors out on Cell 2"
What does this MR do and why?
Fix is based on the comment at #427660 (comment 1636407970)
The error described in #427660 (closed), happens due to the fact that the current_user
does not have a personal namespace on cell-2. (Namespaces are cell-local, and currently a user's personal namespace is still on cell-1 and we do not plan on replicating it across cells)
So, on cell-2, current_user.namespace.id
would naturally fail with error, because current_user.namespace
would return nil
To prevent this from happening, we use current_user.namespace_id
instead, which is already defined in the model as
def namespace_id
namespace.try :id
end
So, on cell-2, this method will gracefully return nil
without error, thus fixing our problem. On cell 1, it will continue to function as before.
Screenshots or screen recordings
After the fix:
On cell-1 | On cell-2 |
---|---|
On cell-2, we can see that no "Users" section is shown because it is unavailable, and the page does not error out.
Before | After |
---|---|
How to set up and validate locally
Numbered steps to set up and validate the change are strongly suggested.
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Related to #427660 (closed)