# Conflicts:
#	app/controllers/application_controller.rb
dev_forge
caicai8 5 years ago
commit 77420ad60b

@ -328,7 +328,7 @@ class ApplicationController < ActionController::Base
def current_user def current_user
# User.current # User.current
User.find_by_id 50207 User.find_by_id 36401
end end
## 默认输出json ## 默认输出json
@ -627,6 +627,16 @@ class ApplicationController < ActionController::Base
error.backtrace.each { |msg| Rails.logger.error(msg) } error.backtrace.each { |msg| Rails.logger.error(msg) }
end end
def find_user
@user = User.find_by_login params[:login]
render_not_found unless @user
end
def find_repository
@repo = @user.repositories.find_by_identifier params[:repo_identifier]
render_not_found unless @repo
end
private private
def object_not_found def object_not_found
uid_logger("Missing template or cant't find record, responding with 404") uid_logger("Missing template or cant't find record, responding with 404")

@ -30,7 +30,7 @@ class ProjectsController < ApplicationController
end end
def branches def branches
@branches = Gitea::Repository::BranchesService.new(current_user, @project.identifier).call @branches = Gitea::Repository::BranchesService.new(@project.owner, @project.identifier).call
end end
def group_type_list def group_type_list

@ -24,17 +24,6 @@ class RepositoriesController < ApplicationController
end end
private private
def find_repository
@repo = @user.repositories.find_by_identifier params[:repo_identifier]
render_not_found unless @repo
end
def find_user
@user = User.find_by_login params[:login]
render_not_found unless @user
end
def authorizate! def authorizate!
if @repo.hidden? && @repo.user != current_user if @repo.hidden? && @repo.user != current_user
render_forbidden render_forbidden

Loading…
Cancel
Save