-
Notifications
You must be signed in to change notification settings - Fork 81
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[MM-52887] Fix panic if todo is not part of a project #378
Conversation
According to https://docs.gitlab.com/ee/user/todos.html there are todos that are not part of a project. For example member access request for groups are only tied to the group, not a project. This PR fixes the NPE by checking if a projects is there first There are no tests that cover the outgoing API requests and hence the changes in this PR are not covered by tests
Codecov ReportPatch coverage has no change and project coverage change:
Additional details and impacted files@@ Coverage Diff @@
## master #378 +/- ##
==========================================
- Coverage 31.20% 31.19% -0.02%
==========================================
Files 21 21
Lines 3778 3780 +2
==========================================
Hits 1179 1179
- Misses 2479 2481 +2
Partials 120 120
☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM thanks for the quick fix
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for addressing this @hanzei. I just have one request to make the code even more defensive, by checking that the todo itself is not nil
@mickmister Your suggestion seems quite defensive to me, but I don't mind adding that additional layer of protection. Even though I slightly changed it to skip all |
@hanzei I tried testing this but I must have misunderstood something. On the existing release I cannot reproduce the panic. I don't see the crash when trying to pull back the data and the use of the lock field filters all the data as expected. Is there something I've missed in the repro steps? |
@DHaussermann In GitLab, users can request access to a group (https://docs.gitlab.com/ee/user/group/#request-access-to-a-group). The group admin then gets a todo item added to their list. On |
@DHaussermann Do you need anything in order to test the PR? |
@hanzei for a reason I never managed to figure out... Most of my test groups are all missing the request link. I did test this and the panic is resolved. For the user affected with the pending request the Please advise if you have any thoughts on next steps. I don't know how much bandwidth it would take to implement a solution for these 2 UI gaps. But, given that if this happened it causes a panic and renders /todo unusable, I'm inclined to accept the PR as is and open follow-up issues in the repo if it requires any significant effort. |
@hanzei Do you have any thoughts you can share on this? Either implementing a solution to the UX gaps or accepting the solution as is. I'm happy to accept this and create follow-up tasks if you don't have the bandwidth to add any more to this. |
@DHaussermann I think it is ok to create follow-up tickets |
Tested and passed
LGTM! |
Sorry @hanzei - I meant to approve with the comment Monday ☝️ Please merge when you have a chance. |
Summary
According to https://docs.gitlab.com/ee/user/todos.html there are todos that are not part of a project. For example, member access requests for groups are only tied to the group, not a project. This PR fixes the NPE by checking if a project is there first.
There are no tests that cover the outgoing API requests, and hence the changes in this PR are not covered by tests.
Ticket Link
https://mattermost.atlassian.net/browse/MM-52887
Fixes #372