This instance will be upgraded to Heptapod 0.27.1 on 2021-12-08 at 22:00 UTC+1 (a few minutes of down time)

Commit 6f41e3d9 authored by Tomasz Maczukin's avatar Tomasz Maczukin
Browse files

Change forks method to has_many relation

parent a8f28d8e2eb3
......@@ -97,9 +97,12 @@ def set_last_activity_at
has_one :gitlab_issue_tracker_service, dependent: :destroy
has_one :external_wiki_service, dependent: :destroy
has_one :forked_project_link, dependent: :destroy, foreign_key: "forked_to_project_id"
has_one :forked_project_link, dependent: :destroy, foreign_key: "forked_to_project_id"
has_one :forked_from_project, through: :forked_project_link
has_many :forked_project_links, foreign_key: "forked_from_project_id"
has_many :forks, through: :forked_project_links, source: :forked_to_project
has_one :forked_from_project, through: :forked_project_link
# Merge Requests for target project should be removed with it
has_many :merge_requests, dependent: :destroy, foreign_key: 'target_project_id'
# Merge requests from source project should be kept when source project was removed
......@@ -734,10 +737,6 @@ def forks_count
forks.count
end
def forks
ForkedProjectLink.where(forked_from_project_id: self.id)
end
def find_label(name)
labels.find_by(name: name)
end
......
......@@ -44,8 +44,7 @@ def visibility_level_allowed?(level)
end
def update_forks_visibility_level(new_level)
project.forks.each do |forked_link|
forked_project = forked_link.forked_to_project
project.forks.each do |forked_project|
fork_level = forked_project.visibility_level
if fork_level > new_level.to_i
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment