debian-mirror-gitlab/app/controllers/projects/network_controller.rb

43 lines
1.2 KiB
Ruby
Raw Normal View History

2018-12-05 23:21:45 +05:30
# frozen_string_literal: true
2014-09-02 18:07:02 +05:30
class Projects::NetworkController < Projects::ApplicationController
include ExtractsPath
include ApplicationHelper
2018-03-17 18:26:18 +05:30
before_action :whitelist_query_limiting
2015-09-11 14:41:01 +05:30
before_action :require_non_empty_project
before_action :assign_ref_vars
before_action :authorize_download_code!
2017-08-17 22:00:37 +05:30
before_action :assign_commit
2014-09-02 18:07:02 +05:30
def show
2018-03-27 19:54:05 +05:30
@url = project_network_path(@project, @ref, @options.merge(format: :json))
@commit_url = project_commit_path(@project, 'ae45ca32').gsub("ae45ca32", "%s")
2014-09-02 18:07:02 +05:30
2018-03-27 19:54:05 +05:30
respond_to do |format|
format.html do
if @options[:extended_sha1] && !@commit
flash.now[:alert] = "Git revision '#{@options[:extended_sha1]}' does not exist."
2018-03-17 18:26:18 +05:30
end
2014-09-02 18:07:02 +05:30
end
2018-03-17 18:26:18 +05:30
2018-03-27 19:54:05 +05:30
format.json do
@graph = Network::Graph.new(project, @ref, @commit, @options[:filter_ref])
end
2014-09-02 18:07:02 +05:30
end
2018-03-27 19:54:05 +05:30
render
2014-09-02 18:07:02 +05:30
end
2017-08-17 22:00:37 +05:30
def assign_commit
return if params[:extended_sha1].blank?
@options[:extended_sha1] = params[:extended_sha1]
@commit = @repo.commit(@options[:extended_sha1])
end
2018-03-17 18:26:18 +05:30
def whitelist_query_limiting
Gitlab::QueryLimiting.whitelist('https://gitlab.com/gitlab-org/gitlab-ce/issues/42333')
end
2014-09-02 18:07:02 +05:30
end