aboutsummaryrefslogtreecommitdiffstats
path: root/modules/structs/repo.go
diff options
context:
space:
mode:
authorLunny Xiao <xiaolunwen@gmail.com>2019-10-14 14:10:42 +0800
committerLauris BH <lauris@nix.lv>2019-10-14 09:10:42 +0300
commite3e44a59d01da3af2be3a830f4a90394e7af4ff4 (patch)
treef66e8ead94693225668bacd0ba603bf3712aeae6 /modules/structs/repo.go
parentba201aaa44b19f633fab0c4682d5f97558b3205e (diff)
downloadgitea-e3e44a59d01da3af2be3a830f4a90394e7af4ff4.tar.gz
gitea-e3e44a59d01da3af2be3a830f4a90394e7af4ff4.zip
Update migrated repositories' issues/comments/prs poster id if user has a github external user saved (#7751)
* update migrated issues/comments when login as github * add get userid when migrating or login with github oauth2 * fix lint * add migrations for repository service type * fix build * remove unnecessary dependencies on migrations * add cron task to update migrations poster ids and fix posterid when migrating * fix lint * fix lint * improve code * fix lint * improve code * replace releases publish id to actual author id * fix import * fix bug * fix lint * fix rawdata definition * fix some bugs * fix error message
Diffstat (limited to 'modules/structs/repo.go')
-rw-r--r--modules/structs/repo.go39
1 files changed, 39 insertions, 0 deletions
diff --git a/modules/structs/repo.go b/modules/structs/repo.go
index 57f1768a0b..be6a3d4b43 100644
--- a/modules/structs/repo.go
+++ b/modules/structs/repo.go
@@ -153,6 +153,43 @@ type EditRepoOption struct {
Archived *bool `json:"archived,omitempty"`
}
+// GitServiceType represents a git service
+type GitServiceType int
+
+// enumerate all GitServiceType
+const (
+ NotMigrated GitServiceType = iota // 0 not migrated from external sites
+ PlainGitService // 1 plain git service
+ GithubService // 2 github.com
+ GiteaService // 3 gitea service
+ GitlabService // 4 gitlab service
+ GogsService // 5 gogs service
+)
+
+// Name represents the service type's name
+// WARNNING: the name have to be equal to that on goth's library
+func (gt GitServiceType) Name() string {
+ switch gt {
+ case GithubService:
+ return "github"
+ case GiteaService:
+ return "gitea"
+ case GitlabService:
+ return "gitlab"
+ case GogsService:
+ return "gogs"
+ }
+ return ""
+}
+
+var (
+ // SupportedFullGitService represents all git services supported to migrate issues/labels/prs and etc.
+ // TODO: add to this list after new git service added
+ SupportedFullGitService = []GitServiceType{
+ GithubService,
+ }
+)
+
// MigrateRepoOption options for migrating a repository from an external service
type MigrateRepoOption struct {
// required: true
@@ -166,6 +203,8 @@ type MigrateRepoOption struct {
Mirror bool `json:"mirror"`
Private bool `json:"private"`
Description string `json:"description"`
+ OriginalURL string
+ GitServiceType GitServiceType
Wiki bool
Issues bool
Milestones bool