forked from jasder/forgeplus
Merge branch 'develop' of http://git.trustie.net/jasder/forgeplus into develop
This commit is contained in:
commit
65c51304c1
|
@ -1,6 +1,6 @@
|
|||
class IssuesController < ApplicationController
|
||||
before_action :require_login, except: [:index, :show]
|
||||
before_action :find_project
|
||||
before_action :find_project_with_id
|
||||
before_action :set_project_and_user
|
||||
before_action :check_project_public, only: [:index ,:show, :copy, :index_chosen, :close_issue]
|
||||
before_action :check_issue_permission, except: [:index, :show, :index_chosen]
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
class ProjectTrendsController < ApplicationController
|
||||
before_action :find_project
|
||||
before_action :find_project_with_id
|
||||
before_action :check_project_public
|
||||
|
||||
def index
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
class PullRequestsController < ApplicationController
|
||||
before_action :require_login
|
||||
before_action :find_project
|
||||
before_action :find_project_with_id
|
||||
before_action :set_repository
|
||||
before_action :find_pull_request, except: [:index, :new, :create, :check_can_merge]
|
||||
include TagChosenHelper
|
||||
|
|
|
@ -1,10 +1,11 @@
|
|||
class RepositoriesController < ApplicationController
|
||||
include ApplicationHelper
|
||||
before_action :find_user, :find_repository, :authorizate!
|
||||
before_action :find_project_identifier
|
||||
before_action :find_repository_with_project
|
||||
before_action :find_user, :authorizate!
|
||||
before_action :require_login, only: %i[edit]
|
||||
|
||||
def show
|
||||
@project = @repo.project
|
||||
@branches_count = Gitea::Repository::BranchesService.new(@user, @repo.identifier).call&.size
|
||||
@commits_count = Gitea::Repository::Commits::ListService.new(@user, @repo.identifier).call[:total_count]
|
||||
@result = Gitea::Repository::GetService.new(@user, @repo.identifier).call
|
||||
|
@ -14,7 +15,7 @@ class RepositoriesController < ApplicationController
|
|||
end
|
||||
|
||||
def entries
|
||||
@repo.project.increment!(:visits)
|
||||
@project.increment!(:visits)
|
||||
@ref = params[:branch] || "master"
|
||||
@entries = Gitea::Repository::Entries::ListService.new(@user, @repo.identifier, ref:@ref).call
|
||||
@entries = @entries.sort_by{ |hash| hash['type'] }
|
||||
|
@ -53,4 +54,14 @@ class RepositoriesController < ApplicationController
|
|||
render_forbidden
|
||||
end
|
||||
end
|
||||
|
||||
def find_project_identifier
|
||||
@project = Project.find_by(id: params[:repo_identifier])
|
||||
render_not_found("未找到’#{params[:repo_identifier]}’相关的项目") unless @project
|
||||
end
|
||||
|
||||
def find_repository_with_project
|
||||
@repo = @project.repository
|
||||
render_not_found("未找到’#{params[:repo_identifier]}’相关的仓库") unless @repo
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
class VersionReleasesController < ApplicationController
|
||||
before_action :find_project
|
||||
before_action :find_project_with_id
|
||||
before_action :set_user_and_project
|
||||
before_action :require_login, except: [:index]
|
||||
before_action :find_version , only: [:edit, :update, :destroy]
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
class VersionsController < ApplicationController
|
||||
before_action :require_login
|
||||
before_action :find_project
|
||||
before_action :find_project_with_id
|
||||
before_action :check_issue_permission, except: [:show, :index]
|
||||
before_action :set_version, only: [:edit, :update, :destroy, :show,:update_status]
|
||||
|
||||
|
|
|
@ -142,7 +142,7 @@ class SyncForgeJob < ApplicationJob
|
|||
if Project.exists?(identifier: project_identifier)
|
||||
failed_dic = "public/sync_failed_users.dic"
|
||||
File.open(failed_dic,"a") do |file|
|
||||
file.puts "[\nTime---#{Time.now}\nproject_info---#{project}\n---]\n "
|
||||
file.puts "[\nTime---#{Time.now}\nproject_info---#{project}\nerrors---exists the same project:#{project_identifier}]\n "
|
||||
end
|
||||
else
|
||||
new_project = Project.new(project&.except!(*keys_to_delete).merge(user_id: new_user.id))
|
||||
|
|
|
@ -19,6 +19,7 @@ class Journal < ApplicationRecord
|
|||
details = self.journal_details.select(:property, :prop_key, :old_value, :value).pluck(:property, :prop_key, :old_value, :value)
|
||||
if details.size > 0
|
||||
details.each do |de|
|
||||
unless de[1].to_s == "description"
|
||||
if de[0] == "attr"
|
||||
content = ""
|
||||
else
|
||||
|
@ -143,6 +144,7 @@ class Journal < ApplicationRecord
|
|||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
send_details
|
||||
end
|
||||
|
||||
|
|
|
@ -13,6 +13,11 @@ Rails.application.routes.draw do
|
|||
get 'auth/cas/callback', to: 'oauth/cas#create'
|
||||
|
||||
scope '/api' do
|
||||
resources :attachments do
|
||||
collection do
|
||||
delete :destroy_files
|
||||
end
|
||||
end
|
||||
resources :sync_forge, only: [:create] #同步用户
|
||||
resources :composes do
|
||||
resources :compose_projects, only: [:create, :destroy]
|
||||
|
@ -319,12 +324,6 @@ Rails.application.routes.draw do
|
|||
end
|
||||
|
||||
|
||||
resources :attachments do
|
||||
collection do
|
||||
delete :destroy_files
|
||||
end
|
||||
end
|
||||
|
||||
resources :repertoires, only: [:index]
|
||||
|
||||
scope module: :projects do
|
||||
|
|
Loading…
Reference in New Issue