Commit Graph

11 Commits

Author SHA1 Message Date
Bob Van Landuyt f3fba178b9 Remove the `ForkedProjectLink` model
This removes the `ForkedProjectLink` model that has been replaced by
the `ForkNetworkMember` and `ForkNetwork` combination. All existing
relations have been adjusted to use these new models.

The `forked_project_link` table has been dropped.

The "Forks" count on the admin dashboard has been updated to count all
`ForkNetworkMember` rows and deduct the number of `ForkNetwork`
rows. This is because now the "root-project" of a fork network also
has a `ForkNetworkMember` row. This count could become inaccurate when
the root of a fork network is deleted.
2018-10-19 11:57:20 +02:00
Yorick Peterse 2039c8280d
Disable existing offenses for the CodeReuse cops
This whitelists all existing offenses for the various CodeReuse cops, of
which most are triggered by the CodeReuse/ActiveRecord cop.
2018-09-11 17:32:00 +02:00
gfyoung fbde835404 Enable more frozen string in app/services/**/*.rb
Partially addresses #47424.
2018-07-17 15:19:40 -07:00
Bob Van Landuyt ac86249039 Don't link LFS-objects multiple times.
If Unlinking a fork would fail somewhere after this, the LFS objects
might still be linked. Which would cause issues when trying to destroy
a project.
2017-12-19 17:06:18 +01:00
Bob Van Landuyt 7582bc8b4e Unlink a project from a fork network when it's source was deleted.
We need to close all merge requests coming from the project within the
entire fork network.
2017-11-03 12:17:59 +01:00
Bob Van Landuyt 2c0b677604 Fix errors when deleting a forked project
The problem would occur when the `ForkedProjectLink` was deleted, but
the `ForkNetworkMember` was not. The delete would be rolled back and
retried.

But the error would not be saved because `Project#forked?`
would still be true, because the `ForkNetworkMember` exists. But the
`Project#forked_project_link` would be `nil`. So the validation for
the visibility level would fail.
2017-10-17 16:46:07 +02:00
Bob Van Landuyt 8160550439 Remove membership from fork network when unlinking 2017-10-07 11:46:23 +02:00
Yorick Peterse aef9f1eb94
Cache the number of forks of a project
The number of forks of a project doesn't change very frequently and
running a COUNT(*) every time this information is requested can be quite
expensive. We also end up running such a COUNT(*) query at least twice
on the homepage of a project.

By caching this data and refreshing it when necessary we can reduce
project homepage loading times by around 60 milliseconds (based on the
timings of https://gitlab.com/gitlab-org/gitlab-ce).
2017-08-14 18:00:28 +02:00
Douwe Maan 70b05a8377 Split up MergeRequestsController 2017-06-28 18:17:44 -05:00
Baldinof a6b5b50e14 Fix incorrect variable name 2016-04-04 14:41:01 +00:00
Baldinof fa4126acff Move unlink fork logic to a service 2016-03-22 15:34:35 +01:00