-
-
Notifications
You must be signed in to change notification settings - Fork 364
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Do not store inactive repos without any resources #1658
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this fix / help with #485?
How are repo permission now handled? From a first look you check if a user is having and update access on create / activate / re-activate, repair, move and in the repo-middleware if the last sync was 1 hour ago?
I think yes, at least partially.
Yes, I think that's correct. Didn't change much from before though. |
Co-authored-by: Anbraten <anton@ju60.de>
This is actually more similar to it than I originally thought. I'm working on partially fixing it. |
This comment was marked as outdated.
This comment was marked as outdated.
did not had a deeper look into it ... but if we only request permissions on demand (by having a paginated view on the repo activation page ...) |
owner := c.Param("owner") | ||
name := c.Param("name") | ||
repo, err := _store.GetRepoName(owner + "/" + name) | ||
enabledOnce := err == nil // if there's no error, the repo was found and enabled once already |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i would expizite check against errorNotFound
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That should be done below
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hmm well it's not the usual code-style but you are right
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
diff --git a/server/api/repo.go b/server/api/repo.go
index 64db2f80..da7eccf7 100644
--- a/server/api/repo.go
+++ b/server/api/repo.go
@@ -42,14 +42,19 @@ func PostRepo(c *gin.Context) {
owner := c.Param("owner")
name := c.Param("name")
+ enabledOnce := false
repo, err := _store.GetRepoName(owner + "/" + name)
- enabledOnce := err == nil // if there's no error, the repo was found and enabled once already
+ if err != nil {
+ if !errors.Is(err, types.RecordNotExist) {
+ // we got an unexpected error
+ _ = c.AbortWithError(http.StatusInternalServerError, err)
+ return
+ }
+ enabledOnce = true
+ }
if enabledOnce && repo.IsActive {
c.String(http.StatusConflict, "Repository is already active.")
return
- } else if err != nil && !errors.Is(err, types.RecordNotExist) {
- c.String(http.StatusInternalServerError, err.Error())
- return
}
not sure if it's worth changing it to that or not
Do not sync repos with forge if the repo is not necessary in DB.
In the DB, only repos that were active once or repos that are currently active are stored. When trying to enable new repos, the repos list is fetched from the forge instead and displayed directly. In addition to this, the forge func
Perm
was removed and is now merged withRepo
.Solves a TODO on RepoBatch.