forked from Gitlink/forgeplus
Merge branch 'develop' into standalone_develop
This commit is contained in:
commit
8050af23fc
|
@ -8,7 +8,7 @@ class Ci::BaseController < ApplicationController
|
||||||
namespace = params[:owner]
|
namespace = params[:owner]
|
||||||
id = params[:repo] || params[:id]
|
id = params[:repo] || params[:id]
|
||||||
|
|
||||||
@ci_user, @repo = Ci::Repo.find_with_namespace(namespace, id)
|
@ci_user, @repo = Ci::Repo.find_with_namespace(namespace, id, current_user.login)
|
||||||
end
|
end
|
||||||
|
|
||||||
def load_all_repo
|
def load_all_repo
|
||||||
|
|
|
@ -46,7 +46,7 @@ class Ci::SecretsController < Ci::BaseController
|
||||||
end
|
end
|
||||||
|
|
||||||
def ci_drone_url
|
def ci_drone_url
|
||||||
user = User.find_by(login: params[:owner])
|
user = User.find_by(login: params[:owner]) || User.find_by(login: current_user.login)
|
||||||
user&.ci_cloud_account.drone_url
|
user&.ci_cloud_account.drone_url
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -5,10 +5,10 @@ class Ci::Repo < Ci::RemoteBase
|
||||||
has_one :perm, foreign_key: :perm_repo_uid
|
has_one :perm, foreign_key: :perm_repo_uid
|
||||||
has_many :builds, foreign_key: :build_repo_id, dependent: :destroy
|
has_many :builds, foreign_key: :build_repo_id, dependent: :destroy
|
||||||
|
|
||||||
def self.find_with_namespace(namespace_path, identifier)
|
def self.find_with_namespace(namespace_path, identifier, user_login)
|
||||||
logger.info "########namespace_path: #{namespace_path} ########identifier: #{identifier} "
|
logger.info "########namespace_path: #{namespace_path} ########identifier: #{identifier} "
|
||||||
|
user_login = user_login || namespace_path
|
||||||
user = Ci::User.find_by_user_login namespace_path
|
user = Ci::User.find_by_user_login user_login
|
||||||
repo = Ci::Repo.where(repo_namespace: namespace_path, repo_name: identifier).first
|
repo = Ci::Repo.where(repo_namespace: namespace_path, repo_name: identifier).first
|
||||||
|
|
||||||
[user, repo]
|
[user, repo]
|
||||||
|
|
Loading…
Reference in New Issue