mirror of
https://github.com/go-gitea/gitea.git
synced 2026-10-06 23:16:52 +02:00
WIP: create PR - choose branch
This commit is contained in:
1 parent
d015d951bd
commit
dea3a8c6a4
34 files changed
+396
-212
No files matched your search
+3
-3
@@ -146,12 +146,12 @@ func runServ(c *cli.Context) {
|
|||||||
fail("Key permission denied", "Cannot push with deployment key: %d", key.ID)
|
fail("Key permission denied", "Cannot push with deployment key: %d", key.ID)
|
||||||
}
|
}
|
||||||
// Check if this deploy key belongs to current repository.
|
// Check if this deploy key belongs to current repository.
|
||||||
if !models.HasDeployKey(key.ID, repo.Id) {
|
if !models.HasDeployKey(key.ID, repo.ID) {
|
||||||
fail("Key access denied", "Key access denied: %d-%d", key.ID, repo.Id)
|
fail("Key access denied", "Key access denied: %d-%d", key.ID, repo.ID)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update deploy key activity.
|
// Update deploy key activity.
|
||||||
deployKey, err := models.GetDeployKeyByRepo(key.ID, repo.Id)
|
deployKey, err := models.GetDeployKeyByRepo(key.ID, repo.ID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fail("Internal error", "GetDeployKey: %v", err)
|
fail("Internal error", "GetDeployKey: %v", err)
|
||||||
}
|
}
|
||||||
|
|||||||
+3
-1
@@ -449,6 +449,8 @@ func runWeb(ctx *cli.Context) {
|
|||||||
m.Get("/edit/:tagname", repo.EditRelease)
|
m.Get("/edit/:tagname", repo.EditRelease)
|
||||||
m.Post("/edit/:tagname", bindIgnErr(auth.EditReleaseForm{}), repo.EditReleasePost)
|
m.Post("/edit/:tagname", bindIgnErr(auth.EditReleaseForm{}), repo.EditReleasePost)
|
||||||
}, reqRepoAdmin, middleware.RepoRef())
|
}, reqRepoAdmin, middleware.RepoRef())
|
||||||
|
|
||||||
|
m.Combo("/compare/*").Get(repo.CompareAndPullRequest)
|
||||||
}, reqSignIn, middleware.RepoAssignment(true))
|
}, reqSignIn, middleware.RepoAssignment(true))
|
||||||
|
|
||||||
m.Group("/:username/:reponame", func() {
|
m.Group("/:username/:reponame", func() {
|
||||||
@@ -469,7 +471,7 @@ func runWeb(ctx *cli.Context) {
|
|||||||
m.Get("/commit/*", repo.Diff)
|
m.Get("/commit/*", repo.Diff)
|
||||||
}, middleware.RepoRef())
|
}, middleware.RepoRef())
|
||||||
|
|
||||||
m.Get("/compare/:before([a-z0-9]+)...:after([a-z0-9]+)", repo.CompareDiff)
|
m.Get("/compare/:before([a-z0-9]{40})...:after([a-z0-9]{40})", repo.CompareDiff)
|
||||||
}, ignSignIn, middleware.RepoAssignment(true))
|
}, ignSignIn, middleware.RepoAssignment(true))
|
||||||
|
|
||||||
m.Group("/:username", func() {
|
m.Group("/:username", func() {
|
||||||
|
|||||||
@@ -395,6 +395,9 @@ issues.label_deletion = Label Deletion
|
|||||||
issues.label_deletion_desc = Delete this label will remove its information in all related issues. Do you want to continue?
|
issues.label_deletion_desc = Delete this label will remove its information in all related issues. Do you want to continue?
|
||||||
issues.label_deletion_success = Label has been deleted successfully!
|
issues.label_deletion_success = Label has been deleted successfully!
|
||||||
|
|
||||||
|
pulls.compare_changes = Compare Changes
|
||||||
|
pulls.compare_changes_desc = Compare two branches and make a pull request for changes.
|
||||||
|
|
||||||
milestones.new = New Milestone
|
milestones.new = New Milestone
|
||||||
milestones.open_tab = %d Open
|
milestones.open_tab = %d Open
|
||||||
milestones.close_tab = %d Closed
|
milestones.close_tab = %d Closed
|
||||||
|
|||||||
+7
-7
@@ -37,11 +37,11 @@ func accessLevel(e Engine, u *User, repo *Repository) (AccessMode, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if u != nil {
|
if u != nil {
|
||||||
if u.Id == repo.OwnerId {
|
if u.Id == repo.OwnerID {
|
||||||
return ACCESS_MODE_OWNER, nil
|
return ACCESS_MODE_OWNER, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
a := &Access{UserID: u.Id, RepoID: repo.Id}
|
a := &Access{UserID: u.Id, RepoID: repo.ID}
|
||||||
if has, err := e.Get(a); !has || err != nil {
|
if has, err := e.Get(a); !has || err != nil {
|
||||||
return mode, err
|
return mode, err
|
||||||
}
|
}
|
||||||
@@ -77,7 +77,7 @@ func (u *User) GetAccessibleRepositories() (map[*Repository]AccessMode, error) {
|
|||||||
|
|
||||||
repos := make(map[*Repository]AccessMode, len(accesses))
|
repos := make(map[*Repository]AccessMode, len(accesses))
|
||||||
for _, access := range accesses {
|
for _, access := range accesses {
|
||||||
repo, err := GetRepositoryById(access.RepoID)
|
repo, err := GetRepositoryByID(access.RepoID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if IsErrRepoNotExist(err) {
|
if IsErrRepoNotExist(err) {
|
||||||
log.Error(4, "%v", err)
|
log.Error(4, "%v", err)
|
||||||
@@ -87,7 +87,7 @@ func (u *User) GetAccessibleRepositories() (map[*Repository]AccessMode, error) {
|
|||||||
}
|
}
|
||||||
if err = repo.GetOwner(); err != nil {
|
if err = repo.GetOwner(); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
} else if repo.OwnerId == u.Id {
|
} else if repo.OwnerID == u.Id {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
repos[repo] = access.Mode
|
repos[repo] = access.Mode
|
||||||
@@ -121,13 +121,13 @@ func (repo *Repository) refreshAccesses(e Engine, accessMap map[int64]AccessMode
|
|||||||
}
|
}
|
||||||
newAccesses = append(newAccesses, Access{
|
newAccesses = append(newAccesses, Access{
|
||||||
UserID: userID,
|
UserID: userID,
|
||||||
RepoID: repo.Id,
|
RepoID: repo.ID,
|
||||||
Mode: mode,
|
Mode: mode,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// Delete old accesses and insert new ones for repository.
|
// Delete old accesses and insert new ones for repository.
|
||||||
if _, err = e.Delete(&Access{RepoID: repo.Id}); err != nil {
|
if _, err = e.Delete(&Access{RepoID: repo.ID}); err != nil {
|
||||||
return fmt.Errorf("delete old accesses: %v", err)
|
return fmt.Errorf("delete old accesses: %v", err)
|
||||||
} else if _, err = e.Insert(newAccesses); err != nil {
|
} else if _, err = e.Insert(newAccesses); err != nil {
|
||||||
return fmt.Errorf("insert new accesses: %v", err)
|
return fmt.Errorf("insert new accesses: %v", err)
|
||||||
@@ -193,7 +193,7 @@ func (repo *Repository) recalculateTeamAccesses(e Engine, ignTeamID int64) (err
|
|||||||
// have relations with repository.
|
// have relations with repository.
|
||||||
if t.IsOwnerTeam() {
|
if t.IsOwnerTeam() {
|
||||||
t.Authorize = ACCESS_MODE_OWNER
|
t.Authorize = ACCESS_MODE_OWNER
|
||||||
} else if !t.hasRepository(e, repo.Id) {
|
} else if !t.hasRepository(e, repo.ID) {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+8
-8
@@ -348,7 +348,7 @@ func CommitRepoAction(userId, repoUserId int64, userName, actEmail string,
|
|||||||
// check if repo belongs to org and append additional webhooks
|
// check if repo belongs to org and append additional webhooks
|
||||||
if repo.Owner.IsOrganization() {
|
if repo.Owner.IsOrganization() {
|
||||||
// get hooks for org
|
// get hooks for org
|
||||||
orgws, err := GetActiveWebhooksByOrgId(repo.OwnerId)
|
orgws, err := GetActiveWebhooksByOrgId(repo.OwnerID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return errors.New("GetActiveWebhooksByOrgId: " + err.Error())
|
return errors.New("GetActiveWebhooksByOrgId: " + err.Error())
|
||||||
}
|
}
|
||||||
@@ -388,7 +388,7 @@ func CommitRepoAction(userId, repoUserId int64, userName, actEmail string,
|
|||||||
Ref: refFullName,
|
Ref: refFullName,
|
||||||
Commits: commits,
|
Commits: commits,
|
||||||
Repo: &PayloadRepo{
|
Repo: &PayloadRepo{
|
||||||
Id: repo.Id,
|
Id: repo.ID,
|
||||||
Name: repo.LowerName,
|
Name: repo.LowerName,
|
||||||
Url: repoLink,
|
Url: repoLink,
|
||||||
Description: repo.Description,
|
Description: repo.Description,
|
||||||
@@ -431,7 +431,7 @@ func CommitRepoAction(userId, repoUserId int64, userName, actEmail string,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if err = CreateHookTask(&HookTask{
|
if err = CreateHookTask(&HookTask{
|
||||||
RepoID: repo.Id,
|
RepoID: repo.ID,
|
||||||
HookID: w.Id,
|
HookID: w.Id,
|
||||||
Type: w.HookTaskType,
|
Type: w.HookTaskType,
|
||||||
Url: w.Url,
|
Url: w.Url,
|
||||||
@@ -453,12 +453,12 @@ func newRepoAction(e Engine, u *User, repo *Repository) (err error) {
|
|||||||
ActUserName: u.Name,
|
ActUserName: u.Name,
|
||||||
ActEmail: u.Email,
|
ActEmail: u.Email,
|
||||||
OpType: CREATE_REPO,
|
OpType: CREATE_REPO,
|
||||||
RepoID: repo.Id,
|
RepoID: repo.ID,
|
||||||
RepoUserName: repo.Owner.Name,
|
RepoUserName: repo.Owner.Name,
|
||||||
RepoName: repo.Name,
|
RepoName: repo.Name,
|
||||||
IsPrivate: repo.IsPrivate,
|
IsPrivate: repo.IsPrivate,
|
||||||
}); err != nil {
|
}); err != nil {
|
||||||
return fmt.Errorf("notify watchers '%d/%s'", u.Id, repo.Id)
|
return fmt.Errorf("notify watchers '%d/%s'", u.Id, repo.ID)
|
||||||
}
|
}
|
||||||
|
|
||||||
log.Trace("action.NewRepoAction: %s/%s", u.Name, repo.Name)
|
log.Trace("action.NewRepoAction: %s/%s", u.Name, repo.Name)
|
||||||
@@ -476,19 +476,19 @@ func transferRepoAction(e Engine, actUser, oldOwner, newOwner *User, repo *Repos
|
|||||||
ActUserName: actUser.Name,
|
ActUserName: actUser.Name,
|
||||||
ActEmail: actUser.Email,
|
ActEmail: actUser.Email,
|
||||||
OpType: TRANSFER_REPO,
|
OpType: TRANSFER_REPO,
|
||||||
RepoID: repo.Id,
|
RepoID: repo.ID,
|
||||||
RepoUserName: newOwner.Name,
|
RepoUserName: newOwner.Name,
|
||||||
RepoName: repo.Name,
|
RepoName: repo.Name,
|
||||||
IsPrivate: repo.IsPrivate,
|
IsPrivate: repo.IsPrivate,
|
||||||
Content: path.Join(oldOwner.LowerName, repo.LowerName),
|
Content: path.Join(oldOwner.LowerName, repo.LowerName),
|
||||||
}
|
}
|
||||||
if err = notifyWatchers(e, action); err != nil {
|
if err = notifyWatchers(e, action); err != nil {
|
||||||
return fmt.Errorf("notify watchers '%d/%s'", actUser.Id, repo.Id)
|
return fmt.Errorf("notify watchers '%d/%s'", actUser.Id, repo.ID)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Remove watch for organization.
|
// Remove watch for organization.
|
||||||
if repo.Owner.IsOrganization() {
|
if repo.Owner.IsOrganization() {
|
||||||
if err = watchRepo(e, repo.Owner.Id, repo.Id, false); err != nil {
|
if err = watchRepo(e, repo.Owner.Id, repo.ID, false); err != nil {
|
||||||
return fmt.Errorf("watch repository: %v", err)
|
return fmt.Errorf("watch repository: %v", err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+14
-14
@@ -68,7 +68,7 @@ func (i *Issue) AfterSet(colName string, _ xorm.Cell) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (i *Issue) GetPoster() (err error) {
|
func (i *Issue) GetPoster() (err error) {
|
||||||
i.Poster, err = GetUserById(i.PosterID)
|
i.Poster, err = GetUserByID(i.PosterID)
|
||||||
if IsErrUserNotExist(err) {
|
if IsErrUserNotExist(err) {
|
||||||
i.Poster = &User{Name: "FakeUser"}
|
i.Poster = &User{Name: "FakeUser"}
|
||||||
return nil
|
return nil
|
||||||
@@ -104,7 +104,7 @@ func (i *Issue) GetAssignee() (err error) {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
i.Assignee, err = GetUserById(i.AssigneeID)
|
i.Assignee, err = GetUserByID(i.AssigneeID)
|
||||||
if IsErrUserNotExist(err) {
|
if IsErrUserNotExist(err) {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
@@ -170,7 +170,7 @@ func GetIssueByRef(ref string) (issue *Issue, err error) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
return GetIssueByIndex(repo.Id, issueNumber)
|
return GetIssueByIndex(repo.ID, issueNumber)
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetIssueByIndex returns issue by given index in repository.
|
// GetIssueByIndex returns issue by given index in repository.
|
||||||
@@ -304,7 +304,7 @@ func NewIssueUserPairs(repo *Repository, issueID, orgID, posterID, assigneeID in
|
|||||||
|
|
||||||
iu := &IssueUser{
|
iu := &IssueUser{
|
||||||
IssueId: issueID,
|
IssueId: issueID,
|
||||||
RepoId: repo.Id,
|
RepoId: repo.ID,
|
||||||
}
|
}
|
||||||
|
|
||||||
isNeedAddPoster := true
|
isNeedAddPoster := true
|
||||||
@@ -331,9 +331,9 @@ func NewIssueUserPairs(repo *Repository, issueID, orgID, posterID, assigneeID in
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Add owner's as well.
|
// Add owner's as well.
|
||||||
if repo.OwnerId != posterID {
|
if repo.OwnerID != posterID {
|
||||||
iu.Id = 0
|
iu.Id = 0
|
||||||
iu.Uid = repo.OwnerId
|
iu.Uid = repo.OwnerID
|
||||||
iu.IsAssigned = iu.Uid == assigneeID
|
iu.IsAssigned = iu.Uid == assigneeID
|
||||||
if _, err = x.Insert(iu); err != nil {
|
if _, err = x.Insert(iu); err != nil {
|
||||||
return err
|
return err
|
||||||
@@ -760,7 +760,7 @@ func MilestoneStats(repoID int64) (open int64, closed int64) {
|
|||||||
|
|
||||||
// ChangeMilestoneStatus changes the milestone open/closed status.
|
// ChangeMilestoneStatus changes the milestone open/closed status.
|
||||||
func ChangeMilestoneStatus(m *Milestone, isClosed bool) (err error) {
|
func ChangeMilestoneStatus(m *Milestone, isClosed bool) (err error) {
|
||||||
repo, err := GetRepositoryById(m.RepoID)
|
repo, err := GetRepositoryByID(m.RepoID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@@ -776,9 +776,9 @@ func ChangeMilestoneStatus(m *Milestone, isClosed bool) (err error) {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
repo.NumMilestones = int(countRepoMilestones(sess, repo.Id))
|
repo.NumMilestones = int(countRepoMilestones(sess, repo.ID))
|
||||||
repo.NumClosedMilestones = int(countRepoClosedMilestones(sess, repo.Id))
|
repo.NumClosedMilestones = int(countRepoClosedMilestones(sess, repo.ID))
|
||||||
if _, err = sess.Id(repo.Id).AllCols().Update(repo); err != nil {
|
if _, err = sess.Id(repo.ID).AllCols().Update(repo); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
return sess.Commit()
|
return sess.Commit()
|
||||||
@@ -886,7 +886,7 @@ func DeleteMilestoneByID(mid int64) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
repo, err := GetRepositoryById(m.RepoID)
|
repo, err := GetRepositoryByID(m.RepoID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@@ -901,9 +901,9 @@ func DeleteMilestoneByID(mid int64) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
repo.NumMilestones = int(countRepoMilestones(sess, repo.Id))
|
repo.NumMilestones = int(countRepoMilestones(sess, repo.ID))
|
||||||
repo.NumClosedMilestones = int(countRepoClosedMilestones(sess, repo.Id))
|
repo.NumClosedMilestones = int(countRepoClosedMilestones(sess, repo.ID))
|
||||||
if _, err = sess.Id(repo.Id).AllCols().Update(repo); err != nil {
|
if _, err = sess.Id(repo.ID).AllCols().Update(repo); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -58,7 +58,7 @@ func GetOauth2(identity string) (oa *Oauth2, err error) {
|
|||||||
} else if oa.Uid == -1 {
|
} else if oa.Uid == -1 {
|
||||||
return oa, ErrOauth2NotAssociated
|
return oa, ErrOauth2NotAssociated
|
||||||
}
|
}
|
||||||
oa.User, err = GetUserById(oa.Uid)
|
oa.User, err = GetUserByID(oa.Uid)
|
||||||
return oa, err
|
return oa, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+15
-15
@@ -66,7 +66,7 @@ func (org *User) GetMembers() error {
|
|||||||
|
|
||||||
org.Members = make([]*User, len(ous))
|
org.Members = make([]*User, len(ous))
|
||||||
for i, ou := range ous {
|
for i, ou := range ous {
|
||||||
org.Members[i], err = GetUserById(ou.Uid)
|
org.Members[i], err = GetUserByID(ou.Uid)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@@ -343,11 +343,11 @@ func RemoveOrgUser(orgId, uid int64) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
u, err := GetUserById(uid)
|
u, err := GetUserByID(uid)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("GetUserById: %v", err)
|
return fmt.Errorf("GetUserById: %v", err)
|
||||||
}
|
}
|
||||||
org, err := GetUserById(orgId)
|
org, err := GetUserByID(orgId)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("get organization: %v", err)
|
return fmt.Errorf("get organization: %v", err)
|
||||||
} else if err = org.GetRepositories(); err != nil {
|
} else if err = org.GetRepositories(); err != nil {
|
||||||
@@ -380,10 +380,10 @@ func RemoveOrgUser(orgId, uid int64) error {
|
|||||||
// Delete all repository accesses.
|
// Delete all repository accesses.
|
||||||
access := &Access{UserID: u.Id}
|
access := &Access{UserID: u.Id}
|
||||||
for _, repo := range org.Repos {
|
for _, repo := range org.Repos {
|
||||||
access.RepoID = repo.Id
|
access.RepoID = repo.ID
|
||||||
if _, err = sess.Delete(access); err != nil {
|
if _, err = sess.Delete(access); err != nil {
|
||||||
return err
|
return err
|
||||||
} else if err = watchRepo(sess, u.Id, repo.Id, false); err != nil {
|
} else if err = watchRepo(sess, u.Id, repo.ID, false); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -443,7 +443,7 @@ func (t *Team) getRepositories(e Engine) (err error) {
|
|||||||
|
|
||||||
t.Repos = make([]*Repository, 0, len(teamRepos))
|
t.Repos = make([]*Repository, 0, len(teamRepos))
|
||||||
for i := range teamRepos {
|
for i := range teamRepos {
|
||||||
repo, err := getRepositoryById(e, teamRepos[i].RepoID)
|
repo, err := getRepositoryByID(e, teamRepos[i].RepoID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("getRepositoryById(%d): %v", teamRepos[i].RepoID, err)
|
return fmt.Errorf("getRepositoryById(%d): %v", teamRepos[i].RepoID, err)
|
||||||
}
|
}
|
||||||
@@ -487,7 +487,7 @@ func (t *Team) HasRepository(repoID int64) bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (t *Team) addRepository(e Engine, repo *Repository) (err error) {
|
func (t *Team) addRepository(e Engine, repo *Repository) (err error) {
|
||||||
if err = addTeamRepo(e, t.OrgID, t.ID, repo.Id); err != nil {
|
if err = addTeamRepo(e, t.OrgID, t.ID, repo.ID); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -504,7 +504,7 @@ func (t *Team) addRepository(e Engine, repo *Repository) (err error) {
|
|||||||
return fmt.Errorf("getMembers: %v", err)
|
return fmt.Errorf("getMembers: %v", err)
|
||||||
}
|
}
|
||||||
for _, u := range t.Members {
|
for _, u := range t.Members {
|
||||||
if err = watchRepo(e, u.Id, repo.Id, true); err != nil {
|
if err = watchRepo(e, u.Id, repo.ID, true); err != nil {
|
||||||
return fmt.Errorf("watchRepo: %v", err)
|
return fmt.Errorf("watchRepo: %v", err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -513,9 +513,9 @@ func (t *Team) addRepository(e Engine, repo *Repository) (err error) {
|
|||||||
|
|
||||||
// AddRepository adds new repository to team of organization.
|
// AddRepository adds new repository to team of organization.
|
||||||
func (t *Team) AddRepository(repo *Repository) (err error) {
|
func (t *Team) AddRepository(repo *Repository) (err error) {
|
||||||
if repo.OwnerId != t.OrgID {
|
if repo.OwnerID != t.OrgID {
|
||||||
return errors.New("Repository does not belong to organization")
|
return errors.New("Repository does not belong to organization")
|
||||||
} else if t.HasRepository(repo.Id) {
|
} else if t.HasRepository(repo.ID) {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -533,7 +533,7 @@ func (t *Team) AddRepository(repo *Repository) (err error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (t *Team) removeRepository(e Engine, repo *Repository, recalculate bool) (err error) {
|
func (t *Team) removeRepository(e Engine, repo *Repository, recalculate bool) (err error) {
|
||||||
if err = removeTeamRepo(e, t.ID, repo.Id); err != nil {
|
if err = removeTeamRepo(e, t.ID, repo.ID); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -560,7 +560,7 @@ func (t *Team) removeRepository(e Engine, repo *Repository, recalculate bool) (e
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
if err = watchRepo(e, u.Id, repo.Id, false); err != nil {
|
if err = watchRepo(e, u.Id, repo.ID, false); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -574,7 +574,7 @@ func (t *Team) RemoveRepository(repoID int64) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
repo, err := GetRepositoryById(repoID)
|
repo, err := GetRepositoryByID(repoID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@@ -713,7 +713,7 @@ func DeleteTeam(t *Team) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Get organization.
|
// Get organization.
|
||||||
org, err := GetUserById(t.OrgID)
|
org, err := GetUserByID(t.OrgID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@@ -903,7 +903,7 @@ func removeTeamMember(e Engine, orgId, teamId, uid int64) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Get organization.
|
// Get organization.
|
||||||
org, err := getUserById(e, orgId)
|
org, err := getUserByID(e, orgId)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|||||||
+51
-52
@@ -129,8 +129,8 @@ func NewRepoContext() {
|
|||||||
|
|
||||||
// Repository represents a git repository.
|
// Repository represents a git repository.
|
||||||
type Repository struct {
|
type Repository struct {
|
||||||
Id int64
|
ID int64 `xorm:"pk autoincr"`
|
||||||
OwnerId int64 `xorm:"UNIQUE(s)"`
|
OwnerID int64 `xorm:"UNIQUE(s)"`
|
||||||
Owner *User `xorm:"-"`
|
Owner *User `xorm:"-"`
|
||||||
LowerName string `xorm:"UNIQUE(s) INDEX NOT NULL"`
|
LowerName string `xorm:"UNIQUE(s) INDEX NOT NULL"`
|
||||||
Name string `xorm:"INDEX NOT NULL"`
|
Name string `xorm:"INDEX NOT NULL"`
|
||||||
@@ -159,8 +159,8 @@ type Repository struct {
|
|||||||
*Mirror `xorm:"-"`
|
*Mirror `xorm:"-"`
|
||||||
|
|
||||||
IsFork bool `xorm:"NOT NULL DEFAULT false"`
|
IsFork bool `xorm:"NOT NULL DEFAULT false"`
|
||||||
ForkId int64
|
ForkID int64
|
||||||
ForkRepo *Repository `xorm:"-"`
|
BaseRepo *Repository `xorm:"-"`
|
||||||
|
|
||||||
Created time.Time `xorm:"CREATED"`
|
Created time.Time `xorm:"CREATED"`
|
||||||
Updated time.Time `xorm:"UPDATED"`
|
Updated time.Time `xorm:"UPDATED"`
|
||||||
@@ -168,7 +168,7 @@ type Repository struct {
|
|||||||
|
|
||||||
func (repo *Repository) getOwner(e Engine) (err error) {
|
func (repo *Repository) getOwner(e Engine) (err error) {
|
||||||
if repo.Owner == nil {
|
if repo.Owner == nil {
|
||||||
repo.Owner, err = getUserById(e, repo.OwnerId)
|
repo.Owner, err = getUserByID(e, repo.OwnerID)
|
||||||
}
|
}
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@@ -178,16 +178,16 @@ func (repo *Repository) GetOwner() (err error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (repo *Repository) GetMirror() (err error) {
|
func (repo *Repository) GetMirror() (err error) {
|
||||||
repo.Mirror, err = GetMirror(repo.Id)
|
repo.Mirror, err = GetMirror(repo.ID)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
func (repo *Repository) GetForkRepo() (err error) {
|
func (repo *Repository) GetBaseRepo() (err error) {
|
||||||
if !repo.IsFork {
|
if !repo.IsFork {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
repo.ForkRepo, err = GetRepositoryById(repo.ForkId)
|
repo.BaseRepo, err = GetRepositoryByID(repo.ForkID)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -211,7 +211,7 @@ func (repo *Repository) HasAccess(u *User) bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (repo *Repository) IsOwnedBy(u *User) bool {
|
func (repo *Repository) IsOwnedBy(u *User) bool {
|
||||||
return repo.OwnerId == u.Id
|
return repo.OwnerID == u.Id
|
||||||
}
|
}
|
||||||
|
|
||||||
// DescriptionHtml does special handles to description and return HTML string.
|
// DescriptionHtml does special handles to description and return HTML string.
|
||||||
@@ -224,7 +224,7 @@ func (repo *Repository) DescriptionHtml() template.HTML {
|
|||||||
|
|
||||||
func isRepositoryExist(e Engine, u *User, repoName string) (bool, error) {
|
func isRepositoryExist(e Engine, u *User, repoName string) (bool, error) {
|
||||||
has, err := e.Get(&Repository{
|
has, err := e.Get(&Repository{
|
||||||
OwnerId: u.Id,
|
OwnerID: u.Id,
|
||||||
LowerName: strings.ToLower(repoName),
|
LowerName: strings.ToLower(repoName),
|
||||||
})
|
})
|
||||||
return has && com.IsDir(RepoPath(u.Name, repoName)), err
|
return has && com.IsDir(RepoPath(u.Name, repoName)), err
|
||||||
@@ -287,8 +287,8 @@ func IsUsableName(name string) error {
|
|||||||
|
|
||||||
// Mirror represents a mirror information of repository.
|
// Mirror represents a mirror information of repository.
|
||||||
type Mirror struct {
|
type Mirror struct {
|
||||||
Id int64
|
ID int64 `xorm:"pk autoincr"`
|
||||||
RepoId int64
|
RepoID int64
|
||||||
RepoName string // <user name>/<repo name>
|
RepoName string // <user name>/<repo name>
|
||||||
Interval int // Hour.
|
Interval int // Hour.
|
||||||
Updated time.Time `xorm:"UPDATED"`
|
Updated time.Time `xorm:"UPDATED"`
|
||||||
@@ -296,7 +296,7 @@ type Mirror struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func getMirror(e Engine, repoId int64) (*Mirror, error) {
|
func getMirror(e Engine, repoId int64) (*Mirror, error) {
|
||||||
m := &Mirror{RepoId: repoId}
|
m := &Mirror{RepoID: repoId}
|
||||||
has, err := e.Get(m)
|
has, err := e.Get(m)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@@ -312,7 +312,7 @@ func GetMirror(repoId int64) (*Mirror, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func updateMirror(e Engine, m *Mirror) error {
|
func updateMirror(e Engine, m *Mirror) error {
|
||||||
_, err := e.Id(m.Id).Update(m)
|
_, err := e.Id(m.ID).Update(m)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -330,7 +330,7 @@ func MirrorRepository(repoId int64, userName, repoName, repoPath, url string) er
|
|||||||
}
|
}
|
||||||
|
|
||||||
if _, err = x.InsertOne(&Mirror{
|
if _, err = x.InsertOne(&Mirror{
|
||||||
RepoId: repoId,
|
RepoID: repoId,
|
||||||
RepoName: strings.ToLower(userName + "/" + repoName),
|
RepoName: strings.ToLower(userName + "/" + repoName),
|
||||||
Interval: 24,
|
Interval: 24,
|
||||||
NextUpdate: time.Now().Add(24 * time.Hour),
|
NextUpdate: time.Now().Add(24 * time.Hour),
|
||||||
@@ -365,7 +365,7 @@ func MigrateRepository(u *User, name, desc string, private, mirror bool, url str
|
|||||||
|
|
||||||
repo.IsBare = false
|
repo.IsBare = false
|
||||||
if mirror {
|
if mirror {
|
||||||
if err = MirrorRepository(repo.Id, u.Name, repo.Name, repoPath, url); err != nil {
|
if err = MirrorRepository(repo.ID, u.Name, repo.Name, repoPath, url); err != nil {
|
||||||
return repo, err
|
return repo, err
|
||||||
}
|
}
|
||||||
repo.IsMirror = true
|
repo.IsMirror = true
|
||||||
@@ -517,7 +517,7 @@ func initRepository(e Engine, repoPath string, u *User, repo *Repository, initRe
|
|||||||
if len(fileName) == 0 {
|
if len(fileName) == 0 {
|
||||||
// Re-fetch the repository from database before updating it (else it would
|
// Re-fetch the repository from database before updating it (else it would
|
||||||
// override changes that were done earlier with sql)
|
// override changes that were done earlier with sql)
|
||||||
if repo, err = getRepositoryById(e, repo.Id); err != nil {
|
if repo, err = getRepositoryByID(e, repo.ID); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
repo.IsBare = true
|
repo.IsBare = true
|
||||||
@@ -562,7 +562,7 @@ func createRepository(e *xorm.Session, u *User, repo *Repository) (err error) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if err = watchRepo(e, u.Id, repo.Id, true); err != nil {
|
if err = watchRepo(e, u.Id, repo.ID, true); err != nil {
|
||||||
return fmt.Errorf("watchRepo: %v", err)
|
return fmt.Errorf("watchRepo: %v", err)
|
||||||
} else if err = newRepoAction(e, u, repo); err != nil {
|
} else if err = newRepoAction(e, u, repo); err != nil {
|
||||||
return fmt.Errorf("newRepoAction: %v", err)
|
return fmt.Errorf("newRepoAction: %v", err)
|
||||||
@@ -574,7 +574,7 @@ func createRepository(e *xorm.Session, u *User, repo *Repository) (err error) {
|
|||||||
// CreateRepository creates a repository for given user or organization.
|
// CreateRepository creates a repository for given user or organization.
|
||||||
func CreateRepository(u *User, name, desc, lang, license string, isPrivate, isMirror, initReadme bool) (_ *Repository, err error) {
|
func CreateRepository(u *User, name, desc, lang, license string, isPrivate, isMirror, initReadme bool) (_ *Repository, err error) {
|
||||||
repo := &Repository{
|
repo := &Repository{
|
||||||
OwnerId: u.Id,
|
OwnerID: u.Id,
|
||||||
Owner: u,
|
Owner: u,
|
||||||
Name: name,
|
Name: name,
|
||||||
LowerName: strings.ToLower(name),
|
LowerName: strings.ToLower(name),
|
||||||
@@ -630,12 +630,12 @@ func GetRepositoriesWithUsers(num, offset int) ([]*Repository, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for _, repo := range repos {
|
for _, repo := range repos {
|
||||||
repo.Owner = &User{Id: repo.OwnerId}
|
repo.Owner = &User{Id: repo.OwnerID}
|
||||||
has, err := x.Get(repo.Owner)
|
has, err := x.Get(repo.Owner)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
} else if !has {
|
} else if !has {
|
||||||
return nil, ErrUserNotExist{repo.OwnerId, ""}
|
return nil, ErrUserNotExist{repo.OwnerID, ""}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -672,11 +672,11 @@ func TransferOwnership(u *User, newOwnerName string, repo *Repository) error {
|
|||||||
|
|
||||||
// Note: we have to set value here to make sure recalculate accesses is based on
|
// Note: we have to set value here to make sure recalculate accesses is based on
|
||||||
// new owner.
|
// new owner.
|
||||||
repo.OwnerId = newOwner.Id
|
repo.OwnerID = newOwner.Id
|
||||||
repo.Owner = newOwner
|
repo.Owner = newOwner
|
||||||
|
|
||||||
// Update repository.
|
// Update repository.
|
||||||
if _, err := sess.Id(repo.Id).Update(repo); err != nil {
|
if _, err := sess.Id(repo.ID).Update(repo); err != nil {
|
||||||
return fmt.Errorf("update owner: %v", err)
|
return fmt.Errorf("update owner: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -687,7 +687,7 @@ func TransferOwnership(u *User, newOwnerName string, repo *Repository) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Dummy object.
|
// Dummy object.
|
||||||
collaboration := &Collaboration{RepoID: repo.Id}
|
collaboration := &Collaboration{RepoID: repo.ID}
|
||||||
for _, c := range collaborators {
|
for _, c := range collaborators {
|
||||||
collaboration.UserID = c.Id
|
collaboration.UserID = c.Id
|
||||||
if c.Id == newOwner.Id || newOwner.IsOrgMember(c.Id) {
|
if c.Id == newOwner.Id || newOwner.IsOrgMember(c.Id) {
|
||||||
@@ -703,7 +703,7 @@ func TransferOwnership(u *User, newOwnerName string, repo *Repository) error {
|
|||||||
return fmt.Errorf("getTeams: %v", err)
|
return fmt.Errorf("getTeams: %v", err)
|
||||||
}
|
}
|
||||||
for _, t := range owner.Teams {
|
for _, t := range owner.Teams {
|
||||||
if !t.hasRepository(sess, repo.Id) {
|
if !t.hasRepository(sess, repo.ID) {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -713,7 +713,7 @@ func TransferOwnership(u *User, newOwnerName string, repo *Repository) error {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if err = owner.removeOrgRepo(sess, repo.Id); err != nil {
|
if err = owner.removeOrgRepo(sess, repo.ID); err != nil {
|
||||||
return fmt.Errorf("removeOrgRepo: %v", err)
|
return fmt.Errorf("removeOrgRepo: %v", err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -739,7 +739,7 @@ func TransferOwnership(u *User, newOwnerName string, repo *Repository) error {
|
|||||||
return fmt.Errorf("decrease old owner repository count: %v", err)
|
return fmt.Errorf("decrease old owner repository count: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
if err = watchRepo(sess, newOwner.Id, repo.Id, true); err != nil {
|
if err = watchRepo(sess, newOwner.Id, repo.ID, true); err != nil {
|
||||||
return fmt.Errorf("watchRepo: %v", err)
|
return fmt.Errorf("watchRepo: %v", err)
|
||||||
} else if err = transferRepoAction(sess, u, owner, newOwner, repo); err != nil {
|
} else if err = transferRepoAction(sess, u, owner, newOwner, repo); err != nil {
|
||||||
return fmt.Errorf("transferRepoAction: %v", err)
|
return fmt.Errorf("transferRepoAction: %v", err)
|
||||||
@@ -747,7 +747,7 @@ func TransferOwnership(u *User, newOwnerName string, repo *Repository) error {
|
|||||||
|
|
||||||
// Update mirror information.
|
// Update mirror information.
|
||||||
if repo.IsMirror {
|
if repo.IsMirror {
|
||||||
mirror, err := getMirror(sess, repo.Id)
|
mirror, err := getMirror(sess, repo.ID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("getMirror: %v", err)
|
return fmt.Errorf("getMirror: %v", err)
|
||||||
}
|
}
|
||||||
@@ -794,7 +794,7 @@ func updateRepository(e Engine, repo *Repository, visibilityChanged bool) (err e
|
|||||||
repo.Website = repo.Website[:255]
|
repo.Website = repo.Website[:255]
|
||||||
}
|
}
|
||||||
|
|
||||||
if _, err = e.Id(repo.Id).AllCols().Update(repo); err != nil {
|
if _, err = e.Id(repo.ID).AllCols().Update(repo); err != nil {
|
||||||
return fmt.Errorf("update: %v", err)
|
return fmt.Errorf("update: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -831,7 +831,7 @@ func UpdateRepository(repo *Repository, visibilityChanged bool) (err error) {
|
|||||||
|
|
||||||
// DeleteRepository deletes a repository for a user or organization.
|
// DeleteRepository deletes a repository for a user or organization.
|
||||||
func DeleteRepository(uid, repoID int64, userName string) error {
|
func DeleteRepository(uid, repoID int64, userName string) error {
|
||||||
repo := &Repository{Id: repoID, OwnerId: uid}
|
repo := &Repository{ID: repoID, OwnerID: uid}
|
||||||
has, err := x.Get(repo)
|
has, err := x.Get(repo)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
@@ -840,7 +840,7 @@ func DeleteRepository(uid, repoID int64, userName string) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// In case is a organization.
|
// In case is a organization.
|
||||||
org, err := GetUserById(uid)
|
org, err := GetUserByID(uid)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@@ -866,15 +866,15 @@ func DeleteRepository(uid, repoID int64, userName string) error {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if _, err = sess.Delete(&Repository{Id: repoID}); err != nil {
|
if _, err = sess.Delete(&Repository{ID: repoID}); err != nil {
|
||||||
return err
|
return err
|
||||||
} else if _, err = sess.Delete(&Access{RepoID: repo.Id}); err != nil {
|
} else if _, err = sess.Delete(&Access{RepoID: repo.ID}); err != nil {
|
||||||
return err
|
return err
|
||||||
} else if _, err = sess.Delete(&Action{RepoID: repo.Id}); err != nil {
|
} else if _, err = sess.Delete(&Action{RepoID: repo.ID}); err != nil {
|
||||||
return err
|
return err
|
||||||
} else if _, err = sess.Delete(&Watch{RepoID: repoID}); err != nil {
|
} else if _, err = sess.Delete(&Watch{RepoID: repoID}); err != nil {
|
||||||
return err
|
return err
|
||||||
} else if _, err = sess.Delete(&Mirror{RepoId: repoID}); err != nil {
|
} else if _, err = sess.Delete(&Mirror{RepoID: repoID}); err != nil {
|
||||||
return err
|
return err
|
||||||
} else if _, err = sess.Delete(&IssueUser{RepoId: repoID}); err != nil {
|
} else if _, err = sess.Delete(&IssueUser{RepoId: repoID}); err != nil {
|
||||||
return err
|
return err
|
||||||
@@ -902,7 +902,7 @@ func DeleteRepository(uid, repoID int64, userName string) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if repo.IsFork {
|
if repo.IsFork {
|
||||||
if _, err = sess.Exec("UPDATE `repository` SET num_forks=num_forks-1 WHERE id=?", repo.ForkId); err != nil {
|
if _, err = sess.Exec("UPDATE `repository` SET num_forks=num_forks-1 WHERE id=?", repo.ForkID); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -946,7 +946,7 @@ func GetRepositoryByRef(ref string) (*Repository, error) {
|
|||||||
// GetRepositoryByName returns the repository by given name under user if exists.
|
// GetRepositoryByName returns the repository by given name under user if exists.
|
||||||
func GetRepositoryByName(uid int64, repoName string) (*Repository, error) {
|
func GetRepositoryByName(uid int64, repoName string) (*Repository, error) {
|
||||||
repo := &Repository{
|
repo := &Repository{
|
||||||
OwnerId: uid,
|
OwnerID: uid,
|
||||||
LowerName: strings.ToLower(repoName),
|
LowerName: strings.ToLower(repoName),
|
||||||
}
|
}
|
||||||
has, err := x.Get(repo)
|
has, err := x.Get(repo)
|
||||||
@@ -958,7 +958,7 @@ func GetRepositoryByName(uid int64, repoName string) (*Repository, error) {
|
|||||||
return repo, err
|
return repo, err
|
||||||
}
|
}
|
||||||
|
|
||||||
func getRepositoryById(e Engine, id int64) (*Repository, error) {
|
func getRepositoryByID(e Engine, id int64) (*Repository, error) {
|
||||||
repo := new(Repository)
|
repo := new(Repository)
|
||||||
has, err := e.Id(id).Get(repo)
|
has, err := e.Id(id).Get(repo)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -969,9 +969,9 @@ func getRepositoryById(e Engine, id int64) (*Repository, error) {
|
|||||||
return repo, nil
|
return repo, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetRepositoryById returns the repository by given id if exists.
|
// GetRepositoryByID returns the repository by given id if exists.
|
||||||
func GetRepositoryById(id int64) (*Repository, error) {
|
func GetRepositoryByID(id int64) (*Repository, error) {
|
||||||
return getRepositoryById(x, id)
|
return getRepositoryByID(x, id)
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetRepositories returns a list of repositories of given user.
|
// GetRepositories returns a list of repositories of given user.
|
||||||
@@ -982,8 +982,7 @@ func GetRepositories(uid int64, private bool) ([]*Repository, error) {
|
|||||||
sess.Where("is_private=?", false)
|
sess.Where("is_private=?", false)
|
||||||
}
|
}
|
||||||
|
|
||||||
err := sess.Find(&repos, &Repository{OwnerId: uid})
|
return repos, sess.Find(&repos, &Repository{OwnerID: uid})
|
||||||
return repos, err
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetRecentUpdatedRepositories returns the list of repositories that are recently updated.
|
// GetRecentUpdatedRepositories returns the list of repositories that are recently updated.
|
||||||
@@ -993,8 +992,8 @@ func GetRecentUpdatedRepositories(num int) (repos []*Repository, err error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// GetRepositoryCount returns the total number of repositories of user.
|
// GetRepositoryCount returns the total number of repositories of user.
|
||||||
func GetRepositoryCount(user *User) (int64, error) {
|
func GetRepositoryCount(u *User) (int64, error) {
|
||||||
return x.Count(&Repository{OwnerId: user.Id})
|
return x.Count(&Repository{OwnerID: u.Id})
|
||||||
}
|
}
|
||||||
|
|
||||||
type SearchOption struct {
|
type SearchOption struct {
|
||||||
@@ -1199,7 +1198,7 @@ type Collaboration struct {
|
|||||||
// Add collaborator and accompanying access
|
// Add collaborator and accompanying access
|
||||||
func (repo *Repository) AddCollaborator(u *User) error {
|
func (repo *Repository) AddCollaborator(u *User) error {
|
||||||
collaboration := &Collaboration{
|
collaboration := &Collaboration{
|
||||||
RepoID: repo.Id,
|
RepoID: repo.ID,
|
||||||
UserID: u.Id,
|
UserID: u.Id,
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1238,13 +1237,13 @@ func (repo *Repository) AddCollaborator(u *User) error {
|
|||||||
|
|
||||||
func (repo *Repository) getCollaborators(e Engine) ([]*User, error) {
|
func (repo *Repository) getCollaborators(e Engine) ([]*User, error) {
|
||||||
collaborations := make([]*Collaboration, 0)
|
collaborations := make([]*Collaboration, 0)
|
||||||
if err := e.Find(&collaborations, &Collaboration{RepoID: repo.Id}); err != nil {
|
if err := e.Find(&collaborations, &Collaboration{RepoID: repo.ID}); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
users := make([]*User, len(collaborations))
|
users := make([]*User, len(collaborations))
|
||||||
for i, c := range collaborations {
|
for i, c := range collaborations {
|
||||||
user, err := getUserById(e, c.UserID)
|
user, err := getUserByID(e, c.UserID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@@ -1261,7 +1260,7 @@ func (repo *Repository) GetCollaborators() ([]*User, error) {
|
|||||||
// Delete collaborator and accompanying access
|
// Delete collaborator and accompanying access
|
||||||
func (repo *Repository) DeleteCollaborator(u *User) (err error) {
|
func (repo *Repository) DeleteCollaborator(u *User) (err error) {
|
||||||
collaboration := &Collaboration{
|
collaboration := &Collaboration{
|
||||||
RepoID: repo.Id,
|
RepoID: repo.ID,
|
||||||
UserID: u.Id,
|
UserID: u.Id,
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1430,14 +1429,14 @@ func HasForkedRepo(ownerID, repoID int64) (*Repository, bool) {
|
|||||||
|
|
||||||
func ForkRepository(u *User, oldRepo *Repository, name, desc string) (_ *Repository, err error) {
|
func ForkRepository(u *User, oldRepo *Repository, name, desc string) (_ *Repository, err error) {
|
||||||
repo := &Repository{
|
repo := &Repository{
|
||||||
OwnerId: u.Id,
|
OwnerID: u.Id,
|
||||||
Owner: u,
|
Owner: u,
|
||||||
Name: name,
|
Name: name,
|
||||||
LowerName: strings.ToLower(name),
|
LowerName: strings.ToLower(name),
|
||||||
Description: desc,
|
Description: desc,
|
||||||
IsPrivate: oldRepo.IsPrivate,
|
IsPrivate: oldRepo.IsPrivate,
|
||||||
IsFork: true,
|
IsFork: true,
|
||||||
ForkId: oldRepo.Id,
|
ForkID: oldRepo.ID,
|
||||||
}
|
}
|
||||||
|
|
||||||
sess := x.NewSession()
|
sess := x.NewSession()
|
||||||
@@ -1450,7 +1449,7 @@ func ForkRepository(u *User, oldRepo *Repository, name, desc string) (_ *Reposit
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
if _, err = sess.Exec("UPDATE `repository` SET num_forks=num_forks+1 WHERE id=?", oldRepo.Id); err != nil {
|
if _, err = sess.Exec("UPDATE `repository` SET num_forks=num_forks+1 WHERE id=?", oldRepo.ID); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -105,7 +105,7 @@ func Update(refName, oldCommitId, newCommitId, userName, repoUserName, repoName
|
|||||||
commit := &base.PushCommits{}
|
commit := &base.PushCommits{}
|
||||||
|
|
||||||
if err = CommitRepoAction(userId, ru.Id, userName, actEmail,
|
if err = CommitRepoAction(userId, ru.Id, userName, actEmail,
|
||||||
repos.Id, repoUserName, repoName, refName, commit, oldCommitId, newCommitId); err != nil {
|
repos.ID, repoUserName, repoName, refName, commit, oldCommitId, newCommitId); err != nil {
|
||||||
log.GitLogger.Fatal(4, "CommitRepoAction: %s/%s:%v", repoUserName, repoName, err)
|
log.GitLogger.Fatal(4, "CommitRepoAction: %s/%s:%v", repoUserName, repoName, err)
|
||||||
}
|
}
|
||||||
return err
|
return err
|
||||||
@@ -154,7 +154,7 @@ func Update(refName, oldCommitId, newCommitId, userName, repoUserName, repoName
|
|||||||
}
|
}
|
||||||
|
|
||||||
if err = CommitRepoAction(userId, ru.Id, userName, actEmail,
|
if err = CommitRepoAction(userId, ru.Id, userName, actEmail,
|
||||||
repos.Id, repoUserName, repoName, refName, &base.PushCommits{l.Len(), commits, ""}, oldCommitId, newCommitId); err != nil {
|
repos.ID, repoUserName, repoName, refName, &base.PushCommits{l.Len(), commits, ""}, oldCommitId, newCommitId); err != nil {
|
||||||
return fmt.Errorf("runUpdate.models.CommitRepoAction: %s/%s:%v", repoUserName, repoName, err)
|
return fmt.Errorf("runUpdate.models.CommitRepoAction: %s/%s:%v", repoUserName, repoName, err)
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
|
|||||||
+8
-8
@@ -226,7 +226,7 @@ func (u *User) GetOrganizations() error {
|
|||||||
|
|
||||||
u.Orgs = make([]*User, len(ous))
|
u.Orgs = make([]*User, len(ous))
|
||||||
for i, ou := range ous {
|
for i, ou := range ous {
|
||||||
u.Orgs[i], err = GetUserById(ou.OrgID)
|
u.Orgs[i], err = GetUserByID(ou.OrgID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@@ -555,7 +555,7 @@ func GetUserByKeyId(keyId int64) (*User, error) {
|
|||||||
return user, nil
|
return user, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func getUserById(e Engine, id int64) (*User, error) {
|
func getUserByID(e Engine, id int64) (*User, error) {
|
||||||
u := new(User)
|
u := new(User)
|
||||||
has, err := e.Id(id).Get(u)
|
has, err := e.Id(id).Get(u)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -566,9 +566,9 @@ func getUserById(e Engine, id int64) (*User, error) {
|
|||||||
return u, nil
|
return u, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetUserById returns the user object by given ID if exists.
|
// GetUserByID returns the user object by given ID if exists.
|
||||||
func GetUserById(id int64) (*User, error) {
|
func GetUserByID(id int64) (*User, error) {
|
||||||
return getUserById(x, id)
|
return getUserByID(x, id)
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetUserByName returns user by given name.
|
// GetUserByName returns user by given name.
|
||||||
@@ -620,7 +620,7 @@ func GetEmailAddresses(uid int64) ([]*EmailAddress, error) {
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
u, err := GetUserById(uid)
|
u, err := GetUserByID(uid)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@@ -666,7 +666,7 @@ func (email *EmailAddress) Activate() error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
if user, err := GetUserById(email.Uid); err != nil {
|
if user, err := GetUserByID(email.Uid); err != nil {
|
||||||
return err
|
return err
|
||||||
} else {
|
} else {
|
||||||
user.Rands = GetUserSalt()
|
user.Rands = GetUserSalt()
|
||||||
@@ -793,7 +793,7 @@ func GetUserByEmail(email string) (*User, error) {
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
if has {
|
if has {
|
||||||
return GetUserById(emailAddress.Uid)
|
return GetUserByID(emailAddress.Uid)
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil, ErrUserNotExist{0, "email"}
|
return nil, ErrUserNotExist{0, "email"}
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ func SignedInId(req *http.Request, sess session.Store) int64 {
|
|||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
if id, ok := uid.(int64); ok {
|
if id, ok := uid.(int64); ok {
|
||||||
if _, err := models.GetUserById(id); err != nil {
|
if _, err := models.GetUserByID(id); err != nil {
|
||||||
if !models.IsErrUserNotExist(err) {
|
if !models.IsErrUserNotExist(err) {
|
||||||
log.Error(4, "GetUserById: %v", err)
|
log.Error(4, "GetUserById: %v", err)
|
||||||
}
|
}
|
||||||
@@ -127,7 +127,7 @@ func SignedInUser(req *http.Request, sess session.Store) (*models.User, bool) {
|
|||||||
return nil, false
|
return nil, false
|
||||||
}
|
}
|
||||||
|
|
||||||
u, err := models.GetUserById(uid)
|
u, err := models.GetUserByID(uid)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error(4, "GetUserById: %v", err)
|
log.Error(4, "GetUserById: %v", err)
|
||||||
return nil, false
|
return nil, false
|
||||||
|
|||||||
@@ -772,7 +772,7 @@ func confLocaleLocale_deDeIni() (*asset, error) {
|
|||||||
return a, nil
|
return a, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
var _confLocaleLocale_enUsIni = []byte("\x1f\x8b\x08\x00\x00\x09\x6e\x88\x00\xff\xc4\x7d\xeb\x72\xdc\x46\xb2\xe6\x7f\x3c\x05\xac\x0d\xad\xec\x08\xaa\x15\xb6\x63\x2f\xe1\x90\xe4\xa5\x49\xeb\x32\x47\x14\x75\x44\x6a\x66\x67\x15\x0a\x0c\xba\x01\x76\x63\xd4\x0d\xb4\x71\x61\x9b\xf3\x6b\x5f\x63\x5f\x6f\x9f\x64\x33\xbf\xcc\xac\x0b\x80\xa6\xe4\x39\x27\xf6\xfc\x21\xab\xab\xb2\x6e\x59\x59\x59\x79\xab\x42\xbe\xdf\x67\x45\xd9\xad\xd2\x67\xe9\x69\xba\xcf\xab\x7a\x5b\x76\x5d\xda\x95\xdb\x9b\xc7\x9b\xa6\xeb\xcb\x22\x7d\x59\xf5\xf4\xbb\xbd\xad\x56\x65\x92\x6c\x9a\x5d\x49\xa0\xaf\xe8\x5f\x52\xe4\xdd\x66\xd9\xe4\x6d\x41\x19\xe7\x96\x4e\xca\xdf\xf7\xdb\xa6\x65\xa0\x5f\x25\x95\x6c\xca\xed\x9e\xeb\xd0\xbf\xa4\xab\xd6\x75\x56\xd5\xf4\xf3\x8a\x52\xe9\xeb\x3a\xe9\x9a\x55\x95\x6f\xb3\xa0\x00\x19\x56\xfe\x53\xfa\x43\x5d\xa4\x57\x7d\xb9\x4f\x9f\x76\xbb\x7c\xbb\x7d\x9e\x77\xa8\xd2\x97\x69\xbe\x5a\x35\x43\xdd\x3f\x7d\x22\x05\xd2\x78\x33\xf4\xd6\xfa\xe5\xd0\x4b\xde\xb0\xb7\xac\x0f\xfb\xa4\x2d\xd7\x15\x4d\xac\xa5\xac\xf7\x9a\x4c\x0e\xe5\xb2\xab\x7a\x1e\xf4\x5f\x24\x95\xdc\x96\x6d\x57\x35\x3c\x9e\x3f\x4b\x2a\xd9\xe7\x6b\x06\x78\x47\xff\x92\xbe\xdc\xed\xb7\x39\x2a\x5c\x6b\x32\xd9\xe6\xf5\x7a\x10\x98\x37\x9a\x4c\x92\x81\x30\x57\xe7\xc0\xd9\x07\x4d\x26\xe5\x2e\xaf\xb6\x8c\x9f\xc7\x9c\xa0\x76\xbb\xee\xd0\x00\x8b\xef\x34\x49\x63\xcc\xfa\xbb\x7d\x89\x21\x3e\xbe\xa6\x54\xb2\xca\xf7\xfd\x6a\x93\x53\xce\x99\xa4\x12\x02\xda\x37\x34\xd6\xa6\xbd\x03\x9c\xfd\x48\x9a\x76\x9d\xd7\xd5\x3f\xf2\x5e\xc6\x7f\x19\xfc\x4c\x76\x55\xdb\x36\x3c\xf5\x0b\x24\x92\xba\x3c\x64\xdc\x0e\xe5\xbc\x2d\x0f\x61\x2b\x5c\xb2\xab\xd6\xad\xcc\x92\x0b\x2f\xf0\x8b\x5b\xe1\xb2\x9b\xa6\xfd\xac\x05\x2f\x38\x39\xaa\x4a\x83\xd0\xd2\xb8\xff\xbc\x26\xbc\x68\xe9\x05\x7e\x44\x00\x5d\x92\x17\xbb\xaa\xce\xf6\x79\x5d\x32\x8e\x4e\xf9\x17\xe1\x85\x7e\x25\xba\xdc\x59\x57\xf6\x7d\x55\xaf\x3b\x2e\x96\xac\xf4\x4a\xb3\x92\xa0\xcc\xe5\xf1\x78\xba\xec\xa6\x2c\x0b\x19\x51\x97\xbe\xa0\x74\xb2\x1f\xb6\x5b\x9a\xfb\x6f\x43\xd9\xf5\x0c\xff\x8e\x7e\xd3\x2c\xe4\x77\x52\x75\x1d\x25\x28\xfb\x35\x12\x09\x2d\x40\xbd\xc2\x90\xce\x90\x48\x92\x8f\x5d\x99\xb7\xab\xcd\xa7\x44\xfe\xa3\x47\x4e\x2c\x16\x8b\xa3\x4b\xc3\xe4\xa0\xa4\x20\x3d\x58\x07\xc9\xaa\x29\xf8\xc7\x19\xfd\xa3\xa6\xab\xba\xeb\x89\xa4\x3f\x25\x9a\x60\x30\x49\x09\x1a\xfb\xaa\xdf\x96\x3e\x13\xfb\xa3\xe3\x75\x48\x5f\x54\x6d\xd7\x3f\xee\x2b\x22\xb9\xf7\x43\x9d\xf0\xfc\x88\x9c\xb3\x62\x69\xbb\xfc\x65\x43\xd8\x41\x76\x4b\xf3\xbb\xb8\xbb\xfa\xd7\x37\x27\xe9\x3b\xda\xea\xeb\xb6\xa4\x74\x4a\x6d\xd0\x3f\xaa\xf3\xe3\x22\xa1\x5a\xd6\xd3\x79\xde\xe7\xcb\xbc\x2b\x3d\x5a\xb9\x50\x68\xd4\x95\x81\x52\x99\x6d\x80\x45\x74\x7d\x34\xdf\x39\x3a\xa7\x36\x74\x77\xb8\x36\xde\xf2\x16\xa1\x7c\xe6\x1a\xa8\xfc\x6e\x5b\x72\x3e\x35\x95\xbe\x7e\xfb\xf6\xf2\xfc\x97\xb4\xac\xd7\x55\x5d\xa6\x87\xaa\xdf\xa4\x43\x7f\xf3\xdf\xb3\x75\x59\x97\x2d\x31\x91\x55\x95\xd2\xce\x68\x89\x08\x52\x22\x4f\x99\xdc\x22\xe9\xba\x6d\xb6\x13\xf4\x5e\x5d\xbd\x49\x2f\x18\xc5\xfb\xbc\xdf\x60\x20\xfd\x26\xe9\x7e\xdb\x32\x8a\x5c\x87\xd7\x9b\x32\xbd\xa9\x68\xd6\x00\x6a\x6e\x0c\x1f\x69\xa1\x63\x5c\x24\x65\xdb\x66\xb4\xef\xfb\xbb\x4c\x2b\x6b\x7b\x63\x48\x69\x82\x48\xa7\x6e\xfa\x74\x59\xa6\xa8\xb3\x48\x12\x1b\xb0\x61\xf7\x74\xbf\xdf\x56\x2b\xd9\xb1\x2f\xa5\xcc\x23\x9a\x59\xb4\x62\x29\x84\x03\xa2\xac\x2c\x40\x17\xf1\xbf\xbb\x66\x68\xd3\x88\x0d\xa0\xfe\xa6\x24\xbe\xbc\x19\x68\xcb\xe5\xc4\x53\xb7\xcd\x50\x7c\x03\x4a\xb5\xd1\x7b\x42\x4d\xdf\x37\x34\x60\x60\xc7\x01\xf8\x2e\x4e\x89\xe2\xf8\x54\x68\xcb\x5d\x43\xdc\xc1\x11\x7b\x45\x04\x75\xa8\xa8\x90\x66\xda\xe5\xb7\xb4\xdf\xfa\x26\xed\x37\x55\x97\x16\x44\x6c\x2b\x6e\x98\xb6\xc6\x40\xfc\x58\xc8\x82\x08\x54\x48\xc3\xf2\xe2\x35\x00\xd4\x6e\x20\x6a\xda\x50\x63\xcc\xed\xf9\x68\xa2\x26\xe7\xc6\x89\x29\x51\x3b\xa0\x6f\xa2\xdc\x86\x78\x2b\x73\xbf\x73\x24\xf4\x77\xd8\x3e\x8d\x2a\xbf\xb9\xa1\x51\x75\x44\x15\xaf\xd2\xd5\xb6\x21\x92\xfa\xf0\xfe\x0d\x55\xde\xf4\xfd\x3e\xdb\x37\x2d\xc8\xf8\xfa\xfa\x1d\x6d\x8f\xb6\xf7\xb9\x01\xae\x19\xa6\x1e\x76\x4b\xfa\x75\xd8\x54\xc4\x04\xf2\x60\x81\x80\x8a\x2d\x1f\x30\x75\xda\xd4\x0b\xac\xd5\xd0\x6e\x47\xcb\x48\x5d\x5a\xc9\x91\xe1\xf1\x10\x9e\xf0\x9f\x2b\x3f\x4a\x4c\xb7\xa3\x53\xf8\x80\x45\xa5\xa9\x96\x38\x4d\x88\xb6\x9a\x3d\xb7\x1b\x10\xd7\xa5\x66\x78\x8a\xc2\x09\xe4\xca\xe5\x1c\xa2\x52\x9c\xf1\x01\x2f\xdd\xd1\x84\x75\x37\x5f\x5d\x10\x1a\xb0\xa5\x91\x7b\xd3\x36\x3b\xca\x7d\x41\xff\x7c\x86\x1f\xfe\x05\xb7\x07\x98\xbc\x28\x88\xcd\x74\x27\xe9\xfb\x17\x67\xe9\x7f\xf9\xf1\x87\x1f\x16\xe9\xeb\x9e\x37\x04\xd3\xc8\xdf\x79\x6d\x29\x29\x07\xa2\x03\xa5\x9d\xdb\xd3\xf2\x3f\x60\x02\x7f\x90\x3e\x45\xe9\xff\x28\x7f\xcf\xe9\x9c\x2d\x17\xab\x66\xf7\x9c\x37\xf7\x2e\xef\x17\x09\x97\x10\xd5\x28\x39\x5d\x95\x75\x41\x09\x3d\x56\xb5\x2c\xe0\x3a\x5a\x1e\x1c\xb2\x72\xfa\x67\xab\xa6\xbe\xa9\x5a\x9e\xd0\xaf\x75\xbe\x24\x9c\x98\x5c\x40\xec\x18\x25\x76\x76\x11\xd2\x68\x23\x57\x37\x77\x1e\x14\x53\x7d\xcb\x99\xba\xa0\x09\xcb\x4a\xd4\xa8\x8a\x4c\x0e\xcb\x57\xc8\xc6\xba\x5d\xd2\xf4\x5a\xc3\x77\xe7\x11\xde\xdc\xdc\x6c\x89\xb1\x19\xb3\xd2\x1e\x2e\x25\x57\xf8\x56\x08\x42\xc4\xb8\x87\x64\x7Line truncated
|
var _confLocaleLocale_enUsIni = []byte("\x1f\x8b\x08\x00\x00\x09\x6e\x88\x00\xff\xc4\x7d\xeb\x72\xdc\x46\xb2\xe6\x7f\x3c\x05\xac\x0d\xad\xec\x08\xaa\x15\xb6\x63\x2f\xe1\x90\xe4\xa5\x49\xeb\x32\x47\x14\x75\x44\x6a\x66\x67\x15\x0a\x0c\xba\x01\x76\x63\xd4\x0d\xb4\x71\x61\x9b\xf3\x6b\x5f\x63\x5f\x6f\x9f\x64\x33\xbf\xcc\xac\x0b\x80\xa6\xe4\x39\x27\xf6\xfc\x21\xab\xab\xb2\x6e\x59\x59\x59\x79\xab\x42\xbe\xdf\x67\x45\xd9\xad\xd2\x67\xe9\x69\xba\xcf\xab\x7a\x5b\x76\x5d\xda\x95\xdb\x9b\xc7\x9b\xa6\xeb\xcb\x22\x7d\x59\xf5\xf4\xbb\xbd\xad\x56\x65\x92\x6c\x9a\x5d\x49\xa0\xaf\xe8\x5f\x52\xe4\xdd\x66\xd9\xe4\x6d\x41\x19\xe7\x96\x4e\xca\xdf\xf7\xdb\xa6\x65\xa0\x5f\x25\x95\x6c\xca\xed\x9e\xeb\xd0\xbf\xa4\xab\xd6\x75\x56\xd5\xf4\xf3\x8a\x52\xe9\xeb\x3a\xe9\x9a\x55\x95\x6f\xb3\xa0\x00\x19\x56\xfe\x53\xfa\x43\x5d\xa4\x57\x7d\xb9\x4f\x9f\x76\xbb\x7c\xbb\x7d\x9e\x77\xa8\xd2\x97\x69\xbe\x5a\x35\x43\xdd\x3f\x7d\x22\x05\xd2\x78\x33\xf4\xd6\xfa\xe5\xd0\x4b\xde\xb0\xb7\xac\x0f\xfb\xa4\x2d\xd7\x15\x4d\xac\xa5\xac\xf7\x9a\x4c\x0e\xe5\xb2\xab\x7a\x1e\xf4\x5f\x24\x95\xdc\x96\x6d\x57\x35\x3c\x9e\x3f\x4b\x2a\xd9\xe7\x6b\x06\x78\x47\xff\x92\xbe\xdc\xed\xb7\x39\x2a\x5c\x6b\x32\xd9\xe6\xf5\x7a\x10\x98\x37\x9a\x4c\x92\x81\x30\x57\xe7\xc0\xd9\x07\x4d\x26\xe5\x2e\xaf\xb6\x8c\x9f\xc7\x9c\xa0\x76\xbb\xee\xd0\x00\x8b\xef\x34\x49\x63\xcc\xfa\xbb\x7d\x89\x21\x3e\xbe\xa6\x54\xb2\xca\xf7\xfd\x6a\x93\x53\xce\x99\xa4\x12\x02\xda\x37\x34\xd6\xa6\xbd\x03\x9c\xfd\x48\x9a\x76\x9d\xd7\xd5\x3f\xf2\x5e\xc6\x7f\x19\xfc\x4c\x76\x55\xdb\x36\x3c\xf5\x0b\x24\x92\xba\x3c\x64\xdc\x0e\xe5\xbc\x2d\x0f\x61\x2b\x5c\xb2\xab\xd6\xad\xcc\x92\x0b\x2f\xf0\x8b\x5b\xe1\xb2\x9b\xa6\xfd\xac\x05\x2f\x38\x39\xaa\x4a\x83\xd0\xd2\xb8\xff\xbc\x26\xbc\x68\xe9\x05\x7e\x44\x00\x5d\x92\x17\xbb\xaa\xce\xf6\x79\x5d\x32\x8e\x4e\xf9\x17\xe1\x85\x7e\x25\xba\xdc\x59\x57\xf6\x7d\x55\xaf\x3b\x2e\x96\xac\xf4\x4a\xb3\x92\xa0\xcc\xe5\xf1\x78\xba\xec\xa6\x2c\x0b\x19\x51\x97\xbe\xa0\x74\xb2\x1f\xb6\x5b\x9a\xfb\x6f\x43\xd9\xf5\x0c\xff\x8e\x7e\xd3\x2c\xe4\x77\x52\x75\x1d\x25\x28\xfb\x35\x12\x09\x2d\x40\xbd\xc2\x90\xce\x90\x48\x92\x8f\x5d\x99\xb7\xab\xcd\xa7\x44\xfe\xa3\x47\x4e\x2c\x16\x8b\xa3\x4b\xc3\xe4\xa0\xa4\x20\x3d\x58\x07\xc9\xaa\x29\xf8\xc7\x19\xfd\xa3\xa6\xab\xba\xeb\x89\xa4\x3f\x25\x9a\x60\x30\x49\x09\x1a\xfb\xaa\xdf\x96\x3e\x13\xfb\xa3\xe3\x75\x48\x5f\x54\x6d\xd7\x3f\xee\x2b\x22\xb9\xf7\x43\x9d\xf0\xfc\x88\x9c\xb3\x62\x69\xbb\xfc\x65\x43\xd8\x41\x76\x4b\xf3\xbb\xb8\xbb\xfa\xd7\x37\x27\xe9\x3b\xda\xea\xeb\xb6\xa4\x74\x4a\x6d\xd0\x3f\xaa\xf3\xe3\x22\xa1\x5a\xd6\xd3\x79\xde\xe7\xcb\xbc\x2b\x3d\x5a\xb9\x50\x68\xd4\x95\x81\x52\x99\x6d\x80\x45\x74\x7d\x34\xdf\x39\x3a\xa7\x36\x74\x77\xb8\x36\xde\xf2\x16\xa1\x7c\xe6\x1a\xa8\xfc\x6e\x5b\x72\x3e\x35\x95\xbe\x7e\xfb\xf6\xf2\xfc\x97\xb4\xac\xd7\x55\x5d\xa6\x87\xaa\xdf\xa4\x43\x7f\xf3\xdf\xb3\x75\x59\x97\x2d\x31\x91\x55\x95\xd2\xce\x68\x89\x08\x52\x22\x4f\x99\xdc\x22\xe9\xba\x6d\xb6\x13\xf4\x5e\x5d\xbd\x49\x2f\x18\xc5\xfb\xbc\xdf\x60\x20\xfd\x26\xe9\x7e\xdb\x32\x8a\x5c\x87\xd7\x9b\x32\xbd\xa9\x68\xd6\x00\x6a\x6e\x0c\x1f\x69\xa1\x63\x5c\x24\x65\xdb\x66\xb4\xef\xfb\xbb\x4c\x2b\x6b\x7b\x63\x48\x69\x82\x48\xa7\x6e\xfa\x74\x59\xa6\xa8\xb3\x48\x12\x1b\xb0\x61\xf7\x74\xbf\xdf\x56\x2b\xd9\xb1\x2f\xa5\xcc\x23\x9a\x59\xb4\x62\x29\x84\x03\xa2\xac\x2c\x40\x17\xf1\xbf\xbb\x66\x68\xd3\x88\x0d\xa0\xfe\xa6\x24\xbe\xbc\x19\x68\xcb\xe5\xc4\x53\xb7\xcd\x50\x7c\x03\x4a\xb5\xd1\x7b\x42\x4d\xdf\x37\x34\x60\x60\xc7\x01\xf8\x2e\x4e\x89\xe2\xf8\x54\x68\xcb\x5d\x43\xdc\xc1\x11\x7b\x45\x04\x75\xa8\xa8\x90\x66\xda\xe5\xb7\xb4\xdf\xfa\x26\xed\x37\x55\x97\x16\x44\x6c\x2b\x6e\x98\xb6\xc6\x40\xfc\x58\xc8\x82\x08\x54\x48\xc3\xf2\xe2\x35\x00\xd4\x6e\x20\x6a\xda\x50\x63\xcc\xed\xf9\x68\xa2\x26\xe7\xc6\x89\x29\x51\x3b\xa0\x6f\xa2\xdc\x86\x78\x2b\x73\xbf\x73\x24\xf4\x77\xd8\x3e\x8d\x2a\xbf\xb9\xa1\x51\x75\x44\x15\xaf\xd2\xd5\xb6\x21\x92\xfa\xf0\xfe\x0d\x55\xde\xf4\xfd\x3e\xdb\x37\x2d\xc8\xf8\xfa\xfa\x1d\x6d\x8f\xb6\xf7\xb9\x01\xae\x19\xa6\x1e\x76\x4b\xfa\x75\xd8\x54\xc4\x04\xf2\x60\x81\x80\x8a\x2d\x1f\x30\x75\xda\xd4\x0b\xac\xd5\xd0\x6e\x47\xcb\x48\x5d\x5a\xc9\x91\xe1\xf1\x10\x9e\xf0\x9f\x2b\x3f\x4a\x4c\xb7\xa3\x53\xf8\x80\x45\xa5\xa9\x96\x38\x4d\x88\xb6\x9a\x3d\xb7\x1b\x10\xd7\xa5\x66\x78\x8a\xc2\x09\xe4\xca\xe5\x1c\xa2\x52\x9c\xf1\x01\x2f\xdd\xd1\x84\x75\x37\x5f\x5d\x10\x1a\xb0\xa5\x91\x7b\xd3\x36\x3b\xca\x7d\x41\xff\x7c\x86\x1f\xfe\x05\xb7\x07\x98\xbc\x28\x88\xcd\x74\x27\xe9\xfb\x17\x67\xe9\x7f\xf9\xf1\x87\x1f\x16\xe9\xeb\x9e\x37\x04\xd3\xc8\xdf\x79\x6d\x29\x29\x07\xa2\x03\xa5\x9d\xdb\xd3\xf2\x3f\x60\x02\x7f\x90\x3e\x45\xe9\xff\x28\x7f\xcf\xe9\x9c\x2d\x17\xab\x66\xf7\x9c\x37\xf7\x2e\xef\x17\x09\x97\x10\xd5\x28\x39\x5d\x95\x75\x41\x09\x3d\x56\xb5\x2c\xe0\x3a\x5a\x1e\x1c\xb2\x72\xfa\x67\xab\xa6\xbe\xa9\x5a\x9e\xd0\xaf\x75\xbe\x24\x9c\x98\x5c\x40\xec\x18\x25\x76\x76\x11\xd2\x68\x23\x57\x37\x77\x1e\x14\x53\x7d\xcb\x99\xba\xa0\x09\xcb\x4a\xd4\xa8\x8a\x4c\x0e\xcb\x57\xc8\xc6\xba\x5d\xd2\xf4\x5a\xc3\x77\xe7\x11\xde\xdc\xdc\x6c\x89\xb1\x19\xb3\xd2\x1e\x2e\x25\x57\xf8\x56\x08\x42\xc4\xb8\x87\x64\x7Line truncated
|
||||||
|
|
||||||
func confLocaleLocale_enUsIniBytes() ([]byte, error) {
|
func confLocaleLocale_enUsIniBytes() ([]byte, error) {
|
||||||
return bindataRead(
|
return bindataRead(
|
||||||
@@ -787,7 +787,7 @@ func confLocaleLocale_enUsIni() (*asset, error) {
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
info := bindataFileInfo{name: "conf/locale/locale_en-US.ini", size: 35985, mode: os.FileMode(420), modTime: time.Unix(1439021705, 0)}
|
info := bindataFileInfo{name: "conf/locale/locale_en-US.ini", size: 36113, mode: os.FileMode(420), modTime: time.Unix(1439038800, 0)}
|
||||||
a := &asset{bytes: bytes, info: info}
|
a := &asset{bytes: bytes, info: info}
|
||||||
return a, nil
|
return a, nil
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -156,7 +156,7 @@ func SendResetPasswdMail(r macaron.Render, u *models.User) {
|
|||||||
|
|
||||||
// SendIssueNotifyMail sends mail notification of all watchers of repository.
|
// SendIssueNotifyMail sends mail notification of all watchers of repository.
|
||||||
func SendIssueNotifyMail(u, owner *models.User, repo *models.Repository, issue *models.Issue) ([]string, error) {
|
func SendIssueNotifyMail(u, owner *models.User, repo *models.Repository, issue *models.Issue) ([]string, error) {
|
||||||
ws, err := models.GetWatchers(repo.Id)
|
ws, err := models.GetWatchers(repo.ID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, errors.New("mail.NotifyWatchers(GetWatchers): " + err.Error())
|
return nil, errors.New("mail.NotifyWatchers(GetWatchers): " + err.Error())
|
||||||
}
|
}
|
||||||
@@ -167,7 +167,7 @@ func SendIssueNotifyMail(u, owner *models.User, repo *models.Repository, issue *
|
|||||||
if u.Id == uid {
|
if u.Id == uid {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
u, err := models.GetUserById(uid)
|
u, err := models.GetUserByID(uid)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, errors.New("mail.NotifyWatchers(GetUserById): " + err.Error())
|
return nil, errors.New("mail.NotifyWatchers(GetUserById): " + err.Error())
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -257,7 +257,7 @@ func RepoAssignment(redirect bool, args ...bool) macaron.Handler {
|
|||||||
ctx.Data["HasAccess"] = true
|
ctx.Data["HasAccess"] = true
|
||||||
|
|
||||||
if repo.IsMirror {
|
if repo.IsMirror {
|
||||||
ctx.Repo.Mirror, err = models.GetMirror(repo.Id)
|
ctx.Repo.Mirror, err = models.GetMirror(repo.ID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ctx.Handle(500, "GetMirror", err)
|
ctx.Handle(500, "GetMirror", err)
|
||||||
return
|
return
|
||||||
@@ -291,10 +291,34 @@ func RepoAssignment(redirect bool, args ...bool) macaron.Handler {
|
|||||||
ctx.Data["Tags"] = tags
|
ctx.Data["Tags"] = tags
|
||||||
ctx.Repo.Repository.NumTags = len(tags)
|
ctx.Repo.Repository.NumTags = len(tags)
|
||||||
|
|
||||||
// Non-fork repository will not return error in this method.
|
if repo.IsFork {
|
||||||
if err = repo.GetForkRepo(); err != nil {
|
// Non-fork repository will not return error in this method.
|
||||||
ctx.Handle(500, "GetForkRepo", err)
|
if err = repo.GetBaseRepo(); err != nil {
|
||||||
return
|
ctx.Handle(500, "GetBaseRepo", err)
|
||||||
|
return
|
||||||
|
} else if repo.BaseRepo.GetOwner(); err != nil {
|
||||||
|
ctx.Handle(500, "BaseRepo.GetOwner", err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
bsaeRepo := repo.BaseRepo
|
||||||
|
baseGitRepo, err := git.OpenRepository(models.RepoPath(bsaeRepo.Owner.Name, bsaeRepo.Name))
|
||||||
|
if err != nil {
|
||||||
|
ctx.Handle(500, "OpenRepository", err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if len(bsaeRepo.DefaultBranch) > 0 && baseGitRepo.IsBranchExist(bsaeRepo.DefaultBranch) {
|
||||||
|
ctx.Data["BaseDefaultBranch"] = bsaeRepo.DefaultBranch
|
||||||
|
} else {
|
||||||
|
baseBranches, err := baseGitRepo.GetBranches()
|
||||||
|
if err != nil {
|
||||||
|
ctx.Handle(500, "GetBranches", err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if len(baseBranches) > 0 {
|
||||||
|
ctx.Data["BaseDefaultBranch"] = baseBranches[0]
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx.Data["Title"] = u.Name + "/" + repo.Name
|
ctx.Data["Title"] = u.Name + "/" + repo.Name
|
||||||
@@ -327,8 +351,8 @@ func RepoAssignment(redirect bool, args ...bool) macaron.Handler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ctx.IsSigned {
|
if ctx.IsSigned {
|
||||||
ctx.Data["IsWatchingRepo"] = models.IsWatching(ctx.User.Id, repo.Id)
|
ctx.Data["IsWatchingRepo"] = models.IsWatching(ctx.User.Id, repo.ID)
|
||||||
ctx.Data["IsStaringRepo"] = models.IsStaring(ctx.User.Id, repo.Id)
|
ctx.Data["IsStaringRepo"] = models.IsStaring(ctx.User.Id, repo.ID)
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx.Data["TagName"] = ctx.Repo.TagName
|
ctx.Data["TagName"] = ctx.Repo.TagName
|
||||||
@@ -342,8 +366,8 @@ func RepoAssignment(redirect bool, args ...bool) macaron.Handler {
|
|||||||
|
|
||||||
// If not branch selected, try default one.
|
// If not branch selected, try default one.
|
||||||
// If default branch doesn't exists, fall back to some other branch.
|
// If default branch doesn't exists, fall back to some other branch.
|
||||||
if ctx.Repo.BranchName == "" {
|
if len(ctx.Repo.BranchName) == 0 {
|
||||||
if ctx.Repo.Repository.DefaultBranch != "" && gitRepo.IsBranchExist(ctx.Repo.Repository.DefaultBranch) {
|
if len(ctx.Repo.Repository.DefaultBranch) > 0 && gitRepo.IsBranchExist(ctx.Repo.Repository.DefaultBranch) {
|
||||||
ctx.Repo.BranchName = ctx.Repo.Repository.DefaultBranch
|
ctx.Repo.BranchName = ctx.Repo.Repository.DefaultBranch
|
||||||
} else if len(brs) > 0 {
|
} else if len(brs) > 0 {
|
||||||
ctx.Repo.BranchName = brs[0]
|
ctx.Repo.BranchName = brs[0]
|
||||||
|
|||||||
Vendored
+1
-1
@@ -1 +1 @@
|
|||||||
@font-face{font-family:octicons;src:url(../fonts/octicons.eot?#iefix&v=345f8bad9c5003db196d08f05e7f030fd2a32ff6)format('embedded-opentype'),url(../fonts/octicons.woff?v=345f8bad9c5003db196d08f05e7f030fd2a32ff6)format('woff'),url(../fonts/octicons.ttf?v=345f8bad9c5003db196d08f05e7f030fd2a32ff6)format('truetype'),url(../fonts/octicons.svg?v=345f8bad9c5003db196d08f05e7f030fd2a32ff6#octicons)format('svg');font-weight:400;font-style:normal}.mega-octicon,.octicon{font:normal normal normal 16px/1 octicons;display:inline-block;text-decoration:none;text-rendering:auto;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.mega-octicon{font-size:32px}.octicon-alert:before{content:'\f02d'}.octicon-alignment-align:before{content:'\f08a'}.octicon-alignment-aligned-to:before{content:'\f08e'}.octicon-alignment-unalign:before{content:'\f08b'}.octicon-arrow-down:before{content:'\f03f'}.octicon-arrow-left:before{content:'\f040'}.octicon-arrow-right:before{content:'\f03e'}.octicon-arrow-small-down:before{content:'\f0a0'}.octicon-arrow-small-left:before{content:'\f0a1'}.octicon-arrow-small-right:before{content:'\f071'}.octicon-arrow-small-up:before{content:'\f09f'}.octicon-arrow-up:before{content:'\f03d'}.octicon-beer:before{content:'\f069'}.octicon-book:before{content:'\f007'}.octicon-bookmark:before{content:'\f07b'}.octicon-briefcase:before{content:'\f0d3'}.octicon-broadcast:before{content:'\f048'}.octicon-browser:before{content:'\f0c5'}.octicon-bug:before{content:'\f091'}.octicon-calendar:before{content:'\f068'}.octicon-check:before{content:'\f03a'}.octicon-checklist:before{content:'\f076'}.octicon-chevron-down:before{content:'\f0a3'}.octicon-chevron-left:before{content:'\f0a4'}.octicon-chevron-right:before{content:'\f078'}.octicon-chevron-up:before{content:'\f0a2'}.octicon-circle-slash:before{content:'\f084'}.octicon-circuit-board:before{content:'\f0d6'}.octicon-clippy:before{content:'\f035'}.octicon-clock:before{content:'\f046'}.octicon-cloud-download:before{content:'\f00b'}.octicon-cloud-upload:before{content:'\f00c'}.octicon-code:before{content:'\f05f'}.octicon-color-mode:before{content:'\f065'}.octicon-comment-add:before,.octicon-comment:before{content:'\f02b'}.octicon-comment-discussion:before{content:'\f04f'}.octicon-credit-card:before{content:'\f045'}.octicon-dash:before{content:'\f0ca'}.octicon-dashboard:before{content:'\f07d'}.octicon-database:before{content:'\f096'}.octicon-device-camera:before{content:'\f056'}.octicon-device-camera-video:before{content:'\f057'}.octicon-device-desktop:before{content:'\f27c'}.octicon-device-mobile:before{content:'\f038'}.octicon-diff:before{content:'\f04d'}.octicon-diff-added:before{content:'\f06b'}.octicon-diff-ignored:before{content:'\f099'}.octicon-diff-modified:before{content:'\f06d'}.octicon-diff-removed:before{content:'\f06c'}.octicon-diff-renamed:before{content:'\f06e'}.octicon-ellipsis:before{content:'\f09a'}.octicon-eye-unwatch:before,.octicon-eye-watch:before,.octicon-eye:before{content:'\f04e'}.octicon-file-binary:before{content:'\f094'}.octicon-file-code:before{content:'\f010'}.octicon-file-directory:before{content:'\f016'}.octicon-file-media:before{content:'\f012'}.octicon-file-pdf:before{content:'\f014'}.octicon-file-submodule:before{content:'\f017'}.octicon-file-symlink-directory:before{content:'\f0b1'}.octicon-file-symlink-file:before{content:'\f0b0'}.octicon-file-text:before{content:'\f011'}.octicon-file-zip:before{content:'\f013'}.octicon-flame:before{content:'\f0d2'}.octicon-fold:before{content:'\f0cc'}.octicon-gear:before{content:'\f02f'}.octicon-gift:before{content:'\f042'}.octicon-gist:before{content:'\f00e'}.octicon-gist-secret:before{content:'\f08c'}.octicon-git-branch-create:before,.octicon-git-branch-delete:before,.octicon-git-branch:before{content:'\f020'}.octicon-git-commit:before{content:'\f01f'}.octicon-git-compare:before{content:'\f0ac'}.octicon-git-merge:before{content:'\f023'}.octicon-git-pull-request-abandoned:before,.octicon-git-pull-request:before{content:'\f009'}.octicon-globe:before{content:'\f0b6'}.octicon-graph:before{content:'\f043'}.octicon-heart:before{content:'\2665'}.octicon-history:before{content:'\f07e'}.octicon-home:before{content:'\f08d'}.octicon-horizontal-rule:before{content:'\f070'}.octicon-hourglass:before{content:'\f09e'}.octicon-hubot:before{content:'\f09d'}.octicon-inbox:before{content:'\f0cf'}.octicon-info:before{content:'\f059'}.octicon-issue-closed:before{content:'\f028'}.octicon-issue-opened:before{content:'\f026'}.octicon-issue-reopened:before{content:'\f027'}.octicon-jersey:before{content:'\f019'}.octicon-jump-down:before{content:'\f072'}.octicon-jump-left:before{content:'\f0a5'}.octicon-jump-right:before{content:'\f0a6'}.octicon-jump-up:before{content:'\f073'}.octicon-key:before{content:'\f049'}.octicon-keyboard:before{content:'\f00d'}.octicon-law:before{content:'\f0d8'}.octicon-light-bulb:before{content:'\f000'}.octicoLine truncated
|
@font-face{font-family:octicons;src:url(../fonts/octicons.eot?#iefix&v=345f8bad9c5003db196d08f05e7f030fd2a32ff6)format('embedded-opentype'),url(../fonts/octicons.woff?v=345f8bad9c5003db196d08f05e7f030fd2a32ff6)format('woff'),url(../fonts/octicons.ttf?v=345f8bad9c5003db196d08f05e7f030fd2a32ff6)format('truetype'),url(../fonts/octicons.svg?v=345f8bad9c5003db196d08f05e7f030fd2a32ff6#octicons)format('svg');font-weight:400;font-style:normal}.mega-octicon,.octicon{font:normal normal normal 16px/1 octicons;display:inline-block;text-decoration:none;text-rendering:auto;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.mega-octicon{font-size:32px}.octicon-alert:before{content:'\f02d'}.octicon-alignment-align:before{content:'\f08a'}.octicon-alignment-aligned-to:before{content:'\f08e'}.octicon-alignment-unalign:before{content:'\f08b'}.octicon-arrow-down:before{content:'\f03f'}.octicon-arrow-left:before{content:'\f040'}.octicon-arrow-right:before{content:'\f03e'}.octicon-arrow-small-down:before{content:'\f0a0'}.octicon-arrow-small-left:before{content:'\f0a1'}.octicon-arrow-small-right:before{content:'\f071'}.octicon-arrow-small-up:before{content:'\f09f'}.octicon-arrow-up:before{content:'\f03d'}.octicon-beer:before{content:'\f069'}.octicon-book:before{content:'\f007'}.octicon-bookmark:before{content:'\f07b'}.octicon-briefcase:before{content:'\f0d3'}.octicon-broadcast:before{content:'\f048'}.octicon-browser:before{content:'\f0c5'}.octicon-bug:before{content:'\f091'}.octicon-calendar:before{content:'\f068'}.octicon-check:before{content:'\f03a'}.octicon-checklist:before{content:'\f076'}.octicon-chevron-down:before{content:'\f0a3'}.octicon-chevron-left:before{content:'\f0a4'}.octicon-chevron-right:before{content:'\f078'}.octicon-chevron-up:before{content:'\f0a2'}.octicon-circle-slash:before{content:'\f084'}.octicon-circuit-board:before{content:'\f0d6'}.octicon-clippy:before{content:'\f035'}.octicon-clock:before{content:'\f046'}.octicon-cloud-download:before{content:'\f00b'}.octicon-cloud-upload:before{content:'\f00c'}.octicon-code:before{content:'\f05f'}.octicon-color-mode:before{content:'\f065'}.octicon-comment-add:before,.octicon-comment:before{content:'\f02b'}.octicon-comment-discussion:before{content:'\f04f'}.octicon-credit-card:before{content:'\f045'}.octicon-dash:before{content:'\f0ca'}.octicon-dashboard:before{content:'\f07d'}.octicon-database:before{content:'\f096'}.octicon-device-camera:before{content:'\f056'}.octicon-device-camera-video:before{content:'\f057'}.octicon-device-desktop:before{content:'\f27c'}.octicon-device-mobile:before{content:'\f038'}.octicon-diff:before{content:'\f04d'}.octicon-diff-added:before{content:'\f06b'}.octicon-diff-ignored:before{content:'\f099'}.octicon-diff-modified:before{content:'\f06d'}.octicon-diff-removed:before{content:'\f06c'}.octicon-diff-renamed:before{content:'\f06e'}.octicon-ellipsis:before{content:'\f09a'}.octicon-eye-unwatch:before,.octicon-eye-watch:before,.octicon-eye:before{content:'\f04e'}.octicon-file-binary:before{content:'\f094'}.octicon-file-code:before{content:'\f010'}.octicon-file-directory:before{content:'\f016'}.octicon-file-media:before{content:'\f012'}.octicon-file-pdf:before{content:'\f014'}.octicon-file-submodule:before{content:'\f017'}.octicon-file-symlink-directory:before{content:'\f0b1'}.octicon-file-symlink-file:before{content:'\f0b0'}.octicon-file-text:before{content:'\f011'}.octicon-file-zip:before{content:'\f013'}.octicon-flame:before{content:'\f0d2'}.octicon-fold:before{content:'\f0cc'}.octicon-gear:before{content:'\f02f'}.octicon-gift:before{content:'\f042'}.octicon-gist:before{content:'\f00e'}.octicon-gist-secret:before{content:'\f08c'}.octicon-git-branch-create:before,.octicon-git-branch-delete:before,.octicon-git-branch:before{content:'\f020'}.octicon-git-commit:before{content:'\f01f'}.octicon-git-compare:before{content:'\f0ac'}.octicon-git-merge:before{content:'\f023'}.octicon-git-pull-request-abandoned:before,.octicon-git-pull-request:before{content:'\f009'}.octicon-globe:before{content:'\f0b6'}.octicon-graph:before{content:'\f043'}.octicon-heart:before{content:'\2665'}.octicon-history:before{content:'\f07e'}.octicon-home:before{content:'\f08d'}.octicon-horizontal-rule:before{content:'\f070'}.octicon-hourglass:before{content:'\f09e'}.octicon-hubot:before{content:'\f09d'}.octicon-inbox:before{content:'\f0cf'}.octicon-info:before{content:'\f059'}.octicon-issue-closed:before{content:'\f028'}.octicon-issue-opened:before{content:'\f026'}.octicon-issue-reopened:before{content:'\f027'}.octicon-jersey:before{content:'\f019'}.octicon-jump-down:before{content:'\f072'}.octicon-jump-left:before{content:'\f0a5'}.octicon-jump-right:before{content:'\f0a6'}.octicon-jump-up:before{content:'\f073'}.octicon-key:before{content:'\f049'}.octicon-keyboard:before{content:'\f00d'}.octicon-law:before{content:'\f0d8'}.octicon-light-bulb:before{content:'\f000'}.octicoLine truncated
|
||||||
@@ -93,6 +93,17 @@ function initRepository() {
|
|||||||
$('#add-deploy-key-panel').show();
|
$('#add-deploy-key-panel').show();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Pull request
|
||||||
|
if ($('.repository.compare.pull').length > 0) {
|
||||||
|
$('.choose.branch .dropdown').dropdown({
|
||||||
|
action: 'hide',
|
||||||
|
fullTextSearch: true,
|
||||||
|
onNoResults: function () {
|
||||||
|
$('.choose.branch .dropdown .active').addClass('selected');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
$(document).ready(function () {
|
$(document).ready(function () {
|
||||||
|
|||||||
@@ -223,6 +223,46 @@
|
|||||||
padding-left: 20px!important;
|
padding-left: 20px!important;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
&.compare.pull {
|
||||||
|
.choose.branch {
|
||||||
|
.octicon {
|
||||||
|
padding-right: 10px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.filter.dropdown .menu {
|
||||||
|
margin-top: 1px!important;
|
||||||
|
.items {
|
||||||
|
max-height: 300px;
|
||||||
|
overflow-y: auto;
|
||||||
|
.item {
|
||||||
|
position: relative;
|
||||||
|
cursor: pointer;
|
||||||
|
display: block;
|
||||||
|
border: none;
|
||||||
|
height: auto;
|
||||||
|
border-top: none;
|
||||||
|
line-height: 1em;
|
||||||
|
color: rgba(0,0,0,.8);
|
||||||
|
padding: .71428571em 1.14285714em!important;
|
||||||
|
font-size: 1rem;
|
||||||
|
text-transform: none;
|
||||||
|
font-weight: 400;
|
||||||
|
box-shadow: none;
|
||||||
|
-webkit-touch-callout: none;
|
||||||
|
&.active {
|
||||||
|
font-weight: 700;
|
||||||
|
}
|
||||||
|
&:hover {
|
||||||
|
background: rgba(0,0,0,.05);
|
||||||
|
color: rgba(0,0,0,.8);
|
||||||
|
z-index: 13;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.settings .key.list {
|
.settings .key.list {
|
||||||
|
|||||||
@@ -139,9 +139,9 @@ func EditUser(ctx *middleware.Context) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
u, err := models.GetUserById(uid)
|
u, err := models.GetUserByID(uid)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ctx.Handle(500, "GetUserById", err)
|
ctx.Handle(500, "GetUserByID", err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -166,7 +166,7 @@ func EditUserPost(ctx *middleware.Context, form auth.AdminEditUserForm) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
u, err := models.GetUserById(uid)
|
u, err := models.GetUserByID(uid)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ctx.Handle(500, "GetUserById", err)
|
ctx.Handle(500, "GetUserById", err)
|
||||||
return
|
return
|
||||||
@@ -219,9 +219,9 @@ func DeleteUser(ctx *middleware.Context) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
u, err := models.GetUserById(uid)
|
u, err := models.GetUserByID(uid)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ctx.Handle(500, "GetUserById", err)
|
ctx.Handle(500, "GetUserByID", err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ func ToApiRepository(owner *models.User, repo *models.Repository, permission api
|
|||||||
log.Error(4, "CloneLink: %v", err)
|
log.Error(4, "CloneLink: %v", err)
|
||||||
}
|
}
|
||||||
return &api.Repository{
|
return &api.Repository{
|
||||||
Id: repo.Id,
|
Id: repo.ID,
|
||||||
Owner: *ToApiUser(owner),
|
Owner: *ToApiUser(owner),
|
||||||
FullName: owner.Name + "/" + repo.Name,
|
FullName: owner.Name + "/" + repo.Name,
|
||||||
Private: repo.IsPrivate,
|
Private: repo.IsPrivate,
|
||||||
@@ -55,7 +55,7 @@ func SearchRepos(ctx *middleware.Context) {
|
|||||||
if ctx.User.Id == opt.Uid {
|
if ctx.User.Id == opt.Uid {
|
||||||
opt.Private = true
|
opt.Private = true
|
||||||
} else {
|
} else {
|
||||||
u, err := models.GetUserById(opt.Uid)
|
u, err := models.GetUserByID(opt.Uid)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ctx.JSON(500, map[string]interface{}{
|
ctx.JSON(500, map[string]interface{}{
|
||||||
"ok": false,
|
"ok": false,
|
||||||
@@ -89,7 +89,7 @@ func SearchRepos(ctx *middleware.Context) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
results[i] = &api.Repository{
|
results[i] = &api.Repository{
|
||||||
Id: repos[i].Id,
|
Id: repos[i].ID,
|
||||||
FullName: path.Join(repos[i].Owner.Name, repos[i].Name),
|
FullName: path.Join(repos[i].Owner.Name, repos[i].Name),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -111,7 +111,7 @@ func createRepo(ctx *middleware.Context, owner *models.User, opt api.CreateRepoO
|
|||||||
} else {
|
} else {
|
||||||
log.Error(4, "CreateRepository: %v", err)
|
log.Error(4, "CreateRepository: %v", err)
|
||||||
if repo != nil {
|
if repo != nil {
|
||||||
if err = models.DeleteRepository(ctx.User.Id, repo.Id, ctx.User.Name); err != nil {
|
if err = models.DeleteRepository(ctx.User.Id, repo.ID, ctx.User.Name); err != nil {
|
||||||
log.Error(4, "DeleteRepository: %v", err)
|
log.Error(4, "DeleteRepository: %v", err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -172,7 +172,7 @@ func MigrateRepo(ctx *middleware.Context, form auth.MigrateRepoForm) {
|
|||||||
ctxUser := u
|
ctxUser := u
|
||||||
// Not equal means current user is an organization.
|
// Not equal means current user is an organization.
|
||||||
if form.Uid != u.Id {
|
if form.Uid != u.Id {
|
||||||
org, err := models.GetUserById(form.Uid)
|
org, err := models.GetUserByID(form.Uid)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if models.IsErrUserNotExist(err) {
|
if models.IsErrUserNotExist(err) {
|
||||||
ctx.HandleAPI(422, err)
|
ctx.HandleAPI(422, err)
|
||||||
@@ -219,7 +219,7 @@ func MigrateRepo(ctx *middleware.Context, form auth.MigrateRepoForm) {
|
|||||||
repo, err := models.MigrateRepository(ctxUser, form.RepoName, form.Description, form.Private, form.Mirror, remoteAddr)
|
repo, err := models.MigrateRepository(ctxUser, form.RepoName, form.Description, form.Private, form.Mirror, remoteAddr)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if repo != nil {
|
if repo != nil {
|
||||||
if errDelete := models.DeleteRepository(ctxUser.Id, repo.Id, ctxUser.Name); errDelete != nil {
|
if errDelete := models.DeleteRepository(ctxUser.Id, repo.ID, ctxUser.Name); errDelete != nil {
|
||||||
log.Error(4, "DeleteRepository: %v", errDelete)
|
log.Error(4, "DeleteRepository: %v", errDelete)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ import (
|
|||||||
// GET /repos/:username/:reponame/hooks
|
// GET /repos/:username/:reponame/hooks
|
||||||
// https://developer.github.com/v3/repos/hooks/#list-hooks
|
// https://developer.github.com/v3/repos/hooks/#list-hooks
|
||||||
func ListRepoHooks(ctx *middleware.Context) {
|
func ListRepoHooks(ctx *middleware.Context) {
|
||||||
hooks, err := models.GetWebhooksByRepoId(ctx.Repo.Repository.Id)
|
hooks, err := models.GetWebhooksByRepoId(ctx.Repo.Repository.ID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ctx.JSON(500, &base.ApiJsonErr{"GetWebhooksByRepoId: " + err.Error(), base.DOC_URL})
|
ctx.JSON(500, &base.ApiJsonErr{"GetWebhooksByRepoId: " + err.Error(), base.DOC_URL})
|
||||||
return
|
return
|
||||||
@@ -67,7 +67,7 @@ func CreateRepoHook(ctx *middleware.Context, form api.CreateHookOption) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
w := &models.Webhook{
|
w := &models.Webhook{
|
||||||
RepoId: ctx.Repo.Repository.Id,
|
RepoId: ctx.Repo.Repository.ID,
|
||||||
Url: form.Config["url"],
|
Url: form.Config["url"],
|
||||||
ContentType: models.ToHookContentType(form.Config["content_type"]),
|
ContentType: models.ToHookContentType(form.Config["content_type"]),
|
||||||
Secret: form.Config["secret"],
|
Secret: form.Config["secret"],
|
||||||
|
|||||||
+1
-1
@@ -57,7 +57,7 @@ func Explore(ctx *middleware.Context) {
|
|||||||
}
|
}
|
||||||
for _, repo := range repos {
|
for _, repo := range repos {
|
||||||
if err = repo.GetOwner(); err != nil {
|
if err = repo.GetOwner(); err != nil {
|
||||||
ctx.Handle(500, "GetOwner", fmt.Errorf("%d: %v", repo.Id, err))
|
ctx.Handle(500, "GetOwner", fmt.Errorf("%d: %v", repo.ID, err))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -122,7 +122,7 @@ func Http(ctx *middleware.Context) {
|
|||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
authUser, err = models.GetUserById(token.Uid)
|
authUser, err = models.GetUserByID(token.Uid)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ctx.Handle(500, "GetUserById", err)
|
ctx.Handle(500, "GetUserById", err)
|
||||||
return
|
return
|
||||||
@@ -191,7 +191,7 @@ func Http(ctx *middleware.Context) {
|
|||||||
|
|
||||||
// FIXME: handle error.
|
// FIXME: handle error.
|
||||||
if err = models.Update(refName, oldCommitId, newCommitId, authUsername, username, reponame, authUser.Id); err == nil {
|
if err = models.Update(refName, oldCommitId, newCommitId, authUsername, username, reponame, authUser.Id); err == nil {
|
||||||
models.HookQueue.AddRepoID(repo.Id)
|
models.HookQueue.AddRepoID(repo.ID)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+28
-28
@@ -44,7 +44,7 @@ var (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func RetrieveLabels(ctx *middleware.Context) {
|
func RetrieveLabels(ctx *middleware.Context) {
|
||||||
labels, err := models.GetLabels(ctx.Repo.Repository.Id)
|
labels, err := models.GetLabels(ctx.Repo.Repository.ID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ctx.Handle(500, "RetrieveLabels.GetLabels: %v", err)
|
ctx.Handle(500, "RetrieveLabels.GetLabels: %v", err)
|
||||||
return
|
return
|
||||||
@@ -95,7 +95,7 @@ func Issues(ctx *middleware.Context) {
|
|||||||
selectLabels := ctx.Query("labels")
|
selectLabels := ctx.Query("labels")
|
||||||
milestoneID := ctx.QueryInt64("milestone")
|
milestoneID := ctx.QueryInt64("milestone")
|
||||||
isShowClosed := ctx.Query("state") == "closed"
|
isShowClosed := ctx.Query("state") == "closed"
|
||||||
issueStats := models.GetIssueStats(repo.Id, uid, com.StrTo(selectLabels).MustInt64(), milestoneID, isShowClosed, filterMode)
|
issueStats := models.GetIssueStats(repo.ID, uid, com.StrTo(selectLabels).MustInt64(), milestoneID, isShowClosed, filterMode)
|
||||||
|
|
||||||
page := ctx.QueryInt("page")
|
page := ctx.QueryInt("page")
|
||||||
if page <= 1 {
|
if page <= 1 {
|
||||||
@@ -111,7 +111,7 @@ func Issues(ctx *middleware.Context) {
|
|||||||
ctx.Data["Page"] = paginater.New(total, setting.IssuePagingNum, page, 5)
|
ctx.Data["Page"] = paginater.New(total, setting.IssuePagingNum, page, 5)
|
||||||
|
|
||||||
// Get issues.
|
// Get issues.
|
||||||
issues, err := models.Issues(uid, assigneeID, repo.Id, posterID, milestoneID,
|
issues, err := models.Issues(uid, assigneeID, repo.ID, posterID, milestoneID,
|
||||||
page, isShowClosed, filterMode == models.FM_MENTION, selectLabels, ctx.Query("sortType"))
|
page, isShowClosed, filterMode == models.FM_MENTION, selectLabels, ctx.Query("sortType"))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ctx.Handle(500, "GetIssues: %v", err)
|
ctx.Handle(500, "GetIssues: %v", err)
|
||||||
@@ -119,7 +119,7 @@ func Issues(ctx *middleware.Context) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Get issue-user pairs.
|
// Get issue-user pairs.
|
||||||
pairs, err := models.GetIssueUserPairs(repo.Id, posterID, isShowClosed)
|
pairs, err := models.GetIssueUserPairs(repo.ID, posterID, isShowClosed)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ctx.Handle(500, "GetIssueUserPairs: %v", err)
|
ctx.Handle(500, "GetIssueUserPairs: %v", err)
|
||||||
return
|
return
|
||||||
@@ -153,7 +153,7 @@ func Issues(ctx *middleware.Context) {
|
|||||||
ctx.Data["Issues"] = issues
|
ctx.Data["Issues"] = issues
|
||||||
|
|
||||||
// Get milestones.
|
// Get milestones.
|
||||||
miles, err := models.GetAllRepoMilestones(repo.Id)
|
miles, err := models.GetAllRepoMilestones(repo.ID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ctx.Handle(500, "GetAllRepoMilestones: %v", err)
|
ctx.Handle(500, "GetAllRepoMilestones: %v", err)
|
||||||
return
|
return
|
||||||
@@ -185,12 +185,12 @@ func CreateIssue(ctx *middleware.Context) {
|
|||||||
err error
|
err error
|
||||||
)
|
)
|
||||||
// Get all milestones.
|
// Get all milestones.
|
||||||
ctx.Data["OpenMilestones"], err = models.GetMilestones(repo.Id, -1, false)
|
ctx.Data["OpenMilestones"], err = models.GetMilestones(repo.ID, -1, false)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ctx.Handle(500, "GetMilestones.1: %v", err)
|
ctx.Handle(500, "GetMilestones.1: %v", err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
ctx.Data["ClosedMilestones"], err = models.GetMilestones(repo.Id, -1, true)
|
ctx.Data["ClosedMilestones"], err = models.GetMilestones(repo.ID, -1, true)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ctx.Handle(500, "GetMilestones.2: %v", err)
|
ctx.Handle(500, "GetMilestones.2: %v", err)
|
||||||
return
|
return
|
||||||
@@ -229,12 +229,12 @@ func CreateIssuePost(ctx *middleware.Context, form auth.CreateIssueForm) {
|
|||||||
|
|
||||||
var err error
|
var err error
|
||||||
// Get all milestones.
|
// Get all milestones.
|
||||||
_, err = models.GetMilestones(ctx.Repo.Repository.Id, -1, false)
|
_, err = models.GetMilestones(ctx.Repo.Repository.ID, -1, false)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
send(500, nil, err)
|
send(500, nil, err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
_, err = models.GetMilestones(ctx.Repo.Repository.Id, -1, true)
|
_, err = models.GetMilestones(ctx.Repo.Repository.ID, -1, true)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
send(500, nil, err)
|
send(500, nil, err)
|
||||||
return
|
return
|
||||||
@@ -256,7 +256,7 @@ func CreateIssuePost(ctx *middleware.Context, form auth.CreateIssueForm) {
|
|||||||
form.AssigneeId = 0
|
form.AssigneeId = 0
|
||||||
}
|
}
|
||||||
issue := &models.Issue{
|
issue := &models.Issue{
|
||||||
RepoID: ctx.Repo.Repository.Id,
|
RepoID: ctx.Repo.Repository.ID,
|
||||||
Index: int64(ctx.Repo.Repository.NumIssues) + 1,
|
Index: int64(ctx.Repo.Repository.NumIssues) + 1,
|
||||||
Name: form.IssueName,
|
Name: form.IssueName,
|
||||||
PosterID: ctx.User.Id,
|
PosterID: ctx.User.Id,
|
||||||
@@ -297,7 +297,7 @@ func CreateIssuePost(ctx *middleware.Context, form auth.CreateIssueForm) {
|
|||||||
ActEmail: ctx.User.Email,
|
ActEmail: ctx.User.Email,
|
||||||
OpType: models.CREATE_ISSUE,
|
OpType: models.CREATE_ISSUE,
|
||||||
Content: fmt.Sprintf("%d|%s", issue.Index, issue.Name),
|
Content: fmt.Sprintf("%d|%s", issue.Index, issue.Name),
|
||||||
RepoID: ctx.Repo.Repository.Id,
|
RepoID: ctx.Repo.Repository.ID,
|
||||||
RepoUserName: ctx.Repo.Owner.Name,
|
RepoUserName: ctx.Repo.Owner.Name,
|
||||||
RepoName: ctx.Repo.Repository.Name,
|
RepoName: ctx.Repo.Repository.Name,
|
||||||
RefName: ctx.Repo.BranchName,
|
RefName: ctx.Repo.BranchName,
|
||||||
@@ -332,7 +332,7 @@ func CreateIssuePost(ctx *middleware.Context, form auth.CreateIssueForm) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
log.Trace("%d Issue created: %d", ctx.Repo.Repository.Id, issue.ID)
|
log.Trace("%d Issue created: %d", ctx.Repo.Repository.ID, issue.ID)
|
||||||
|
|
||||||
send(200, fmt.Sprintf("%s/%s/%s/issues/%d", setting.AppSubUrl, ctx.Params(":username"), ctx.Params(":reponame"), issue.Index), nil)
|
send(200, fmt.Sprintf("%s/%s/%s/issues/%d", setting.AppSubUrl, ctx.Params(":username"), ctx.Params(":reponame"), issue.Index), nil)
|
||||||
}
|
}
|
||||||
@@ -357,7 +357,7 @@ func ViewIssue(ctx *middleware.Context) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
issue, err := models.GetIssueByIndex(ctx.Repo.Repository.Id, idx)
|
issue, err := models.GetIssueByIndex(ctx.Repo.Repository.ID, idx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if err == models.ErrIssueNotExist {
|
if err == models.ErrIssueNotExist {
|
||||||
ctx.Handle(404, "GetIssueByIndex", err)
|
ctx.Handle(404, "GetIssueByIndex", err)
|
||||||
@@ -372,7 +372,7 @@ func ViewIssue(ctx *middleware.Context) {
|
|||||||
ctx.Handle(500, "GetLabels", err)
|
ctx.Handle(500, "GetLabels", err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
labels, err := models.GetLabels(ctx.Repo.Repository.Id)
|
labels, err := models.GetLabels(ctx.Repo.Repository.ID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ctx.Handle(500, "GetLabels.2", err)
|
ctx.Handle(500, "GetLabels.2", err)
|
||||||
return
|
return
|
||||||
@@ -394,12 +394,12 @@ func ViewIssue(ctx *middleware.Context) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Get all milestones.
|
// Get all milestones.
|
||||||
ctx.Data["OpenMilestones"], err = models.GetMilestones(ctx.Repo.Repository.Id, -1, false)
|
ctx.Data["OpenMilestones"], err = models.GetMilestones(ctx.Repo.Repository.ID, -1, false)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ctx.Handle(500, "GetMilestones.1: %v", err)
|
ctx.Handle(500, "GetMilestones.1: %v", err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
ctx.Data["ClosedMilestones"], err = models.GetMilestones(ctx.Repo.Repository.Id, -1, true)
|
ctx.Data["ClosedMilestones"], err = models.GetMilestones(ctx.Repo.Repository.ID, -1, true)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ctx.Handle(500, "GetMilestones.2: %v", err)
|
ctx.Handle(500, "GetMilestones.2: %v", err)
|
||||||
return
|
return
|
||||||
@@ -439,7 +439,7 @@ func ViewIssue(ctx *middleware.Context) {
|
|||||||
|
|
||||||
// Get posters.
|
// Get posters.
|
||||||
for i := range comments {
|
for i := range comments {
|
||||||
u, err := models.GetUserById(comments[i].PosterId)
|
u, err := models.GetUserByID(comments[i].PosterId)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ctx.Handle(500, "GetUserById.2: %v", err)
|
ctx.Handle(500, "GetUserById.2: %v", err)
|
||||||
return
|
return
|
||||||
@@ -469,7 +469,7 @@ func UpdateIssue(ctx *middleware.Context, form auth.CreateIssueForm) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
issue, err := models.GetIssueByIndex(ctx.Repo.Repository.Id, idx)
|
issue, err := models.GetIssueByIndex(ctx.Repo.Repository.ID, idx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if err == models.ErrIssueNotExist {
|
if err == models.ErrIssueNotExist {
|
||||||
ctx.Handle(404, "issue.UpdateIssue", err)
|
ctx.Handle(404, "issue.UpdateIssue", err)
|
||||||
@@ -517,7 +517,7 @@ func UpdateIssueLabel(ctx *middleware.Context) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
issue, err := models.GetIssueByIndex(ctx.Repo.Repository.Id, idx)
|
issue, err := models.GetIssueByIndex(ctx.Repo.Repository.ID, idx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if err == models.ErrIssueNotExist {
|
if err == models.ErrIssueNotExist {
|
||||||
ctx.Handle(404, "issue.UpdateIssueLabel(GetIssueByIndex)", err)
|
ctx.Handle(404, "issue.UpdateIssueLabel(GetIssueByIndex)", err)
|
||||||
@@ -762,7 +762,7 @@ func Comment(ctx *middleware.Context) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
issue, err := models.GetIssueByIndex(ctx.Repo.Repository.Id, index)
|
issue, err := models.GetIssueByIndex(ctx.Repo.Repository.ID, index)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if err == models.ErrIssueNotExist {
|
if err == models.ErrIssueNotExist {
|
||||||
send(404, nil, err)
|
send(404, nil, err)
|
||||||
@@ -820,7 +820,7 @@ func Comment(ctx *middleware.Context) {
|
|||||||
cmtType = models.COMMENT_TYPE_REOPEN
|
cmtType = models.COMMENT_TYPE_REOPEN
|
||||||
}
|
}
|
||||||
|
|
||||||
if _, err = models.CreateComment(ctx.User.Id, ctx.Repo.Repository.Id, issue.ID, 0, 0, cmtType, "", nil); err != nil {
|
if _, err = models.CreateComment(ctx.User.Id, ctx.Repo.Repository.ID, issue.ID, 0, 0, cmtType, "", nil); err != nil {
|
||||||
send(200, nil, err)
|
send(200, nil, err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@@ -836,7 +836,7 @@ func Comment(ctx *middleware.Context) {
|
|||||||
if len(content) > 0 || len(ctx.Req.MultipartForm.File["attachments"]) > 0 {
|
if len(content) > 0 || len(ctx.Req.MultipartForm.File["attachments"]) > 0 {
|
||||||
switch ctx.Params(":action") {
|
switch ctx.Params(":action") {
|
||||||
case "new":
|
case "new":
|
||||||
if comment, err = models.CreateComment(ctx.User.Id, ctx.Repo.Repository.Id, issue.ID, 0, 0, models.COMMENT_TYPE_COMMENT, content, nil); err != nil {
|
if comment, err = models.CreateComment(ctx.User.Id, ctx.Repo.Repository.ID, issue.ID, 0, 0, models.COMMENT_TYPE_COMMENT, content, nil); err != nil {
|
||||||
send(500, nil, err)
|
send(500, nil, err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@@ -872,7 +872,7 @@ func Comment(ctx *middleware.Context) {
|
|||||||
ActEmail: ctx.User.Email,
|
ActEmail: ctx.User.Email,
|
||||||
OpType: models.COMMENT_ISSUE,
|
OpType: models.COMMENT_ISSUE,
|
||||||
Content: fmt.Sprintf("%d|%s", issue.Index, strings.Split(content, "\n")[0]),
|
Content: fmt.Sprintf("%d|%s", issue.Index, strings.Split(content, "\n")[0]),
|
||||||
RepoID: ctx.Repo.Repository.Id,
|
RepoID: ctx.Repo.Repository.ID,
|
||||||
RepoUserName: ctx.Repo.Owner.LowerName,
|
RepoUserName: ctx.Repo.Owner.LowerName,
|
||||||
RepoName: ctx.Repo.Repository.LowerName,
|
RepoName: ctx.Repo.Repository.LowerName,
|
||||||
IsPrivate: ctx.Repo.Repository.IsPrivate,
|
IsPrivate: ctx.Repo.Repository.IsPrivate,
|
||||||
@@ -927,7 +927,7 @@ func NewLabel(ctx *middleware.Context, form auth.CreateLabelForm) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
l := &models.Label{
|
l := &models.Label{
|
||||||
RepoId: ctx.Repo.Repository.Id,
|
RepoId: ctx.Repo.Repository.ID,
|
||||||
Name: form.Title,
|
Name: form.Title,
|
||||||
Color: form.Color,
|
Color: form.Color,
|
||||||
}
|
}
|
||||||
@@ -960,7 +960,7 @@ func UpdateLabel(ctx *middleware.Context, form auth.CreateLabelForm) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func DeleteLabel(ctx *middleware.Context) {
|
func DeleteLabel(ctx *middleware.Context) {
|
||||||
if err := models.DeleteLabel(ctx.Repo.Repository.Id, ctx.QueryInt64("id")); err != nil {
|
if err := models.DeleteLabel(ctx.Repo.Repository.ID, ctx.QueryInt64("id")); err != nil {
|
||||||
ctx.Flash.Error("DeleteLabel: " + err.Error())
|
ctx.Flash.Error("DeleteLabel: " + err.Error())
|
||||||
} else {
|
} else {
|
||||||
ctx.Flash.Success(ctx.Tr("repo.issues.label_deletion_success"))
|
ctx.Flash.Success(ctx.Tr("repo.issues.label_deletion_success"))
|
||||||
@@ -977,7 +977,7 @@ func Milestones(ctx *middleware.Context) {
|
|||||||
ctx.Data["PageIsMilestones"] = true
|
ctx.Data["PageIsMilestones"] = true
|
||||||
|
|
||||||
isShowClosed := ctx.Query("state") == "closed"
|
isShowClosed := ctx.Query("state") == "closed"
|
||||||
openCount, closedCount := models.MilestoneStats(ctx.Repo.Repository.Id)
|
openCount, closedCount := models.MilestoneStats(ctx.Repo.Repository.ID)
|
||||||
ctx.Data["OpenCount"] = openCount
|
ctx.Data["OpenCount"] = openCount
|
||||||
ctx.Data["ClosedCount"] = closedCount
|
ctx.Data["ClosedCount"] = closedCount
|
||||||
|
|
||||||
@@ -994,7 +994,7 @@ func Milestones(ctx *middleware.Context) {
|
|||||||
}
|
}
|
||||||
ctx.Data["Page"] = paginater.New(total, setting.IssuePagingNum, page, 5)
|
ctx.Data["Page"] = paginater.New(total, setting.IssuePagingNum, page, 5)
|
||||||
|
|
||||||
miles, err := models.GetMilestones(ctx.Repo.Repository.Id, page, isShowClosed)
|
miles, err := models.GetMilestones(ctx.Repo.Repository.ID, page, isShowClosed)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ctx.Handle(500, "GetMilestones", err)
|
ctx.Handle(500, "GetMilestones", err)
|
||||||
return
|
return
|
||||||
@@ -1043,7 +1043,7 @@ func NewMilestonePost(ctx *middleware.Context, form auth.CreateMilestoneForm) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if err = models.NewMilestone(&models.Milestone{
|
if err = models.NewMilestone(&models.Milestone{
|
||||||
RepoID: ctx.Repo.Repository.Id,
|
RepoID: ctx.Repo.Repository.ID,
|
||||||
Name: form.Title,
|
Name: form.Title,
|
||||||
Content: form.Content,
|
Content: form.Content,
|
||||||
Deadline: deadline,
|
Deadline: deadline,
|
||||||
|
|||||||
+58
-7
@@ -5,26 +5,31 @@
|
|||||||
package repo
|
package repo
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"fmt"
|
||||||
|
"strings"
|
||||||
|
|
||||||
"github.com/gogits/gogs/models"
|
"github.com/gogits/gogs/models"
|
||||||
"github.com/gogits/gogs/modules/auth"
|
"github.com/gogits/gogs/modules/auth"
|
||||||
"github.com/gogits/gogs/modules/base"
|
"github.com/gogits/gogs/modules/base"
|
||||||
|
"github.com/gogits/gogs/modules/git"
|
||||||
"github.com/gogits/gogs/modules/log"
|
"github.com/gogits/gogs/modules/log"
|
||||||
"github.com/gogits/gogs/modules/middleware"
|
"github.com/gogits/gogs/modules/middleware"
|
||||||
"github.com/gogits/gogs/modules/setting"
|
"github.com/gogits/gogs/modules/setting"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
FORK base.TplName = "repo/pulls/fork"
|
FORK base.TplName = "repo/pulls/fork"
|
||||||
PULLS base.TplName = "repo/pulls"
|
COMPARE_PULL base.TplName = "repo/pulls/compare"
|
||||||
|
PULLS base.TplName = "repo/pulls"
|
||||||
)
|
)
|
||||||
|
|
||||||
func getForkRepository(ctx *middleware.Context) *models.Repository {
|
func getForkRepository(ctx *middleware.Context) *models.Repository {
|
||||||
forkRepo, err := models.GetRepositoryById(ctx.ParamsInt64(":repoid"))
|
forkRepo, err := models.GetRepositoryByID(ctx.ParamsInt64(":repoid"))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if models.IsErrRepoNotExist(err) {
|
if models.IsErrRepoNotExist(err) {
|
||||||
ctx.Handle(404, "GetRepositoryById", nil)
|
ctx.Handle(404, "GetRepositoryByID", nil)
|
||||||
} else {
|
} else {
|
||||||
ctx.Handle(500, "GetRepositoryById", err)
|
ctx.Handle(500, "GetRepositoryByID", err)
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
@@ -78,7 +83,7 @@ func ForkPost(ctx *middleware.Context, form auth.CreateRepoForm) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
repo, has := models.HasForkedRepo(ctxUser.Id, forkRepo.Id)
|
repo, has := models.HasForkedRepo(ctxUser.Id, forkRepo.ID)
|
||||||
if has {
|
if has {
|
||||||
ctx.Redirect(setting.AppSubUrl + "/" + ctxUser.Name + "/" + repo.Name)
|
ctx.Redirect(setting.AppSubUrl + "/" + ctxUser.Name + "/" + repo.Name)
|
||||||
return
|
return
|
||||||
@@ -110,10 +115,56 @@ func ForkPost(ctx *middleware.Context, form auth.CreateRepoForm) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
log.Trace("Repository forked[%d]: %s/%s", forkRepo.Id, ctxUser.Name, repo.Name)
|
log.Trace("Repository forked[%d]: %s/%s", forkRepo.ID, ctxUser.Name, repo.Name)
|
||||||
ctx.Redirect(setting.AppSubUrl + "/" + ctxUser.Name + "/" + repo.Name)
|
ctx.Redirect(setting.AppSubUrl + "/" + ctxUser.Name + "/" + repo.Name)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func CompareAndPullRequest(ctx *middleware.Context) {
|
||||||
|
// Get compare information.
|
||||||
|
infos := strings.Split(ctx.Params("*"), "...")
|
||||||
|
if len(infos) != 2 {
|
||||||
|
ctx.Handle(404, "CompareAndPullRequest", nil)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
baseBranch := infos[0]
|
||||||
|
ctx.Data["BaseBranch"] = baseBranch
|
||||||
|
|
||||||
|
headInfos := strings.Split(infos[1], ":")
|
||||||
|
if len(headInfos) != 2 {
|
||||||
|
ctx.Handle(404, "CompareAndPullRequest", nil)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
headUser := headInfos[0]
|
||||||
|
headBranch := headInfos[1]
|
||||||
|
ctx.Data["HeadBranch"] = headBranch
|
||||||
|
|
||||||
|
// TODO: check if branches are valid.
|
||||||
|
fmt.Println(baseBranch, headUser, headBranch)
|
||||||
|
|
||||||
|
// TODO: add organization support
|
||||||
|
// Check if current user has fork of repository.
|
||||||
|
headRepo, has := models.HasForkedRepo(ctx.User.Id, ctx.Repo.Repository.ID)
|
||||||
|
if !has {
|
||||||
|
ctx.Handle(404, "HasForkedRepo", nil)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
headGitRepo, err := git.OpenRepository(models.RepoPath(ctx.User.Name, headRepo.Name))
|
||||||
|
if err != nil {
|
||||||
|
ctx.Handle(500, "OpenRepository", err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
headBranches, err := headGitRepo.GetBranches()
|
||||||
|
if err != nil {
|
||||||
|
ctx.Handle(500, "GetBranches", err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
ctx.Data["HeadBranches"] = headBranches
|
||||||
|
|
||||||
|
ctx.HTML(200, COMPARE_PULL)
|
||||||
|
}
|
||||||
|
|
||||||
func Pulls(ctx *middleware.Context) {
|
func Pulls(ctx *middleware.Context) {
|
||||||
ctx.Data["IsRepoToolbarPulls"] = true
|
ctx.Data["IsRepoToolbarPulls"] = true
|
||||||
ctx.HTML(200, PULLS)
|
ctx.HTML(200, PULLS)
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ func Releases(ctx *middleware.Context) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
rels, err := models.GetReleasesByRepoId(ctx.Repo.Repository.Id)
|
rels, err := models.GetReleasesByRepoId(ctx.Repo.Repository.ID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ctx.Handle(500, "GetReleasesByRepoId", err)
|
ctx.Handle(500, "GetReleasesByRepoId", err)
|
||||||
return
|
return
|
||||||
@@ -45,7 +45,7 @@ func Releases(ctx *middleware.Context) {
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
if rel.TagName == rawTag {
|
if rel.TagName == rawTag {
|
||||||
rel.Publisher, err = models.GetUserById(rel.PublisherId)
|
rel.Publisher, err = models.GetUserByID(rel.PublisherId)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ctx.Handle(500, "GetUserById", err)
|
ctx.Handle(500, "GetUserById", err)
|
||||||
return
|
return
|
||||||
@@ -105,7 +105,7 @@ func Releases(ctx *middleware.Context) {
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
rel.Publisher, err = models.GetUserById(rel.PublisherId)
|
rel.Publisher, err = models.GetUserByID(rel.PublisherId)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ctx.Handle(500, "GetUserById", err)
|
ctx.Handle(500, "GetUserById", err)
|
||||||
return
|
return
|
||||||
@@ -185,7 +185,7 @@ func NewReleasePost(ctx *middleware.Context, form auth.NewReleaseForm) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
rel := &models.Release{
|
rel := &models.Release{
|
||||||
RepoId: ctx.Repo.Repository.Id,
|
RepoId: ctx.Repo.Repository.ID,
|
||||||
PublisherId: ctx.User.Id,
|
PublisherId: ctx.User.Id,
|
||||||
Title: form.Title,
|
Title: form.Title,
|
||||||
TagName: form.TagName,
|
TagName: form.TagName,
|
||||||
@@ -217,7 +217,7 @@ func EditRelease(ctx *middleware.Context) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
tagName := ctx.Params(":tagname")
|
tagName := ctx.Params(":tagname")
|
||||||
rel, err := models.GetRelease(ctx.Repo.Repository.Id, tagName)
|
rel, err := models.GetRelease(ctx.Repo.Repository.ID, tagName)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if err == models.ErrReleaseNotExist {
|
if err == models.ErrReleaseNotExist {
|
||||||
ctx.Handle(404, "GetRelease", err)
|
ctx.Handle(404, "GetRelease", err)
|
||||||
@@ -240,7 +240,7 @@ func EditReleasePost(ctx *middleware.Context, form auth.EditReleaseForm) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
tagName := ctx.Params(":tagname")
|
tagName := ctx.Params(":tagname")
|
||||||
rel, err := models.GetRelease(ctx.Repo.Repository.Id, tagName)
|
rel, err := models.GetRelease(ctx.Repo.Repository.ID, tagName)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if err == models.ErrReleaseNotExist {
|
if err == models.ErrReleaseNotExist {
|
||||||
ctx.Handle(404, "GetRelease", err)
|
ctx.Handle(404, "GetRelease", err)
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ func checkContextUser(ctx *middleware.Context, uid int64) *models.User {
|
|||||||
return ctx.User
|
return ctx.User
|
||||||
}
|
}
|
||||||
|
|
||||||
org, err := models.GetUserById(uid)
|
org, err := models.GetUserByID(uid)
|
||||||
if models.IsErrUserNotExist(err) {
|
if models.IsErrUserNotExist(err) {
|
||||||
return ctx.User
|
return ctx.User
|
||||||
}
|
}
|
||||||
@@ -112,7 +112,7 @@ func CreatePost(ctx *middleware.Context, form auth.CreateRepoForm) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if repo != nil {
|
if repo != nil {
|
||||||
if errDelete := models.DeleteRepository(ctxUser.Id, repo.Id, ctxUser.Name); errDelete != nil {
|
if errDelete := models.DeleteRepository(ctxUser.Id, repo.ID, ctxUser.Name); errDelete != nil {
|
||||||
log.Error(4, "DeleteRepository: %v", errDelete)
|
log.Error(4, "DeleteRepository: %v", errDelete)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -209,7 +209,7 @@ func MigratePost(ctx *middleware.Context, form auth.MigrateRepoForm) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if repo != nil {
|
if repo != nil {
|
||||||
if errDelete := models.DeleteRepository(ctxUser.Id, repo.Id, ctxUser.Name); errDelete != nil {
|
if errDelete := models.DeleteRepository(ctxUser.Id, repo.ID, ctxUser.Name); errDelete != nil {
|
||||||
log.Error(4, "DeleteRepository: %v", errDelete)
|
log.Error(4, "DeleteRepository: %v", errDelete)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -239,13 +239,13 @@ func Action(ctx *middleware.Context) {
|
|||||||
var err error
|
var err error
|
||||||
switch ctx.Params(":action") {
|
switch ctx.Params(":action") {
|
||||||
case "watch":
|
case "watch":
|
||||||
err = models.WatchRepo(ctx.User.Id, ctx.Repo.Repository.Id, true)
|
err = models.WatchRepo(ctx.User.Id, ctx.Repo.Repository.ID, true)
|
||||||
case "unwatch":
|
case "unwatch":
|
||||||
err = models.WatchRepo(ctx.User.Id, ctx.Repo.Repository.Id, false)
|
err = models.WatchRepo(ctx.User.Id, ctx.Repo.Repository.ID, false)
|
||||||
case "star":
|
case "star":
|
||||||
err = models.StarRepo(ctx.User.Id, ctx.Repo.Repository.Id, true)
|
err = models.StarRepo(ctx.User.Id, ctx.Repo.Repository.ID, true)
|
||||||
case "unstar":
|
case "unstar":
|
||||||
err = models.StarRepo(ctx.User.Id, ctx.Repo.Repository.Id, false)
|
err = models.StarRepo(ctx.User.Id, ctx.Repo.Repository.ID, false)
|
||||||
case "desc":
|
case "desc":
|
||||||
if !ctx.Repo.IsOwner() {
|
if !ctx.Repo.IsOwner() {
|
||||||
ctx.Error(404)
|
ctx.Error(404)
|
||||||
|
|||||||
@@ -160,7 +160,7 @@ func SettingsPost(ctx *middleware.Context, form auth.RepoSettingForm) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := models.DeleteRepository(ctx.Repo.Owner.Id, ctx.Repo.Repository.Id, ctx.Repo.Owner.Name); err != nil {
|
if err := models.DeleteRepository(ctx.Repo.Owner.Id, ctx.Repo.Repository.ID, ctx.Repo.Owner.Name); err != nil {
|
||||||
ctx.Handle(500, "DeleteRepository", err)
|
ctx.Handle(500, "DeleteRepository", err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@@ -262,7 +262,7 @@ func Webhooks(ctx *middleware.Context) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
ws, err := models.GetWebhooksByRepoId(ctx.Repo.Repository.Id)
|
ws, err := models.GetWebhooksByRepoId(ctx.Repo.Repository.ID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ctx.Handle(500, "GetWebhooksByRepoId", err)
|
ctx.Handle(500, "GetWebhooksByRepoId", err)
|
||||||
return
|
return
|
||||||
@@ -569,7 +569,7 @@ func getOrgRepoCtx(ctx *middleware.Context) (*OrgRepoCtx, error) {
|
|||||||
if _, ok := ctx.Data["RepoLink"]; ok {
|
if _, ok := ctx.Data["RepoLink"]; ok {
|
||||||
return &OrgRepoCtx{
|
return &OrgRepoCtx{
|
||||||
OrgId: int64(0),
|
OrgId: int64(0),
|
||||||
RepoId: ctx.Repo.Repository.Id,
|
RepoId: ctx.Repo.Repository.ID,
|
||||||
Link: ctx.Repo.RepoLink,
|
Link: ctx.Repo.RepoLink,
|
||||||
NewTemplate: HOOK_NEW,
|
NewTemplate: HOOK_NEW,
|
||||||
}, nil
|
}, nil
|
||||||
@@ -605,7 +605,7 @@ func TriggerHook(ctx *middleware.Context) {
|
|||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
models.HookQueue.AddRepoID(repo.Id)
|
models.HookQueue.AddRepoID(repo.ID)
|
||||||
}
|
}
|
||||||
|
|
||||||
func GitHooks(ctx *middleware.Context) {
|
func GitHooks(ctx *middleware.Context) {
|
||||||
@@ -663,7 +663,7 @@ func SettingsDeployKeys(ctx *middleware.Context) {
|
|||||||
ctx.Data["Title"] = ctx.Tr("repo.settings")
|
ctx.Data["Title"] = ctx.Tr("repo.settings")
|
||||||
ctx.Data["PageIsSettingsKeys"] = true
|
ctx.Data["PageIsSettingsKeys"] = true
|
||||||
|
|
||||||
keys, err := models.ListDeployKeys(ctx.Repo.Repository.Id)
|
keys, err := models.ListDeployKeys(ctx.Repo.Repository.ID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ctx.Handle(500, "ListDeployKeys", err)
|
ctx.Handle(500, "ListDeployKeys", err)
|
||||||
return
|
return
|
||||||
@@ -695,7 +695,7 @@ func SettingsDeployKeysPost(ctx *middleware.Context, form auth.AddSSHKeyForm) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if err = models.AddDeployKey(ctx.Repo.Repository.Id, form.Title, content); err != nil {
|
if err = models.AddDeployKey(ctx.Repo.Repository.ID, form.Title, content); err != nil {
|
||||||
ctx.Data["HasError"] = true
|
ctx.Data["HasError"] = true
|
||||||
switch {
|
switch {
|
||||||
case models.IsErrKeyAlreadyExist(err):
|
case models.IsErrKeyAlreadyExist(err):
|
||||||
@@ -710,7 +710,7 @@ func SettingsDeployKeysPost(ctx *middleware.Context, form auth.AddSSHKeyForm) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
log.Trace("Deploy key added: %d", ctx.Repo.Repository.Id)
|
log.Trace("Deploy key added: %d", ctx.Repo.Repository.ID)
|
||||||
ctx.Flash.Success(ctx.Tr("repo.settings.add_key_success", form.Title))
|
ctx.Flash.Success(ctx.Tr("repo.settings.add_key_success", form.Title))
|
||||||
ctx.Redirect(ctx.Repo.RepoLink + "/settings/keys")
|
ctx.Redirect(ctx.Repo.RepoLink + "/settings/keys")
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -104,7 +104,7 @@ func Dashboard(ctx *middleware.Context) {
|
|||||||
for _, act := range actions {
|
for _, act := range actions {
|
||||||
if act.IsPrivate {
|
if act.IsPrivate {
|
||||||
// This prevents having to retrieve the repository for each action
|
// This prevents having to retrieve the repository for each action
|
||||||
repo := &models.Repository{Id: act.RepoID, IsPrivate: true}
|
repo := &models.Repository{ID: act.RepoID, IsPrivate: true}
|
||||||
if act.RepoUserName != ctx.User.LowerName {
|
if act.RepoUserName != ctx.User.LowerName {
|
||||||
if has, _ := models.HasAccess(ctx.User, repo, models.ACCESS_MODE_READ); !has {
|
if has, _ := models.HasAccess(ctx.User, repo, models.ACCESS_MODE_READ); !has {
|
||||||
continue
|
continue
|
||||||
@@ -212,7 +212,7 @@ func Profile(ctx *middleware.Context) {
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
// This prevents having to retrieve the repository for each action
|
// This prevents having to retrieve the repository for each action
|
||||||
repo := &models.Repository{Id: act.RepoID, IsPrivate: true}
|
repo := &models.Repository{ID: act.RepoID, IsPrivate: true}
|
||||||
if act.RepoUserName != ctx.User.LowerName {
|
if act.RepoUserName != ctx.User.LowerName {
|
||||||
if has, _ := models.HasAccess(ctx.User, repo, models.ACCESS_MODE_READ); !has {
|
if has, _ := models.HasAccess(ctx.User, repo, models.ACCESS_MODE_READ); !has {
|
||||||
continue
|
continue
|
||||||
@@ -295,21 +295,21 @@ func Issues(ctx *middleware.Context) {
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
repoIds = append(repoIds, repo.Id)
|
repoIds = append(repoIds, repo.ID)
|
||||||
repo.NumOpenIssues = repo.NumIssues - repo.NumClosedIssues
|
repo.NumOpenIssues = repo.NumIssues - repo.NumClosedIssues
|
||||||
issueStats.AllCount += int64(repo.NumOpenIssues)
|
issueStats.AllCount += int64(repo.NumOpenIssues)
|
||||||
|
|
||||||
if isShowClosed {
|
if isShowClosed {
|
||||||
if repo.NumClosedIssues > 0 {
|
if repo.NumClosedIssues > 0 {
|
||||||
if filterMode == models.FM_CREATE {
|
if filterMode == models.FM_CREATE {
|
||||||
repo.NumClosedIssues = int(models.GetIssueCountByPoster(ctx.User.Id, repo.Id, isShowClosed))
|
repo.NumClosedIssues = int(models.GetIssueCountByPoster(ctx.User.Id, repo.ID, isShowClosed))
|
||||||
}
|
}
|
||||||
showRepos = append(showRepos, repo)
|
showRepos = append(showRepos, repo)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if repo.NumOpenIssues > 0 {
|
if repo.NumOpenIssues > 0 {
|
||||||
if filterMode == models.FM_CREATE {
|
if filterMode == models.FM_CREATE {
|
||||||
repo.NumOpenIssues = int(models.GetIssueCountByPoster(ctx.User.Id, repo.Id, isShowClosed))
|
repo.NumOpenIssues = int(models.GetIssueCountByPoster(ctx.User.Id, repo.ID, isShowClosed))
|
||||||
}
|
}
|
||||||
showRepos = append(showRepos, repo)
|
showRepos = append(showRepos, repo)
|
||||||
}
|
}
|
||||||
@@ -350,7 +350,7 @@ func Issues(ctx *middleware.Context) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
issues[i].Repo, err = models.GetRepositoryById(issues[i].RepoID)
|
issues[i].Repo, err = models.GetRepositoryByID(issues[i].RepoID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if models.IsErrRepoNotExist(err) {
|
if models.IsErrRepoNotExist(err) {
|
||||||
log.Warn("GetRepositoryById[%d]: repository not exist", issues[i].RepoID)
|
log.Warn("GetRepositoryById[%d]: repository not exist", issues[i].RepoID)
|
||||||
|
|||||||
@@ -17,7 +17,7 @@
|
|||||||
<table class="table table-striped">
|
<table class="table table-striped">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th>Id</th>
|
<th>ID</th>
|
||||||
<th>{{.i18n.Tr "admin.repos.owner"}}</th>
|
<th>{{.i18n.Tr "admin.repos.owner"}}</th>
|
||||||
<th>{{.i18n.Tr "admin.repos.name"}}</th>
|
<th>{{.i18n.Tr "admin.repos.name"}}</th>
|
||||||
<th>{{.i18n.Tr "admin.repos.private"}}</th>
|
<th>{{.i18n.Tr "admin.repos.private"}}</th>
|
||||||
@@ -30,7 +30,7 @@
|
|||||||
<tbody>
|
<tbody>
|
||||||
{{range .Repos}}
|
{{range .Repos}}
|
||||||
<tr>
|
<tr>
|
||||||
<td>{{.Id}}</td>
|
<td>{{.ID}}</td>
|
||||||
<td><a href="{{AppSubUrl}}/{{.Owner.Name}}">{{.Owner.Name}}</a></td>
|
<td><a href="{{AppSubUrl}}/{{.Owner.Name}}">{{.Owner.Name}}</a></td>
|
||||||
<td><a href="{{AppSubUrl}}/{{.Owner.Name}}/{{.Name}}">{{.Name}}</a></td>
|
<td><a href="{{AppSubUrl}}/{{.Owner.Name}}/{{.Name}}">{{.Name}}</a></td>
|
||||||
<td><i class="fa fa{{if .IsPrivate}}-check{{end}}-square-o"></i></td>
|
<td><i class="fa fa{{if .IsPrivate}}-check{{end}}-square-o"></i></td>
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
<div class="divider"> / </div>
|
<div class="divider"> / </div>
|
||||||
<a href="{{$.RepoLink}}">{{.Name}}</a>
|
<a href="{{$.RepoLink}}">{{.Name}}</a>
|
||||||
{{if .IsMirror}}<div class="ui label">{{$.i18n.Tr "mirror"}}</div>{{end}}
|
{{if .IsMirror}}<div class="ui label">{{$.i18n.Tr "mirror"}}</div>{{end}}
|
||||||
{{if .IsFork}}<div class="fork-flag">{{$.i18n.Tr "repo.forked_from"}} <a href="{{.ForkRepo.RepoLink}}">{{SubStr .ForkRepo.RepoLink 1 -1}}</a></div>{{end}}
|
{{if .IsFork}}<div class="fork-flag">{{$.i18n.Tr "repo.forked_from"}} <a href="{{.BaseRepo.RepoLink}}">{{SubStr .BaseRepo.RepoLink 1 -1}}</a></div>{{end}}
|
||||||
</div>
|
</div>
|
||||||
</h2>
|
</h2>
|
||||||
<div class="ui right floated secondary menu">
|
<div class="ui right floated secondary menu">
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
<span class="divider">/</span>
|
<span class="divider">/</span>
|
||||||
<a class="repo text-bold" href="{{$.RepoLink}}">{{.Name}}</a>
|
<a class="repo text-bold" href="{{$.RepoLink}}">{{.Name}}</a>
|
||||||
{{if .IsMirror}}<span class="label label-gray">{{$.i18n.Tr "mirror"}}</span>{{end}}
|
{{if .IsMirror}}<span class="label label-gray">{{$.i18n.Tr "mirror"}}</span>{{end}}
|
||||||
{{if .IsFork}}<span class="fork-flag">forked from <a href="{{.ForkRepo.RepoLink}}">{{SubStr .ForkRepo.RepoLink 1 -1}}</a></span>{{end}}
|
{{if .IsFork}}<span class="fork-flag">forked from <a href="{{.BaseRepo.RepoLink}}">{{SubStr .BaseRepo.RepoLink 1 -1}}</a></span>{{end}}
|
||||||
</h1>
|
</h1>
|
||||||
<ul id="repo-header-meta" class="right menu menu-line">
|
<ul id="repo-header-meta" class="right menu menu-line">
|
||||||
<li id="repo-header-download" class="drop">
|
<li id="repo-header-download" class="drop">
|
||||||
@@ -49,7 +49,7 @@
|
|||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li id="repo-header-fork">
|
<li id="repo-header-fork">
|
||||||
<a id="repo-header-fork-btn" {{if or (not $.IsRepositoryAdmin) $.Owner.IsOrganization}}href="{{AppSubUrl}}/repo/fork/{{.Id}}"{{end}}>
|
<a id="repo-header-fork-btn" {{if or (not $.IsRepositoryAdmin) $.Owner.IsOrganization}}href="{{AppSubUrl}}/repo/fork/{{.ID}}"{{end}}>
|
||||||
<button class="btn btn-gray text-bold btn-radius">
|
<button class="btn btn-gray text-bold btn-radius">
|
||||||
<i class="octicon octicon-repo-forked"></i>{{$.i18n.Tr "repo.fork"}}
|
<i class="octicon octicon-repo-forked"></i>{{$.i18n.Tr "repo.fork"}}
|
||||||
<span class="num">{{.NumForks}}</span>
|
<span class="num">{{.NumForks}}</span>
|
||||||
|
|||||||
@@ -9,11 +9,14 @@
|
|||||||
<a class="link" href="{{.Repository.Website}}">{{.Repository.Website}}</a>
|
<a class="link" href="{{.Repository.Website}}">{{.Repository.Website}}</a>
|
||||||
</p>
|
</p>
|
||||||
<ul id="repo-file-nav" class="clear menu menu-line">
|
<ul id="repo-file-nav" class="clear menu menu-line">
|
||||||
<!-- <li>
|
{{if and .IsRepositoryAdmin .Repository.BaseRepo}}
|
||||||
<a href="#">
|
{{ $baseRepo := .Repository.BaseRepo}}
|
||||||
|
<li>
|
||||||
|
<a href="{{AppSubUrl}}/{{$baseRepo.Owner.Name}}/{{$baseRepo.Name}}/compare/{{$.BaseDefaultBranch}}...{{$.Owner.Name}}:{{$.BranchName}}">
|
||||||
<button class="btn btn-green btn-small btn-radius" id="repo-compare-btn"><i class="octicon octicon-git-compare"></i></button>
|
<button class="btn btn-green btn-small btn-radius" id="repo-compare-btn"><i class="octicon octicon-git-compare"></i></button>
|
||||||
</a>
|
</a>
|
||||||
</li> -->
|
</li>
|
||||||
|
{{end}}
|
||||||
<li id="repo-branch-switch" class="down drop">
|
<li id="repo-branch-switch" class="down drop">
|
||||||
<a>
|
<a>
|
||||||
<button class="btn btn-gray btn-medium btn-radius">
|
<button class="btn btn-gray btn-medium btn-radius">
|
||||||
|
|||||||
@@ -0,0 +1,51 @@
|
|||||||
|
{{template "base/head" .}}
|
||||||
|
<div class="repository compare pull">
|
||||||
|
{{template "repo/header" .}}
|
||||||
|
<div class="ui middle page grid body">
|
||||||
|
<div class="sixteen wide column page grid">
|
||||||
|
<h2 class="ui header">
|
||||||
|
{{.i18n.Tr "repo.pulls.compare_changes"}}
|
||||||
|
<div class="sub header">{{.i18n.Tr "repo.pulls.compare_changes_desc"}}</div>
|
||||||
|
</h2>
|
||||||
|
<div class="ui segment choose branch">
|
||||||
|
<span class="octicon octicon-git-compare"></span>
|
||||||
|
<div class="ui floating filter dropdown">
|
||||||
|
<div class="ui basic small button">
|
||||||
|
<span class="text">base: {{$.BaseBranch}}</span>
|
||||||
|
<i class="dropdown icon"></i>
|
||||||
|
</div>
|
||||||
|
<div class="menu">
|
||||||
|
<div class="ui icon search input">
|
||||||
|
<i class="filter icon"></i>
|
||||||
|
<input name="search" placeholder="Filter branch...">
|
||||||
|
</div>
|
||||||
|
<div class="items">
|
||||||
|
{{range .Branches}}
|
||||||
|
<a class="{{if eq $.BaseBranch .}}active selected{{end}} item" href="{{$.RepoLink}}/compare/{{.}}...{{$.SignedUser.Name}}:{{$.HeadBranch}}">{{.}}</a>
|
||||||
|
{{end}}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
...
|
||||||
|
<div class="ui floating filter dropdown">
|
||||||
|
<div class="ui basic small button">
|
||||||
|
<span class="text">compare: {{$.HeadBranch}}</span>
|
||||||
|
<i class="dropdown icon"></i>
|
||||||
|
</div>
|
||||||
|
<div class="menu">
|
||||||
|
<div class="ui icon search input">
|
||||||
|
<i class="filter icon"></i>
|
||||||
|
<input name="search" placeholder="Filter branch...">
|
||||||
|
</div>
|
||||||
|
<div class="items">
|
||||||
|
{{range .HeadBranches}}
|
||||||
|
<a class="{{if eq $.HeadBranch .}}active selected{{end}} item" href="{{$.RepoLink}}/compare/{{$.BaseBranch}}...{{$.SignedUser.Name}}:{{.}}">{{.}}</a>
|
||||||
|
{{end}}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{{template "base/footer" .}}
|
||||||
Reference in new issue
Block a user