summaryrefslogtreecommitdiff
path: root/app/models/namespace.rb
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2014-11-14 16:06:39 +0200
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2014-11-14 16:06:39 +0200
commit2388fdd7c6274dad8c10f5bc517f0a8b1aa28aa3 (patch)
tree9f862ed410b9a4d774c4791159291083ccc2c392 /app/models/namespace.rb
parentd2c3c98e3cf88dd59a2a1a0d94e711e31c11b2cd (diff)
downloadgitlab-ce-2388fdd7c6274dad8c10f5bc517f0a8b1aa28aa3.tar.gz
Improve fork to namespaces feature
* Show namespace thumbnail differently if project was already forked * Show loading spinner when click on fork * Fork link navigates to personal namespace only if no manageable groups exists Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Diffstat (limited to 'app/models/namespace.rb')
-rw-r--r--app/models/namespace.rb4
1 files changed, 4 insertions, 0 deletions
diff --git a/app/models/namespace.rb b/app/models/namespace.rb
index c0c6de0ee7d..ea4b48fdd7f 100644
--- a/app/models/namespace.rb
+++ b/app/models/namespace.rb
@@ -90,4 +90,8 @@ class Namespace < ActiveRecord::Base
def kind
type == 'Group' ? 'group' : 'user'
end
+
+ def find_fork_of(project)
+ projects.joins(:forked_project_link).where('forked_project_links.forked_from_project_id = ?', project.id).first
+ end
end