-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
feat: import comment api #14734
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
feat: import comment api #14734
Conversation
Update the /api/units/{unit_id}/comments/ endpoint to accept user and timestamp for a comment
if the user making the request is a project admin. Return the comment id in the response as
it is useful in testing and can also be useful in future resolve/delete comment APIs.
| comment=text, | ||
| userdetails={ | ||
| kwargs = { | ||
| "user": user, |
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.
It is no longer set from request?
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.
It is set from the request but in in the views, I'll shift that logic to here.
Enhanced API response to include serialized comment details.
| # Is this source or target comment? | ||
| unit_scope = unit.source_unit if scope in {"global", "report"} else unit | ||
|
|
||
| user = request.user |
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.
The user variable is also used later in the code, and keeping it None value causes crashes (as can be seen in the tests).
|
Merged, thanks for your contribution! |
Update the /api/units/{unit_id}/comments/ endpoint to accept user and timestamp for a comment if the user making the request is a project admin. Return the comment id in the response as it is useful in testing and can also be useful in future resolve/delete comment APIs.
Fixes #14232.