changed github_data method of project model
This commit is contained in:
parent
bdb6458393
commit
eb89b7d653
|
@ -24,4 +24,5 @@ config/deploy.rb
|
|||
.swn
|
||||
.ruby-gemset
|
||||
.ruby-version
|
||||
.localeapp
|
||||
.localeapp
|
||||
config/initializers/github.rb
|
||||
|
|
|
@ -14,7 +14,6 @@ class Projects::BuildListsController < Projects::BaseController
|
|||
def index
|
||||
authorize :build_list
|
||||
params[:filter].each{|k,v| params[:filter].delete(k) if v.blank? } if params[:filter]
|
||||
@project.fetch_github_repo_data unless not @project
|
||||
|
||||
respond_to do |format|
|
||||
format.html
|
||||
|
@ -43,7 +42,6 @@ class Projects::BuildListsController < Projects::BaseController
|
|||
|
||||
def new
|
||||
authorize @build_list = @project.build_lists.build
|
||||
@project.fetch_github_repo_data unless not @project
|
||||
if params[:show] == 'inline' && params[:build_list_id].present?
|
||||
render json: new_build_list_data(@build_list, @project, params), layout: false
|
||||
else
|
||||
|
|
|
@ -60,20 +60,19 @@ class Project < ActiveRecord::Base
|
|||
before_create :set_maintainer
|
||||
after_save :attach_to_personal_repository
|
||||
after_update -> { update_path_to_project(name_was) }, if: :name_changed?
|
||||
after_find :fetch_github_repo_data
|
||||
|
||||
attr_accessor :url, :srpms_list, :mass_import, :add_to_repository_id, :github_data
|
||||
attr_accessor :url, :srpms_list, :mass_import, :add_to_repository_id
|
||||
|
||||
def init_mass_import
|
||||
Project.perform_later :low, :run_mass_import, url, srpms_list, visibility, owner, add_to_repository_id
|
||||
end
|
||||
|
||||
def fetch_github_repo_data
|
||||
def github_data
|
||||
org = github_organization || APP_CONFIG["github_organization"]
|
||||
begin
|
||||
@github_data = Github.repos.get user: org, repo: name
|
||||
Github.repos.get user: org, repo: name
|
||||
rescue
|
||||
@github_data = nil
|
||||
nil
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in New Issue