Home | Zones | Log in | Register

Cannot generate valid invite with "Limit uses" set

bug reports invites

Nobody

I started a new, invite-only zone. I created a new invite with these settings:

01-invite-settings.png

Here is the result of pressing create:

02-invite-result.png

Another user, not registered to the zone, copies and pastes the invite link and tries to join:

03-join-attempt.png

They are denied access because the invite code is invalid:

04-join-invalid-invite.png

Here’s what I see in the invite status list:

05-invite-status.png

This has happened for about five invite in a row. Am I using this wrong?

Trying too hard

The invite works if I turn off the “limit uses” field. Is this some sort of weird browser pre-fetch behavior?

I first saw this on iOS Safari, but I’m also seeing it on Firefox 78.11.0esr

Trying too hard

Setting the “Limit uses” box and putting any value in the number of uses creates an invalid invite.

Creating a time-limited invite works correctly.

Creating an invite not bound by use or time also works correctly.

Trying too hard
| Posted: 2021-06-15 00:11:312021-06-15 00:11 | Filter

MasterOfMagic changed the thread title from Cannot generate valid invite to Cannot generate valid invite with "Limit uses" set.

whoops i messed it up at some point. should be fixed and the invites working now

bird on skateboard
diff --git a/zone/invite.go b/zone/invite.go
index 2c5c85c..3c1355d 100644
--- a/zone/invite.go
+++ b/zone/invite.go
@@ -50,7 +50,7 @@ func (inv Invite) Remaining() int {
        if inv.Max == 0 && inv.Uses == 0 {
                return 1 // backwards compat
        }
-       if inv.Max >= inv.Uses {
+       if inv.Max < inv.Uses {
                return 0
        }
        return inv.Max - inv.Uses

this is why u dont name ur variables ambiguous stuff like Uses

bird on skateboard

lmbo

From: Tiko at 2021-06-15 05:47:32

diff --git a/zone/invite.go b/zone/invite.go
index 2c5c85c..3c1355d 100644
--- a/zone/invite.go
+++ b/zone/invite.go
@@ -50,7 +50,7 @@ func (inv Invite) Remaining() int {
        if inv.Max == 0 && inv.Uses == 0 {
                return 1 // backwards compat
        }
-       if inv.Max >= inv.Uses {
+       if inv.Max < inv.Uses {
                return 0
        }
        return inv.Max - inv.Uses

this is why u dont name ur variables ambiguous stuff like Uses

oh shit, i didn’t know the backend was written in go. lmk if you ever want backend help.

From: cosban at 2021-06-15 16:45:58
lmk if you ever want backend help.

Smirking face emoji

Trying too hard

i know what i said

From: cosban at 2021-06-15 16:45:58

From: Tiko at 2021-06-15 05:47:32

diff --git a/zone/invite.go b/zone/invite.go
index 2c5c85c..3c1355d 100644
--- a/zone/invite.go
+++ b/zone/invite.go
@@ -50,7 +50,7 @@ func (inv Invite) Remaining() int {
        if inv.Max == 0 && inv.Uses == 0 {
                return 1 // backwards compat
        }
-       if inv.Max >= inv.Uses {
+       if inv.Max < inv.Uses {
                return 0
        }
        return inv.Max - inv.Uses

this is why u dont name ur variables ambiguous stuff like Uses

oh shit, i didn’t know the backend was written in go. lmk if you ever want backend help.

hey

Reply:
To reply to this thread, please join this community.
1 person is reading this thread now.
Thread List | ↑ Top