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

Accepting an invite when you're already a member #299

Closed
staltz opened this issue Mar 7, 2022 · 1 comment
Closed

Accepting an invite when you're already a member #299

staltz opened this issue Mar 7, 2022 · 1 comment

Comments

@staltz
Copy link
Member

staltz commented Mar 7, 2022

Expected: the invite is accepted (claimed and removed) and the usual responses are given to the client.

Actual: the invite is rejected. (Tested with Manyverse 0.2203.7)

cc @achou11

@cryptix
Copy link
Member

cryptix commented Mar 10, 2022

This should be fairly simple patch, handling the error here:

https://github.com/ssb-ngi-pointer/go-ssb-room/blob/6f5edbaa438fe473cc865e283bb3fd32de231c44/roomdb/sqlite/invites.go#L132-L135

Just make sure it actually is the right error type:

https://github.com/ssb-ngi-pointer/go-ssb-room/blob/7b3a5852dafa98b071e26ffaea9ae453db222c11/roomdb/sqlite/members.go#L74

So basically changing the error check above to something like this:

var alreadyAdded roomdb.ErrAlreadyAdded
if errors.As(err, &alreadyAdded) && alreadyAdded.Ref.Equal(newMember) {
  // it is fine to use an invite twice
} else {
  return err
}

plus adding a test of course.. 🙃

decentral1se pushed a commit to decentral1se/go-ssb-room that referenced this issue Mar 26, 2022
@staltz staltz closed this as completed in 49aaff9 Mar 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants