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

Invite users to service rooms #42

Merged
merged 109 commits into from
Nov 28, 2023
Merged

Invite users to service rooms #42

merged 109 commits into from
Nov 28, 2023

Conversation

aofn
Copy link
Member

@aofn aofn commented Aug 23, 2023

Adds a component which opens an "invite user to matrix room" dialogue.

I've used react-modal for now, to open the dialogue. This way the component can be used within any component at any place.

The styling is very basic and your typical overlayed window style. We could also change this to float right and be more like an insert or cover the width of the iframeView. But I think this will do for now.

  • add basic modal view
  • ability to search matrix user base
  • invite selected user to room
  • disable submit button until user was selected from search results
  • show feedback and close modal on success
  • clean up component and create subcomponents were necessary
  • setAppElement for screen readers
  • add to etherpad
  • add to spacedeck

…invitation. add `setAppElement` for screen readers.
@aofn aofn marked this pull request as ready for review August 24, 2023 11:44
@aofn aofn requested a review from fnwbr August 24, 2023 11:57
aofn pushed a commit that referenced this pull request Aug 31, 2023
Copy link
Member

@fnwbr fnwbr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. Why do we show parenthesis in the dropdown, but not in the input later on? I like it better with parenthesis like in the search results. Can we do the same in the input?
    1. image
    2. *clicking the last row*
    3. image
  2. After clicking one of the rows, there's an unnecessary search request happening, that's always returning an empty array as the result. Can we stop that from happening? I feel like there's no point in that. Or is there?
    image

components/UI/InviteUserToMatrixRoom.js Outdated Show resolved Hide resolved
components/UI/InviteUserToMatrixRoom.js Outdated Show resolved Hide resolved
components/UI/InviteUserToMatrixRoom.js Outdated Show resolved Hide resolved
components/UI/InviteUserToMatrixRoom.js Outdated Show resolved Hide resolved
components/UI/InviteUserToMatrixRoom.js Outdated Show resolved Hide resolved
components/UI/InviteUserToMatrixRoom.js Outdated Show resolved Hide resolved
@aofn
Copy link
Member Author

aofn commented Sep 5, 2023

2. After clicking one of the rows, there's an unnecessary search request happening, that's always returning an empty array as the result. Can we stop that from happening? I feel like there's no point in that. Or is there?

The problem is really datalist not having events... As soon as the user selects an entry from the datalist, the input changes and therfore starts a new request. So we would have to cycle through the last search results to see if the input matches any of the results.

I went ahead and swapped the datalist for a ServiceTable component in 1c935a0. Makes everything a little easier to handle on the code side.

@andirueckel
Copy link
Member

@marcel-klasse I tested your latest changes locally, and the quasi datalist interaction seems to work fine—besides the very short color changes from regular to faded back to regular after mouse-click checking/unchecking a list item which you already mentioned during our previous tests.

Let’s deploy the pull-request branch to our develop environment and do some more testing with our respective accounts across the instance and with supported services next week.

@fnwbr fnwbr removed their request for review November 10, 2023 14:34
@fnwbr
Copy link
Member

fnwbr commented Nov 10, 2023

please just re-request a review from me once you're fully happy :)

@fnwbr
Copy link
Member

fnwbr commented Nov 15, 2023

Please optimize for mobile viewports.

Copy link
Member

@fnwbr fnwbr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I cleaned up the PR a bit, also added a line to filter out the user who is currently inviting from the search results.

Please double-check the translations. Also the "needs" and "need" needs to be swapped.

@aofn aofn requested a review from fnwbr November 16, 2023 17:01
Copy link
Member

@fnwbr fnwbr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have some remarks, but I'll go ahead and merge this as is. We can refine on main.

const successAmount = selectedUsers.length - errors.length;

// if everything is okay, we let the user know and exit the view.
successAmount > 0 && setUserFeedback(<Trans t={t} i18nKey="invitedUser" count={successAmount}>{ { successAmount } } user was invited and needs to accept your invitation</Trans>);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A cleaner way of combining translations with feedback messages would be to set the state here, and then somewhere down use the <Trans> component (or t() function respectively). For example, you could rename the state to be called something like invitedUsersCount and then at the bottom, where we render, instead of

{ userFeedback && _.isEmpty(errorFeedback) ? <div>{ userFeedback }</div> :

... you would ...

{ invitedUsersCount && <Trans ... count={invitedUsersCount}>bla bla bla</Trans> }

This would also allow to switch languages while the message is showing up.
Right now we're writing a translated string into the state, which is not really what the state is made for.

"Invite users to {{name}}": "Benutzer*innen zu {{name}} einladen",
"invitedUser_one": "{{ count }} Benutzer*in wurde eingeladen und muss die Einladung annehmen",
"invitedUser_other": "{{ count }} Benutzer*innen wurden eingeladen und müssen die Einladung annehmen",
"Error while trying to fetch users. ": "Error beim Abruf der User.",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is a really meh translation... 😕

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also: Why do we have a period here? But no periods at the end of sentences above?

@@ -0,0 +1,8 @@
{
"Invite users to {{name}}": "Benutzer*innen zu {{name}} einladen",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about "Jemanden" instead of "Benutzer*innen"?

@fnwbr fnwbr merged commit 46b35d9 into main Nov 28, 2023
2 checks passed
@fnwbr fnwbr deleted the invite-users branch November 28, 2023 12:51
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

Successfully merging this pull request may close these issues.

3 participants