@@ -18,65 +18,13 @@ import (
18
18
"github.com/go-macaron/session"
19
19
"gopkg.in/macaron.v1"
20
20
21
- "github.com/gogits/git-module"
22
-
23
21
"github.com/gogits/gogs/models"
24
22
"github.com/gogits/gogs/modules/auth"
25
23
"github.com/gogits/gogs/modules/base"
26
24
"github.com/gogits/gogs/modules/log"
27
25
"github.com/gogits/gogs/modules/setting"
28
26
)
29
27
30
- type PullRequest struct {
31
- BaseRepo * models.Repository
32
- Allowed bool
33
- SameRepo bool
34
- HeadInfo string // [<user>:]<branch>
35
- }
36
-
37
- type Repository struct {
38
- AccessMode models.AccessMode
39
- IsWatching bool
40
- IsViewBranch bool
41
- IsViewTag bool
42
- IsViewCommit bool
43
- Repository * models.Repository
44
- Owner * models.User
45
- Commit * git.Commit
46
- Tag * git.Tag
47
- GitRepo * git.Repository
48
- BranchName string
49
- TagName string
50
- TreeName string
51
- CommitID string
52
- RepoLink string
53
- CloneLink models.CloneLink
54
- CommitsCount int64
55
- Mirror * models.Mirror
56
-
57
- PullRequest * PullRequest
58
- }
59
-
60
- // IsOwner returns true if current user is the owner of repository.
61
- func (r * Repository ) IsOwner () bool {
62
- return r .AccessMode >= models .ACCESS_MODE_OWNER
63
- }
64
-
65
- // IsAdmin returns true if current user has admin or higher access of repository.
66
- func (r * Repository ) IsAdmin () bool {
67
- return r .AccessMode >= models .ACCESS_MODE_ADMIN
68
- }
69
-
70
- // IsWriter returns true if current user has write or higher access of repository.
71
- func (r * Repository ) IsWriter () bool {
72
- return r .AccessMode >= models .ACCESS_MODE_WRITE
73
- }
74
-
75
- // HasAccess returns true if the current user has at least read access for this repository
76
- func (r * Repository ) HasAccess () bool {
77
- return r .AccessMode >= models .ACCESS_MODE_READ
78
- }
79
-
80
28
// Context represents context of a request.
81
29
type Context struct {
82
30
* macaron.Context
@@ -90,17 +38,7 @@ type Context struct {
90
38
IsBasicAuth bool
91
39
92
40
Repo * Repository
93
-
94
- Org struct {
95
- IsOwner bool
96
- IsMember bool
97
- IsTeamMember bool // Is member of team.
98
- IsTeamAdmin bool // In owner team or team that has admin permission level.
99
- Organization * models.User
100
- OrgLink string
101
-
102
- Team * models.Team
103
- }
41
+ Org * Organization
104
42
}
105
43
106
44
// HasError returns true if error occurs in form validation.
@@ -223,6 +161,7 @@ func Contexter() macaron.Handler {
223
161
Repo : & Repository {
224
162
PullRequest : & PullRequest {},
225
163
},
164
+ Org : & Organization {},
226
165
}
227
166
// Compute current URL for real-time change language.
228
167
ctx .Data ["Link" ] = setting .AppSubUrl + strings .TrimSuffix (ctx .Req .URL .Path , "/" )
0 commit comments