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

Display Invitation Link #247

Open
mtiller opened this issue Feb 2, 2022 · 3 comments
Open

Display Invitation Link #247

mtiller opened this issue Feb 2, 2022 · 3 comments
Labels
feature New feature

Comments

@mtiller
Copy link

mtiller commented Feb 2, 2022

I understand from #224 and various other tickets that there are issues with mailing out links and making sure you are authenticated before accepting the invitation. But another useful and related feature would be to display the link on the "Staff" page. This would eliminate the need to even have a mail server because the admin could add a person and then send them the link directly (e.g., via a Teams channel or something).

In one of the issues, they mention that if you don't have a mail server it will print the email or invite to stdout. I didn't see that.

Is there a reason not to display the invite link on that screen? It appears that the URL for the invite is a simple template involving the token. The token is stored in the database. But when a query is made for invitations, the payload doesn't include the link. Since only "admins or owners" can get a list of invites, why not return the url (or at least the token) in the serialized payload? Then, you could just include it here in the UI.

I'm trying to figure out if this was done deliberately or whether you would accept a PR for this functionality (since it seems like just a few lines of non-breaking changes to implement).

@gempain
Copy link
Contributor

gempain commented Feb 2, 2022

Yeah that one has been bothering me for a while, and your solution makes a lot of sense ! All that would be needed is to build that link in the frontend directly, since it's the same domain to accept and create invitations. It would solve the email problem in a quite elegant way, and all you'd have to do is share the invite link with the other user 😄

@gempain gempain added the feature New feature label Feb 2, 2022
@mtiller
Copy link
Author

mtiller commented Feb 2, 2022

OK. I made those changes at it worked pretty much as planned. I'll try to submit a PR tomorrow for this bit. Any suggestions for what tests you want? All it does is add a URL field the the invite list payload. I can try and dig around and find any tests that might be checking those payload.

The UI is identical except just before the email address of the person I include FontAwesome link icon that is a hyperlink to the invitation. Is that good for you or were you thinking of something else? I could also put the link at the end of the row, but there are already a couple of things going on there including the "delete" x and I hate to put the link too close to that.

Just let me know.

@gempain
Copy link
Contributor

gempain commented Feb 2, 2022

This is awesome! Do you have a screenshot of what you're describing ? Your change seems fine, I'd just suggest copying the invite URL to the clipboard when the user clicks the link icon. We already have a CopyToClipboard component that we use for copying API tokens. I would suggest updating the CopyToClipboard component to allow changing the initial label so you get set Copy invitation link instead of the default Copy to clipboard tooltip. What do you think ?

Regarding tests, if you haven't changed the payload returned by the backend, I'd just leave it as is, otherwise if you feel like adding a jest test for that endpoint, you're welcome to do so, I have no specific guidelines. I know the project lacks testing, that's certain.

mt35-rs added a commit to mtiller/meli that referenced this issue Feb 3, 2022
This adds the invitation URL to the server response for invitations and
it then leverages that URL on the client.  The hope here is to address
issue getmeli#247 and ideally just make it easier to use Meli without having
to have a working email server to send out invites.

Design note: I very deliberately pass a URL back from the server
instead of just the bare token.  The reason is that if I pass back
a bare token then the UI will have to formulate the URL which
means duplicating that logic both client and server side which
I have a visceral dislike for (very bad code smell, IMHO).  This
way, only the server needs to know how to construct the URLs
and it can unilaterally change the scheme if it wants with
_zero_ impact on the client.  Hypermedia for the win.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature
Projects
None yet
Development

No branches or pull requests

2 participants