Improve ProjectService::getProjectMaintainers()

Created on 7 August 2025, about 1 month ago

ProjectService::getProjectMaintainers() is currently only called once, and that’s within the same class. So we do not need to keep its return value stable.

Loading all the users will likely often be extra overhead that’s not used. Many callers will just want to know if the uid they are interested in is present. We can return an array without the user objects loaded, and the caller can load them if needed.

There are different types of maintainership that the caller might be interested in. We can return a structure along the lines of

[ {uid} => [ 'update_project' => 1, 'administer_maintainers' => 0, …] ]

or potentially an optional second argument for the type of access to check, as a way of getting away from magic array structures.

In D7, it’s possible for someone to be present in the table for a project, but not actually have any maintainer access. Whether we change that behavior or not, it would be a good safety to filter for people with some non-zero value for one of the columns. If we return the full table data, this can be checked in isProjectMaintainer()

We don’t need this yet, but this method is likely to be called multiple times. A static cache would be good to have.

📌 Task
Status

Active

Version

1.0

Component

Code

Created by

🇺🇸United States drumm NY, US

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024