mirror of
				https://github.com/go-gitea/gitea.git
				synced 2025-10-26 12:27:06 +00:00 
			
		
		
		
	Updated and created were appended with _unix. Fresh databases have only the newly named fields.
This commit is contained in:
		| @@ -110,7 +110,7 @@ func (u *User) GetAccessibleRepositories() ([]*Repository, error) { | |||||||
| 		repoIDs = append(repoIDs, access.RepoID) | 		repoIDs = append(repoIDs, access.RepoID) | ||||||
| 	} | 	} | ||||||
| 	repos := make([]*Repository, 0, len(repoIDs)) | 	repos := make([]*Repository, 0, len(repoIDs)) | ||||||
| 	return repos, x.Where("owner_id != ?", u.Id).In("id", repoIDs).Desc("updated").Find(&repos) | 	return repos, x.Where("owner_id != ?", u.Id).In("id", repoIDs).Desc("updated_unix").Find(&repos) | ||||||
| } | } | ||||||
|  |  | ||||||
| func maxAccessMode(modes ...AccessMode) AccessMode { | func maxAccessMode(modes ...AccessMode) AccessMode { | ||||||
|   | |||||||
| @@ -495,11 +495,11 @@ func Issues(opts *IssuesOptions) ([]*Issue, error) { | |||||||
|  |  | ||||||
| 	switch opts.SortType { | 	switch opts.SortType { | ||||||
| 	case "oldest": | 	case "oldest": | ||||||
| 		sess.Asc("created") | 		sess.Asc("created_unix") | ||||||
| 	case "recentupdate": | 	case "recentupdate": | ||||||
| 		sess.Desc("updated") | 		sess.Desc("updated_unix") | ||||||
| 	case "leastupdate": | 	case "leastupdate": | ||||||
| 		sess.Asc("updated") | 		sess.Asc("updated_unix") | ||||||
| 	case "mostcomment": | 	case "mostcomment": | ||||||
| 		sess.Desc("num_comments") | 		sess.Desc("num_comments") | ||||||
| 	case "leastcomment": | 	case "leastcomment": | ||||||
| @@ -507,7 +507,7 @@ func Issues(opts *IssuesOptions) ([]*Issue, error) { | |||||||
| 	case "priority": | 	case "priority": | ||||||
| 		sess.Desc("priority") | 		sess.Desc("priority") | ||||||
| 	default: | 	default: | ||||||
| 		sess.Desc("created") | 		sess.Desc("created_unix") | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	labelIDs := base.StringsToInt64s(strings.Split(opts.Labels, ",")) | 	labelIDs := base.StringsToInt64s(strings.Split(opts.Labels, ",")) | ||||||
|   | |||||||
| @@ -310,7 +310,7 @@ func GetCommentByID(id int64) (*Comment, error) { | |||||||
| // GetCommentsByIssueID returns all comments of issue by given ID. | // GetCommentsByIssueID returns all comments of issue by given ID. | ||||||
| func GetCommentsByIssueID(issueID int64) ([]*Comment, error) { | func GetCommentsByIssueID(issueID int64) ([]*Comment, error) { | ||||||
| 	comments := make([]*Comment, 0, 10) | 	comments := make([]*Comment, 0, 10) | ||||||
| 	return comments, x.Where("issue_id=?", issueID).Asc("created").Find(&comments) | 	return comments, x.Where("issue_id=?", issueID).Asc("created_unix").Find(&comments) | ||||||
| } | } | ||||||
|  |  | ||||||
| // UpdateComment updates information of comment. | // UpdateComment updates information of comment. | ||||||
|   | |||||||
| @@ -131,7 +131,7 @@ func GetReleaseByID(id int64) (*Release, error) { | |||||||
|  |  | ||||||
| // GetReleasesByRepoID returns a list of releases of repository. | // GetReleasesByRepoID returns a list of releases of repository. | ||||||
| func GetReleasesByRepoID(repoID int64) (rels []*Release, err error) { | func GetReleasesByRepoID(repoID int64) (rels []*Release, err error) { | ||||||
| 	err = x.Desc("created").Find(&rels, Release{RepoID: repoID}) | 	err = x.Desc("created_unix").Find(&rels, Release{RepoID: repoID}) | ||||||
| 	return rels, err | 	return rels, err | ||||||
| } | } | ||||||
|  |  | ||||||
|   | |||||||
| @@ -1464,7 +1464,8 @@ func GetRepositoryByID(id int64) (*Repository, error) { | |||||||
| // GetRepositories returns a list of repositories of given user. | // GetRepositories returns a list of repositories of given user. | ||||||
| func GetRepositories(uid int64, private bool) ([]*Repository, error) { | func GetRepositories(uid int64, private bool) ([]*Repository, error) { | ||||||
| 	repos := make([]*Repository, 0, 10) | 	repos := make([]*Repository, 0, 10) | ||||||
| 	sess := x.Desc("updated") | 	sess := x.Desc("updated_unix") | ||||||
|  |  | ||||||
| 	if !private { | 	if !private { | ||||||
| 		sess.Where("is_private=?", false) | 		sess.Where("is_private=?", false) | ||||||
| 	} | 	} | ||||||
| @@ -1475,7 +1476,7 @@ func GetRepositories(uid int64, private bool) ([]*Repository, error) { | |||||||
| // GetRecentUpdatedRepositories returns the list of repositories that are recently updated. | // GetRecentUpdatedRepositories returns the list of repositories that are recently updated. | ||||||
| func GetRecentUpdatedRepositories(page int) (repos []*Repository, err error) { | func GetRecentUpdatedRepositories(page int) (repos []*Repository, err error) { | ||||||
| 	return repos, x.Limit(setting.ExplorePagingNum, (page-1)*setting.ExplorePagingNum). | 	return repos, x.Limit(setting.ExplorePagingNum, (page-1)*setting.ExplorePagingNum). | ||||||
| 		Where("is_private=?", false).Limit(setting.ExplorePagingNum).Desc("updated").Find(&repos) | 		Where("is_private=?", false).Limit(setting.ExplorePagingNum).Desc("updated_unix").Find(&repos) | ||||||
| } | } | ||||||
|  |  | ||||||
| func getRepositoryCount(e Engine, u *User) (int64, error) { | func getRepositoryCount(e Engine, u *User) (int64, error) { | ||||||
|   | |||||||
| @@ -34,7 +34,7 @@ func MustBeNotBare(ctx *middleware.Context) { | |||||||
| } | } | ||||||
|  |  | ||||||
| func checkContextUser(ctx *middleware.Context, uid int64) *models.User { | func checkContextUser(ctx *middleware.Context, uid int64) *models.User { | ||||||
| 	orgs, err := models.GetOwnedOrgsByUserIDDesc(ctx.User.Id, "updated") | 	orgs, err := models.GetOwnedOrgsByUserIDDesc(ctx.User.Id, "updated_unix") | ||||||
| 	if err != nil { | 	if err != nil { | ||||||
| 		ctx.Handle(500, "GetOwnedOrgsByUserIDDesc", err) | 		ctx.Handle(500, "GetOwnedOrgsByUserIDDesc", err) | ||||||
| 		return nil | 		return nil | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Marin Jankovski
					Marin Jankovski