Load user account repos correctly
This commit is contained in:
parent
426c956d45
commit
ccf4318310
2
go.mod
2
go.mod
@ -4,6 +4,7 @@ go 1.18
|
|||||||
|
|
||||||
require (
|
require (
|
||||||
code.gitea.io/sdk/gitea v0.15.1
|
code.gitea.io/sdk/gitea v0.15.1
|
||||||
|
github.com/bwmarrin/discordgo v0.24.0
|
||||||
github.com/google/uuid v1.3.0
|
github.com/google/uuid v1.3.0
|
||||||
github.com/gorilla/mux v1.8.0
|
github.com/gorilla/mux v1.8.0
|
||||||
github.com/gorilla/sessions v1.2.1
|
github.com/gorilla/sessions v1.2.1
|
||||||
@ -12,7 +13,6 @@ require (
|
|||||||
)
|
)
|
||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/bwmarrin/discordgo v0.24.0 // indirect
|
|
||||||
github.com/golang/protobuf v1.4.2 // indirect
|
github.com/golang/protobuf v1.4.2 // indirect
|
||||||
github.com/gorilla/securecookie v1.1.1 // indirect
|
github.com/gorilla/securecookie v1.1.1 // indirect
|
||||||
github.com/gorilla/websocket v1.4.2 // indirect
|
github.com/gorilla/websocket v1.4.2 // indirect
|
||||||
|
@ -94,7 +94,12 @@ func (m *Module) homepage(rw http.ResponseWriter, req *http.Request, state *util
|
|||||||
q := req.URL.Query()
|
q := req.URL.Query()
|
||||||
if q.Has("org") {
|
if q.Has("org") {
|
||||||
selOrg = q.Get("org")
|
selOrg = q.Get("org")
|
||||||
repos, _, err := giteaClient.ListOrgRepos(selOrg, gitea.ListOrgReposOptions{ListOptions: gitea.ListOptions{Page: 0, PageSize: 100}})
|
var repos []*gitea.Repository
|
||||||
|
if selOrg == "@me" {
|
||||||
|
repos, _, err = giteaClient.ListMyRepos(gitea.ListReposOptions{ListOptions: gitea.ListOptions{Page: 0, PageSize: 100}})
|
||||||
|
} else {
|
||||||
|
repos, _, err = giteaClient.ListOrgRepos(selOrg, gitea.ListOrgReposOptions{ListOptions: gitea.ListOptions{Page: 0, PageSize: 100}})
|
||||||
|
}
|
||||||
if err != nil {
|
if err != nil {
|
||||||
http.Error(rw, err.Error(), http.StatusInternalServerError)
|
http.Error(rw, err.Error(), http.StatusInternalServerError)
|
||||||
return
|
return
|
||||||
|
@ -28,7 +28,7 @@
|
|||||||
<p>Select repository source:</p>
|
<p>Select repository source:</p>
|
||||||
<ul>
|
<ul>
|
||||||
<li>
|
<li>
|
||||||
<a href="?org={{.Username}}">{{.Username}} (my user account)</a>
|
<a href="?org=@me">{{.Username}} (my user account)</a>
|
||||||
</li>
|
</li>
|
||||||
{{range .Orgs}}
|
{{range .Orgs}}
|
||||||
<li>
|
<li>
|
||||||
|
Loading…
Reference in New Issue
Block a user