Restrict usage of project creator method
Like in #350603 (closed), we have some usages of project.creator
that mean something like "just get the creator, is probably the owner". Due to the semantic difference between them, it's a good thing to restrict the creator
method to cases when the creator of the project is strictly needed.
I see 309 occurrences of
.creator
according to a grep. Upon a quick skim most seem to beproject.creator
and some of them will not need changing.
See &7405 (comment 818917873) for a small thread on this topic.
The vast majority of instances of creator
are in specs/factories/fixtures excepting the below
.creator
in code (not specs)
Instances of Code location | Action | MR | Team |
---|---|---|---|
app/views/shared/projects/_project.html.haml#L19 lines 19, 26, 27 | This seems to refer to the project creator, so no action | n/a | Organization |
app/services/projects/create_service.rb#L66 | Setting the creator on create. No action. | n/a | Organization |
app/views/admin/projects/show.html.haml#L58 | Displaying the name of the creator. No action needed. | n/a | Organization |
spec/support/import_export/common_util.rb#L63 lines 63, 69 | Creator used for TreeRestorer service. | - | Import |
lib/gitlab/github_import/importer/pull_request_importer.rb#L95 | Creating a source branch. | - | Import |
app/workers/repository_import_worker.rb#L27 | Creating a repository via import. | - | Import |
lib/gitlab/import_export/importer.rb#L15 | Current user set as import project creator. Probably no action? | - | Import |
app/services/projects/protect_default_branch_service.rb#L38 | Ensuring a protected branch can be made. | - | Source code |
ee/app/workers/repository_update_mirror_worker.rb#L24 | Updating a repo via mirror. | - | Source code |
app/workers/repository_update_remote_mirror_worker.rb#L45 | Updating a remote repo via mirror. | - | Source code |
Availability and Testing
- Run
package-and-qa
job within the MRs for the code changes listed above. If the change is small enough / has low risk, this job may be skipped. Please review with a domain expert and ~"group::workspace" SET before deciding to skippackage-and-qa
Edited by Christina Lohr