mirror of
https://gitlink.org.cn/Gitlink/forgeplus.git
synced 2026-05-24 05:35:46 +08:00
支持用户fork自己的仓库
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
class Gitea::Repository::ForkService < Gitea::ClientService
|
||||
attr_reader :old_owner, :target_owner, :repo_name, :organization
|
||||
attr_reader :old_owner, :target_owner, :repo_name, :organization, :new_identifier
|
||||
|
||||
# old_owner: 被clone的项目(源项目)拥有者
|
||||
# target_owner: clone后的醒目(新项目)的拥有者
|
||||
@@ -7,10 +7,12 @@ class Gitea::Repository::ForkService < Gitea::ClientService
|
||||
# {
|
||||
# "organization": "string" #组织名称
|
||||
# }
|
||||
def initialize(old_owner, target_owner, repo_name, organization=nil)
|
||||
def initialize(old_owner, target_owner, repo_name, organization=nil, new_identifier=nil)
|
||||
@old_owner = old_owner
|
||||
@target_owner = target_owner
|
||||
@repo_name = repo_name
|
||||
@organization = organization
|
||||
@new_identifier = new_identifier
|
||||
end
|
||||
|
||||
def call
|
||||
@@ -24,6 +26,7 @@ class Gitea::Repository::ForkService < Gitea::ClientService
|
||||
def request_params
|
||||
hash = Hash.new.merge(token: target_owner.gitea_token)
|
||||
hash = hash.merge(data: {organization: organization}) if organization
|
||||
hash = hash.merge(data: {name: new_identifier}) if new_identifier
|
||||
hash
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user