* Add release default page and set it to 10 * use limit Co-authored-by: 6543 <6543@obermui.de>tags/v1.16.0-rc1
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | ||||
;; Comma-separated list of allowed file extensions (`.zip`), mime types (`text/plain`) or wildcard type (`image/*`, `audio/*`, `video/*`). Empty value or `*/*` allows all types. | ;; Comma-separated list of allowed file extensions (`.zip`), mime types (`text/plain`) or wildcard type (`image/*`, `audio/*`, `video/*`). Empty value or `*/*` allows all types. | ||||
;ALLOWED_TYPES = | ;ALLOWED_TYPES = | ||||
;DEFAULT_PAGING_NUM = 10 | |||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | ||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
### Repository - Release (`repository.release`) | ### Repository - Release (`repository.release`) | ||||
- `ALLOWED_TYPES`: **\<empty\>**: Comma-separated list of allowed file extensions (`.zip`), mime types (`text/plain`) or wildcard type (`image/*`, `audio/*`, `video/*`). Empty value or `*/*` allows all types. | - `ALLOWED_TYPES`: **\<empty\>**: Comma-separated list of allowed file extensions (`.zip`), mime types (`text/plain`) or wildcard type (`image/*`, `audio/*`, `video/*`). Empty value or `*/*` allows all types. | ||||
- `DEFAULT_PAGING_NUM`: **10**: The default paging number of releases user interface | |||||
### Repository - Signing (`repository.signing`) | ### Repository - Signing (`repository.signing`) | ||||
- `MAX_CREATION_LIMIT`: 全局最大每个用户创建的git工程数目, `-1` 表示没限制。 | - `MAX_CREATION_LIMIT`: 全局最大每个用户创建的git工程数目, `-1` 表示没限制。 | ||||
- `PULL_REQUEST_QUEUE_LENGTH`: 小心:合并请求测试队列的长度,尽量放大。 | - `PULL_REQUEST_QUEUE_LENGTH`: 小心:合并请求测试队列的长度,尽量放大。 | ||||
### Repository - Release (`repository.release`) | |||||
- `ALLOWED_TYPES`: **\<empty\>**: 允许扩展名的列表,用逗号分隔 (`.zip`), mime 类型 (`text/plain`) 或者匹配符号 (`image/*`, `audio/*`, `video/*`). 空值或者 `*/*` 允许所有类型。 | |||||
- `DEFAULT_PAGING_NUM`: **10**: 默认的发布版本页面分页。 | |||||
## UI (`ui`) | ## UI (`ui`) | ||||
- `EXPLORE_PAGING_NUM`: 探索页面每页显示的仓库数量。 | - `EXPLORE_PAGING_NUM`: 探索页面每页显示的仓库数量。 |
} `ini:"repository.issue"` | } `ini:"repository.issue"` | ||||
Release struct { | Release struct { | ||||
AllowedTypes string | |||||
AllowedTypes string | |||||
DefaultPagingNum int | |||||
} `ini:"repository.release"` | } `ini:"repository.release"` | ||||
Signing struct { | Signing struct { | ||||
}, | }, | ||||
Release: struct { | Release: struct { | ||||
AllowedTypes string | |||||
AllowedTypes string | |||||
DefaultPagingNum int | |||||
}{ | }{ | ||||
AllowedTypes: "", | |||||
AllowedTypes: "", | |||||
DefaultPagingNum: 10, | |||||
}, | }, | ||||
// Signing settings | // Signing settings |
"code.gitea.io/gitea/models" | "code.gitea.io/gitea/models" | ||||
"code.gitea.io/gitea/modules/base" | "code.gitea.io/gitea/modules/base" | ||||
"code.gitea.io/gitea/modules/context" | "code.gitea.io/gitea/modules/context" | ||||
"code.gitea.io/gitea/modules/convert" | |||||
"code.gitea.io/gitea/modules/log" | "code.gitea.io/gitea/modules/log" | ||||
"code.gitea.io/gitea/modules/markup" | "code.gitea.io/gitea/modules/markup" | ||||
"code.gitea.io/gitea/modules/markup/markdown" | "code.gitea.io/gitea/modules/markup/markdown" | ||||
writeAccess := ctx.Repo.CanWrite(models.UnitTypeReleases) | writeAccess := ctx.Repo.CanWrite(models.UnitTypeReleases) | ||||
ctx.Data["CanCreateRelease"] = writeAccess && !ctx.Repo.Repository.IsArchived | ctx.Data["CanCreateRelease"] = writeAccess && !ctx.Repo.Repository.IsArchived | ||||
limit := ctx.FormInt("limit") | |||||
if limit == 0 { | |||||
limit = setting.Repository.Release.DefaultPagingNum | |||||
} | |||||
if limit > setting.API.MaxResponseItems { | |||||
limit = setting.API.MaxResponseItems | |||||
} | |||||
opts := models.FindReleasesOptions{ | opts := models.FindReleasesOptions{ | ||||
ListOptions: models.ListOptions{ | ListOptions: models.ListOptions{ | ||||
Page: ctx.FormInt("page"), | Page: ctx.FormInt("page"), | ||||
PageSize: convert.ToCorrectPageSize(ctx.FormInt("limit")), | |||||
PageSize: limit, | |||||
}, | }, | ||||
IncludeDrafts: writeAccess && !isTagList, | IncludeDrafts: writeAccess && !isTagList, | ||||
IncludeTags: isTagList, | IncludeTags: isTagList, |