Skip to content
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

API: support '/orgs/:org/repos' #1691

Closed
wants to merge 3 commits into from
Closed

Conversation

awwalker
Copy link
Contributor

@awwalker awwalker commented May 7, 2017

Fix for: #494

@lafriks
Copy link
Member

lafriks commented May 7, 2017

Please add swagger:route comment

@tboerger tboerger added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label May 7, 2017
org := ctx.Org.Organization

// Find all repos a user has access to within an org.
reposEnv, err := org.AccessibleReposEnv(requester.ID)
Copy link
Contributor

@cez81 cez81 May 7, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will 500 if user is not signed in. Think it's the same problem further down too, ctx.User = nil. See #1622

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe you can add an integration test on integrations sub directory. There are some examples there.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So I'm going to check for user being nil first, do want to reply 200 with an empty list if they aren't signed in?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will also add a test...was going to ask before PR was accepted where the appropriate place for that was :) When drone runs I notice a lot of places say they have no test files is that because they are all covered in integration tests or are those tests things that would be accepted as PRs?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If a user isn't logged in the request should still show public repos in said organization. So just returning an empty list here would not work 🙂


apiRepos := make([]*api.Repository, len(repos))
for i, repo := range repos {
accessLevel, err := models.AccessLevel(requester.ID, repo)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

^

@lunny lunny added the modifies/api This PR adds API routes or modifies them label May 20, 2017
@lunny lunny added this to the 1.2.0 milestone May 20, 2017
@strk
Copy link
Member

strk commented May 28, 2017

Please add tests for the new endpoint

@@ -0,0 +1,46 @@
package org
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needs a copyright

// 500: error

var apiRepos []*api.Repository
if ctx.User != nil {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't like quietly returning a empty list of repositories for unauthenticated users. Either we should have a 401 (like we do for GET /repos/:owner/:reponame), or show the unauthenticated users the organization's public repos.

@bkcsoft bkcsoft modified the milestones: 1.3.0, 1.2.0 Jun 15, 2017
@kmadel
Copy link
Contributor

kmadel commented Jun 19, 2017

Actually a feature that gogs has and gitea does not - gogs/gogs@cd9b29f#diff-2620fdbeeb83ce43692534e6c2c39452R230 - very much looking forward to it being added to gitea.

@awwalker
Copy link
Contributor Author

So sorry this was added and then died. I've been busy with interviews and graduation but I'll have the rest of the issues with this fixed hopefully by Friday.

@lunny lunny removed this from the 1.3.0 milestone Jul 13, 2017
@lunny
Copy link
Member

lunny commented Jul 13, 2017

instead by #2047

@lunny lunny closed this Jul 13, 2017
@go-gitea go-gitea locked and limited conversation to collaborators Nov 23, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. modifies/api This PR adds API routes or modifies them
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants