owner can invite infinite people.

This commit is contained in:
fiatjaf 2024-02-05 11:32:41 -03:00
parent 2630d9e2ca
commit 0fbc793b86
No known key found for this signature in database
GPG Key ID: BAD43C4BE5C1A3A1
2 changed files with 2 additions and 2 deletions

View File

@ -24,7 +24,7 @@ func addToWhitelistHandler(w http.ResponseWriter, r *http.Request) {
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)
return
}

View File

@ -51,7 +51,7 @@ type InviteTreePageParams struct {
func inviteTreePageHTML(ctx context.Context, params InviteTreePageParams) HTMLComponent {
inviteForm := Div()
if params.loggedUser != "" && !hasInvitedAtLeast(params.loggedUser, s.MaxInvitesPerPerson) {
if params.loggedUser != "" && (params.loggedUser == s.RelayPubkey || !hasInvitedAtLeast(params.loggedUser, s.MaxInvitesPerPerson)) {
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"),
Button("invite").Class(buttonClass+" ml-2 p-2 bg-white hover:bg-gray-50"),