Giter Site home page Giter Site logo

Comments (10)

rlanga avatar rlanga commented on May 5, 2024 2

Definitely sounds like a great idea! I could modify my code for this

from papercups.

n1arash avatar n1arash commented on May 5, 2024

Hi,
I want to send a PR on this.
Isn't this better that we add a boolean flag for user invite and keep the record that will invalidate the invitation link and save the record in the database for future use like analytics or showing past invitations?

from papercups.

reichert621 avatar reichert621 commented on May 5, 2024

hmm yeah @n1arash, good point -- maybe we can add a flag like you suggested or just update the expires_at field to the current time, and then make sure we check against expiration before allowing the invitation to be used? what do you think?

from papercups.

n1arash avatar n1arash commented on May 5, 2024

I think updating the expires_at field can do the job, and also we can send an appropriate error to the frontend if a user used the link again with a 403 status header.

from papercups.

reichert621 avatar reichert621 commented on May 5, 2024

sounds perfect @n1arash

from papercups.

rlanga avatar rlanga commented on May 5, 2024

Hi,
I've done some sample modifications that delete the invite token after user creation is successful. I also split out the logic for cases when an invite token is included in the params and when it isn't. I think logic for #59 can be added to the create method for invite tokens. It could be modified to set the boolean flag to the invites as @n1arash mentioned.

Please have a look at the commit on my repo fork.

from papercups.

reichert621 avatar reichert621 commented on May 5, 2024

@rlanga nice! your commit definitely looks like it solves the original issue, and i love the refactoring + test coverage 😁

i think what @n1arash mentioned might be a good idea though — instead of deleting the invite after it's used, it would be helpful to keep it around so we can have a record of which invites have been used vs not. so rather than deleting, we could set up a method like

ChatApi.UserInvitations.mark_user_invitation_expired(invite)

or something like that, and then throw a helpful error if someone tries to sign up with an expired invite. what do you think?

from papercups.

reichert621 avatar reichert621 commented on May 5, 2024

thanks @rlanga!

from papercups.

reichert621 avatar reichert621 commented on May 5, 2024

btw @rlanga and @n1arash if you ever want to chat with us directly about this, feel free to join our slack or discord channels https://github.com/papercups-io/papercups#get-in-touch 😄

from papercups.

reichert621 avatar reichert621 commented on May 5, 2024

handled in #81

from papercups.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.