diff options
author | a1012112796 <1012112796@qq.com> | 2021-05-06 11:12:50 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-05-06 05:12:50 +0200 |
commit | 308886653148d859080222ebb72966e020f9391e (patch) | |
tree | f61bd23f73eee6a30cf28c477bf0d1c859b8aace /modules/context | |
parent | eedc0c8324820817f4c06603ec3195a1d3513542 (diff) | |
download | gitea-308886653148d859080222ebb72966e020f9391e.tar.gz gitea-308886653148d859080222ebb72966e020f9391e.zip |
fix some ui bug about draft release (#15137)
* fix some ui bug about draft release
- should not show draft release in tag list because
it will't create real tag
- still show draft release without tag and commit message
for draft release instead of 404 error
- remove tag load for attachement links because it's useless
Signed-off-by: a1012112796 <1012112796@qq.com>
* add test code
* fix test
That's because has added a new release in relaese test database.
* fix dropdown link for draft release
Diffstat (limited to 'modules/context')
-rw-r--r-- | modules/context/repo.go | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/modules/context/repo.go b/modules/context/repo.go index 8fc948b509..c1f60a1362 100644 --- a/modules/context/repo.go +++ b/modules/context/repo.go @@ -724,7 +724,7 @@ func getRefName(ctx *Context, pathType RepoRefType) string { // RepoRefByType handles repository reference name for a specific type // of repository reference -func RepoRefByType(refType RepoRefType) func(*Context) context.CancelFunc { +func RepoRefByType(refType RepoRefType, ignoreNotExistErr ...bool) func(*Context) context.CancelFunc { return func(ctx *Context) (cancel context.CancelFunc) { // Empty repository does not have reference information. if ctx.Repo.Repository.IsEmpty { @@ -813,6 +813,9 @@ func RepoRefByType(refType RepoRefType) func(*Context) context.CancelFunc { util.URLJoin(setting.AppURL, strings.Replace(ctx.Req.URL.RequestURI(), refName, ctx.Repo.Commit.ID.String(), 1)))) } } else { + if len(ignoreNotExistErr) > 0 && ignoreNotExistErr[0] { + return + } ctx.NotFound("RepoRef invalid repo", fmt.Errorf("branch or tag not exist: %s", refName)) return } |