build_commit_note(commit)
          click to toggle source
        
        
        
          
          
          
          
          
            
def build_commit_note(commit)
  notes.new(noteable_id: commit.id, noteable_type: "Commit")
end
           
          
         
        
        
       
    
      
        
        
          check_limit()
          click to toggle source
        
        
        
          
          
          
          
          
            
def check_limit
  unless owner.can_create_project?
    errors[:base] << ("Your own projects limit is #{owner.projects_limit}! Please contact administrator to increase it")
  end
rescue
  errors[:base] << ("Can't check your ability to create project")
end
           
          
         
        
        
       
    
      
        
        
          commit_line_notes(commit)
          click to toggle source
        
        
        
          
          
          
          
          
            
def commit_line_notes(commit)
  notes.where(noteable_id: commit.id, noteable_type: "Commit").where("line_code IS NOT NULL")
end
           
          
         
        
        
       
    
      
        
        
          commit_notes(commit)
          click to toggle source
        
        
        
          
          
          
          
          
            
def commit_notes(commit)
  notes.where(noteable_id: commit.id, noteable_type: "Commit", line_code: nil)
end
           
          
         
        
        
       
    
      
        
        
          common_notes()
          click to toggle source
        
        
        
          
          
          
          
          
            
def common_notes
  notes.where(noteable_type: ["", nil]).inc_author_project
end
           
          
         
        
        
       
    
      
        
        
          git_error?()
          click to toggle source
        
        
        
          
          
          
          
          
            
def git_error?
  error_code == :gitolite
end
           
          
         
        
        
       
    
      
        
        
          issues_labels()
          click to toggle source
        
        
        
          
          
          
          
          
            
def issues_labels
  issues.tag_counts_on(:labels)
end
           
          
         
        
        
       
    
      
        
        
          last_activity()
          click to toggle source
        
        
        
          
          
          
          
          
            
def last_activity
  last_event
end
           
          
         
        
        
       
    
      
        
        
          last_activity_date()
          click to toggle source
        
        
        
          
          
          
          
          
            
def last_activity_date
  last_event.try(:created_at) || updated_at
end
           
          
         
        
        
       
    
      
        
        
          private?()
          click to toggle source
        
        
        
          
          
          
          
          
            
def private?
  private_flag
end
           
          
         
        
        
       
    
      
        
        
          project_id()
          click to toggle source
        
        
        
          
          
          
          
          
            
def project_id
  self.id
end
           
          
         
        
        
       
    
      
        
        
          public?()
          click to toggle source
        
        
        
          
          
          
          
          
            
def public?
  !private_flag
end
           
          
         
        
        
       
    
      
        
        
          repo_name()
          click to toggle source
        
        
        
          
          
          
          
          
            
def repo_name
  if path == "gitolite-admin"
    errors.add(:path, " like 'gitolite-admin' is not allowed")
  end
end
           
          
         
        
        
       
    
      
        
        
          saved?()
          click to toggle source
        
        
        
          
          
          
          
          
            
def saved?
  id && valid?
end
           
          
         
        
        
       
    
      
        
        
          to_param()
          click to toggle source
        
        
        
        
        
       
    
      
        
        
          web_url()
          click to toggle source
        
        
        
          
          
          
          
          
            
def web_url
  [Gitlab.config.url, code].join("/")
end
           
          
         
        
        
       
    
      
        
        
          wiki_notes()
          click to toggle source
        
        
        
          
          
          
          
          
            
def wiki_notes
  Note.where(noteable_id: wikis.pluck(:id), noteable_type: 'Wiki', project_id: self.id)
end