[BUG] Reflect Cargo index state in settings
- Currently in the Cargo section of the packages setting menu two buttons are always shown, "Initalize index" and "Rebuild index", however only of these should be shown depending on the state of the index, if there's no index the "Initalize index" button should be shown and if there's an index the "Rebuild index" button should be shown. This patch does exactly that. - Resolves #2628
This commit is contained in:
parent
17ef8145a8
commit
461f925554
5 changed files with 87 additions and 10 deletions
|
@ -62,9 +62,9 @@ func InitializeIndexRepository(ctx context.Context, doer, owner *user_model.User
|
|||
}
|
||||
|
||||
func RebuildIndex(ctx context.Context, doer, owner *user_model.User) error {
|
||||
repo, err := getOrCreateIndexRepository(ctx, doer, owner)
|
||||
repo, err := repo_model.GetRepositoryByOwnerAndName(ctx, owner.Name, IndexRepositoryName)
|
||||
if err != nil {
|
||||
return err
|
||||
return fmt.Errorf("GetRepositoryByOwnerAndName: %w", err)
|
||||
}
|
||||
|
||||
ps, err := packages_model.GetPackagesByType(ctx, owner.ID, packages_model.TypeCargo)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue