Use Wiki instance as repository container
What does this MR do?
Before we started working on group wikis, ProjectWiki
used a Project
instance as the container of its Repository
instance, so for group
wikis we did the same with Group
.
This initially made sense and also mostly aligned with the semantics for
Repository#container
, but while working on wiki diffing [1] we noticed
that the Commit
and Blob
classes sometimes use
container#repository
, which breaks some assumptions and also causes
redundant Gitaly calls to the project repository when diffing wikis.
Refactoring those classes is a lot riskier and would affect other
features too, so in this commit we're instead changing the
Repository#container
to be the wiki instance, rather than the project
or group. This generally seems to make sense anyway, and only needs some
small adjustments.
To satisfy the interface for Repository#container
, we need to add
or tweak some methods:
Wiki.find_by_id
Wiki#id
Wiki#to_global_id
We also still need to be able to resolve wiki repositories from their
containers, this is handled in the repository resolver for
Gitlab::GlRepository::WIKI
.
[1] !35330 (merged)
Some of this was also discussed in #219069, although that issue was originally about renaming Wiki#container
to something else, to avoid confusion with Repository#container
(which I think would still make sense, but it's out of scope for this MR).
This also doesn't address #217752 yet, which mostly involves renaming project
to container
in the diff classes.
Screenshots
Does this MR meet the acceptance criteria?
Conformity
- [-] Changelog entry
- [-] Documentation (if required)
-
Code review guidelines -
Merge request performance guidelines -
Style guides -
Database guides -
Separation of EE specific content
Availability and Testing
-
Review and add/update tests for this feature/bug. Consider all test levels. See the Test Planning Process. - [-] Tested in all supported browsers
- [-] Informed Infrastructure department of a default or new setting change, if applicable per definition of done
Security
If this MR contains changes to processing or storing of credentials or tokens, authorization and authentication methods and other items described in the security review guidelines:
- [-] Label as security and @ mention
@gitlab-com/gl-security/appsec
- [-] The MR includes necessary changes to maintain consistency between UI, API, email, or other methods
- [-] Security reports checked/validated by a reviewer from the AppSec team