mirror of
https://github.com/github-tijlxyz/khatru-pyramid.git
synced 2025-06-06 18:31:02 +00:00
owner can invite infinite people.
This commit is contained in:
parent
2630d9e2ca
commit
0fbc793b86
@ -24,7 +24,7 @@ func addToWhitelistHandler(w http.ResponseWriter, r *http.Request) {
|
|||||||
pubkey = value.(string)
|
pubkey = value.(string)
|
||||||
}
|
}
|
||||||
|
|
||||||
if hasInvitedAtLeast(loggedUser, s.MaxInvitesPerPerson) {
|
if loggedUser != s.RelayPubkey && hasInvitedAtLeast(loggedUser, s.MaxInvitesPerPerson) {
|
||||||
http.Error(w, fmt.Sprintf("cannot invite more than %d", s.MaxInvitesPerPerson), 403)
|
http.Error(w, fmt.Sprintf("cannot invite more than %d", s.MaxInvitesPerPerson), 403)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
2
pages.go
2
pages.go
@ -51,7 +51,7 @@ type InviteTreePageParams struct {
|
|||||||
func inviteTreePageHTML(ctx context.Context, params InviteTreePageParams) HTMLComponent {
|
func inviteTreePageHTML(ctx context.Context, params InviteTreePageParams) HTMLComponent {
|
||||||
inviteForm := Div()
|
inviteForm := Div()
|
||||||
|
|
||||||
if params.loggedUser != "" && !hasInvitedAtLeast(params.loggedUser, s.MaxInvitesPerPerson) {
|
if params.loggedUser != "" && (params.loggedUser == s.RelayPubkey || !hasInvitedAtLeast(params.loggedUser, s.MaxInvitesPerPerson)) {
|
||||||
inviteForm = Form(
|
inviteForm = Form(
|
||||||
Input("pubkey").Type("text").Placeholder("npub1...").Class("w-96 rounded-md border-0 p-2 text-gray-900 shadow-sm ring-1 ring-inset ring-gray-300 placeholder:text-gray-400 focus:ring-2 focus:ring-inset focus:ring-indigo-600"),
|
Input("pubkey").Type("text").Placeholder("npub1...").Class("w-96 rounded-md border-0 p-2 text-gray-900 shadow-sm ring-1 ring-inset ring-gray-300 placeholder:text-gray-400 focus:ring-2 focus:ring-inset focus:ring-indigo-600"),
|
||||||
Button("invite").Class(buttonClass+" ml-2 p-2 bg-white hover:bg-gray-50"),
|
Button("invite").Class(buttonClass+" ml-2 p-2 bg-white hover:bg-gray-50"),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user