Refactor unnecessary usages of HttpRequest objects in custom view methods #1539
Labels
internal
Changes invisible to the user or APIs (e.g. refactoring and optimization)
Milestone
While doing #1391, I've (again) noticed that in many places we assume the existence of a
HttpRequest
object when we only need the user object of the current user issuing a request.However, when we want to reuse code between e.g. UI views, management commands and/or Celery tasks (which happens quite often), a HTTP request may not always be present.
In all cases where we pass a
HttpRequest
object to custom methods just to getrequest.user
, we should instead pass the current user object directly. The same can be done for possible other request members where the full object is not needed.For now I'll place this in the v1.2 milestone, but that may still be reconsidered. v1.1 is already quite a large milestone and I want to get working on SODAR v1.1 features ASAP.
The text was updated successfully, but these errors were encountered: