You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
educoder/app/controllers/repositories_controller.rb

33 lines
968 B

6 years ago
class RepositoriesController < ApplicationController
5 years ago
include ApplicationHelper
before_action :find_user, :find_repository, :authorizate!
6 years ago
5 years ago
def entries
@entries = Gitea::Repository::Entries::ListService.new(@user, @repo.identifier, ref: params[:ref]).call
end
def sub_entries
interactor = Repositories::EntriesInteractor.call(@user, @repo.identifier, params[:filepath], ref: params[:ref])
if interactor.success?
@sub_entries = interactor.result
else
render_error(interactor.error)
end
end
def commits
@hash_commit = Gitea::Repository::Commits::ListService.new(@user, @repo.identifier, sha: params[:sha], page: params[:page]).call
end
def single_commit
@commit = Gitea::Repository::Commits::GetService.new(@user, @repo.identifier, params[:sha]).call
6 years ago
end
private
5 years ago
def authorizate!
if @repo.hidden? && @repo.user != current_user
render_forbidden
end
6 years ago
end
end