From 1915c9f0cf1ec3e836c02ba57c97e5a9a61d487b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9my=20Coutable?= Date: Tue, 10 Jul 2018 11:30:16 +0200 Subject: [PATCH] Moving 400 lines of code MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Rémy Coutable --- app/models/project.rb | 301 ++++++++++++++++++++++++++++++++++++++++++ app/models/user.rb | 27 ++-- 2 files changed, 315 insertions(+), 13 deletions(-) diff --git a/app/models/project.rb b/app/models/project.rb index 770262f6193..2cc0c83d064 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -2182,5 +2182,306 @@ class Project < ActiveRecord::Base else check_access.call end + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + end end diff --git a/app/models/user.rb b/app/models/user.rb index 1c5d39db118..4aeaaedfe4d 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -441,6 +441,20 @@ class User < ActiveRecord::Base [:ghost] end + def full_website_url + return "http://#{website_url}" if website_url !~ %r{\Ahttps?://} + + website_url + end + + def short_website_url + website_url.sub(%r{\Ahttps?://}, '') + end + + def all_ssh_keys + keys.map(&:publishable_key) + end + def internal? self.class.internal_attributes.any? { |a| self[a] } end @@ -845,19 +859,6 @@ class User < ActiveRecord::Base project.project_member(self) end - def full_website_url - return "http://#{website_url}" if website_url !~ %r{\Ahttps?://} - - website_url - end - - def short_website_url - website_url.sub(%r{\Ahttps?://}, '') - end - - def all_ssh_keys - keys.map(&:publishable_key) - end def temp_oauth_email? email.start_with?('temp-email-for-oauth')