forked from forgejo/forgejo
[FEAT]Add Option to hide Release Archive links (#3139)
This adds a new options to releases to hide the links to the automatically generated archives. This is useful, when the automatically generated Archives are broken e.g. because of Submodules.   Note: This juts hides the Archives from the UI. Users can still download 5the Archive if they know t correct URL. Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3139 Reviewed-by: Otto <otto@codeberg.org> Reviewed-by: 0ko <0ko@noreply.codeberg.org> Co-authored-by: JakobDev <jakobdev@gmx.de> Co-committed-by: JakobDev <jakobdev@gmx.de>
This commit is contained in:
parent
6bcaf4f875
commit
1bce2dc5c5
14 changed files with 220 additions and 106 deletions
|
@ -62,6 +62,8 @@ var migrations = []*Migration{
|
|||
NewMigration("Add the `created` column to the `issue` table", forgejo_v1_22.AddCreatedToIssue),
|
||||
// v12 -> v13
|
||||
NewMigration("Add repo_archive_download_count table", forgejo_v1_22.AddRepoArchiveDownloadCount),
|
||||
// v13 -> v14
|
||||
NewMigration("Add `hide_archive_links` column to `release` table", AddHideArchiveLinksToRelease),
|
||||
}
|
||||
|
||||
// GetCurrentDBVersion returns the current Forgejo database version.
|
||||
|
|
15
models/forgejo_migrations/v13.go
Normal file
15
models/forgejo_migrations/v13.go
Normal file
|
@ -0,0 +1,15 @@
|
|||
// Copyright 2024 The Forgejo Authors. All rights reserved.
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
package forgejo_migrations //nolint:revive
|
||||
|
||||
import "xorm.io/xorm"
|
||||
|
||||
func AddHideArchiveLinksToRelease(x *xorm.Engine) error {
|
||||
type Release struct {
|
||||
ID int64 `xorm:"pk autoincr"`
|
||||
HideArchiveLinks bool `xorm:"NOT NULL DEFAULT false"`
|
||||
}
|
||||
|
||||
return x.Sync(&Release{})
|
||||
}
|
|
@ -78,6 +78,7 @@ type Release struct {
|
|||
TargetBehind string `xorm:"-"` // to handle non-existing or empty target
|
||||
Title string
|
||||
Sha1 string `xorm:"VARCHAR(64)"`
|
||||
HideArchiveLinks bool `xorm:"NOT NULL DEFAULT false"`
|
||||
NumCommits int64
|
||||
NumCommitsBehind int64 `xorm:"-"`
|
||||
Note string `xorm:"TEXT"`
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue