summaryrefslogtreecommitdiffstats
path: root/models
diff options
context:
space:
mode:
authorDavid Svantesson <david.svantesson@qrtech.se>2019-12-07 05:21:18 +0100
committertechknowlogick <techknowlogick@gitea.io>2019-12-06 23:21:18 -0500
commit9cb418e623a137fb03f6540517e6e5f4ff6e92cc (patch)
tree6bd9af2a628961647f02e86a9564b5b3c2e81875 /models
parent82e0383d2104f454af5b3e0e768f0497113f3b13 (diff)
downloadgitea-9cb418e623a137fb03f6540517e6e5f4ff6e92cc.tar.gz
gitea-9cb418e623a137fb03f6540517e6e5f4ff6e92cc.zip
Redirect issue if repo has configured external tracker. (#9247)
* Redirect issue if repo has configured external tracker. * Handle error * Add tests for redirect * Fix test consistency
Diffstat (limited to 'models')
-rw-r--r--models/fixtures/issue.yml12
-rw-r--r--models/fixtures/pull_request.yml13
-rw-r--r--models/fixtures/repo_unit.yml21
-rw-r--r--models/fixtures/repository.yml37
-rw-r--r--models/fixtures/user.yml2
-rw-r--r--models/repo_list_test.go6
6 files changed, 87 insertions, 4 deletions
diff --git a/models/fixtures/issue.yml b/models/fixtures/issue.yml
index 541e5faf61..6b57268a7a 100644
--- a/models/fixtures/issue.yml
+++ b/models/fixtures/issue.yml
@@ -97,3 +97,15 @@
is_pull: true
created_unix: 946684820
updated_unix: 978307180
+
+-
+ id: 9
+ repo_id: 48
+ index: 1
+ poster_id: 11
+ name: pr1
+ content: a pull request
+ is_closed: false
+ is_pull: true
+ created_unix: 946684820
+ updated_unix: 978307180 \ No newline at end of file
diff --git a/models/fixtures/pull_request.yml b/models/fixtures/pull_request.yml
index 505584ea18..e8d81a0007 100644
--- a/models/fixtures/pull_request.yml
+++ b/models/fixtures/pull_request.yml
@@ -36,4 +36,17 @@
head_branch: branch2
base_branch: master
merge_base: 0abcb056019adb83
+ has_merged: false
+
+-
+ id: 4
+ type: 0 # gitea pull request
+ status: 2 # mergable
+ issue_id: 9
+ index: 1
+ head_repo_id: 48
+ base_repo_id: 48
+ head_branch: branch1
+ base_branch: master
+ merge_base: abcdef1234567890
has_merged: false \ No newline at end of file
diff --git a/models/fixtures/repo_unit.yml b/models/fixtures/repo_unit.yml
index 28c606da43..f7522d3031 100644
--- a/models/fixtures/repo_unit.yml
+++ b/models/fixtures/repo_unit.yml
@@ -452,3 +452,24 @@
type: 1
config: "{}"
created_unix: 946684810
+
+-
+ id: 66
+ repo_id: 46
+ type: 7
+ config: "{\"ExternalTrackerURL\":\"https://tracker.com\",\"ExternalTrackerFormat\":\"https://tracker.com/{user}/{repo}/issues/{index}\",\"ExternalTrackerStyle\":\"\"}"
+ created_unix: 946684810
+
+-
+ id: 67
+ repo_id: 47
+ type: 7
+ config: "{\"ExternalTrackerURL\":\"https://tracker.com\",\"ExternalTrackerFormat\":\"https://tracker.com/{user}/{repo}/issues/{index}\",\"ExternalTrackerStyle\":\"numeric\"}"
+ created_unix: 946684810
+
+-
+ id: 68
+ repo_id: 48
+ type: 7
+ config: "{\"ExternalTrackerURL\":\"https://tracker.com\",\"ExternalTrackerFormat\":\"https://tracker.com/{user}/{repo}/issues/{index}\",\"ExternalTrackerStyle\":\"alphanumeric\"}"
+ created_unix: 946684810 \ No newline at end of file
diff --git a/models/fixtures/repository.yml b/models/fixtures/repository.yml
index 4cec6471e9..feec0b5faf 100644
--- a/models/fixtures/repository.yml
+++ b/models/fixtures/repository.yml
@@ -587,3 +587,40 @@
num_issues: 0
is_mirror: false
status: 0
+
+-
+ id: 46
+ owner_id: 26
+ lower_name: repo_external_tracker
+ name: repo_external_tracker
+ is_private: false
+ num_stars: 0
+ num_forks: 0
+ num_issues: 0
+ is_mirror: false
+ status: 0
+
+-
+ id: 47
+ owner_id: 26
+ lower_name: repo_external_tracker_numeric
+ name: repo_external_tracker_numeric
+ is_private: false
+ num_stars: 0
+ num_forks: 0
+ num_issues: 0
+ is_mirror: false
+ status: 0
+
+-
+ id: 48
+ owner_id: 26
+ lower_name: repo_external_tracker_alpha
+ name: repo_external_tracker_alpha
+ is_private: false
+ num_stars: 0
+ num_forks: 0
+ num_issues: 0
+ num_pulls: 1
+ is_mirror: false
+ status: 0
diff --git a/models/fixtures/user.yml b/models/fixtures/user.yml
index 17294b881f..09a027de79 100644
--- a/models/fixtures/user.yml
+++ b/models/fixtures/user.yml
@@ -424,7 +424,7 @@
is_admin: false
avatar: avatar26
avatar_email: org26@example.com
- num_repos: 1
+ num_repos: 4
num_members: 0
num_teams: 1
repo_admin_change_team_access: true
diff --git a/models/repo_list_test.go b/models/repo_list_test.go
index b1dbf46af0..a1eed18b83 100644
--- a/models/repo_list_test.go
+++ b/models/repo_list_test.go
@@ -175,10 +175,10 @@ func TestSearchRepository(t *testing.T) {
count: 14},
{name: "AllPublic/PublicRepositoriesOfUserIncludingCollaborative",
opts: &SearchRepoOptions{Page: 1, PageSize: 10, OwnerID: 15, AllPublic: true, Template: util.OptionalBoolFalse},
- count: 22},
+ count: 25},
{name: "AllPublic/PublicAndPrivateRepositoriesOfUserIncludingCollaborative",
opts: &SearchRepoOptions{Page: 1, PageSize: 10, OwnerID: 15, Private: true, AllPublic: true, Template: util.OptionalBoolFalse},
- count: 28},
+ count: 31},
{name: "AllPublic/PublicAndPrivateRepositoriesOfUserIncludingCollaborativeByName",
opts: &SearchRepoOptions{Keyword: "test", Page: 1, PageSize: 10, OwnerID: 15, Private: true, AllPublic: true},
count: 15},
@@ -187,7 +187,7 @@ func TestSearchRepository(t *testing.T) {
count: 13},
{name: "AllPublic/PublicRepositoriesOfOrganization",
opts: &SearchRepoOptions{Page: 1, PageSize: 10, OwnerID: 17, AllPublic: true, Collaborate: util.OptionalBoolFalse, Template: util.OptionalBoolFalse},
- count: 22},
+ count: 25},
{name: "AllTemplates",
opts: &SearchRepoOptions{Page: 1, PageSize: 10, Template: util.OptionalBoolTrue},
count: 2},