- {_t(
- "If you can't find someone, ask them for their username, or share your " +
- "username (%(userId)s) or profile link.",
- {userId},
- {a: (sub) => {sub}},
- )}
-
{this._renderEditor()}
- {_t("Go")}
+ {buttonText}
{spinner}
diff --git a/src/i18n/strings/en_EN.json b/src/i18n/strings/en_EN.json
index b6f61570cd8..f8b17db7c57 100644
--- a/src/i18n/strings/en_EN.json
+++ b/src/i18n/strings/en_EN.json
@@ -372,7 +372,7 @@
"Render simple counters in room header": "Render simple counters in room header",
"Multiple integration managers": "Multiple integration managers",
"Try out new ways to ignore people (experimental)": "Try out new ways to ignore people (experimental)",
- "New DM invite dialog (under development)": "New DM invite dialog (under development)",
+ "New invite dialog": "New invite dialog",
"Show a presence dot next to DMs in the room list": "Show a presence dot next to DMs in the room list",
"Enable cross-signing to verify per-user instead of per-device (in development)": "Enable cross-signing to verify per-user instead of per-device (in development)",
"Enable local event indexing and E2EE search (requires restart)": "Enable local event indexing and E2EE search (requires restart)",
@@ -1438,25 +1438,29 @@
"View Servers in Room": "View Servers in Room",
"Toolbox": "Toolbox",
"Developer Tools": "Developer Tools",
+ "An error has occurred.": "An error has occurred.",
+ "Verify this user to mark them as trusted. Trusting users gives you extra peace of mind when using end-to-end encrypted messages.": "Verify this user to mark them as trusted. Trusting users gives you extra peace of mind when using end-to-end encrypted messages.",
+ "Verifying this user will mark their device as trusted, and also mark your device as trusted to them.": "Verifying this user will mark their device as trusted, and also mark your device as trusted to them.",
+ "Waiting for partner to confirm...": "Waiting for partner to confirm...",
+ "Incoming Verification Request": "Incoming Verification Request",
+ "Integrations are disabled": "Integrations are disabled",
+ "Enable 'Manage Integrations' in Settings to do this.": "Enable 'Manage Integrations' in Settings to do this.",
+ "Integrations not allowed": "Integrations not allowed",
+ "Your Riot doesn't allow you to use an Integration Manager to do this. Please contact an admin.": "Your Riot doesn't allow you to use an Integration Manager to do this. Please contact an admin.",
"Failed to invite the following users to chat: %(csvUsers)s": "Failed to invite the following users to chat: %(csvUsers)s",
"We couldn't create your DM. Please check the users you want to invite and try again.": "We couldn't create your DM. Please check the users you want to invite and try again.",
+ "Something went wrong trying to invite the users.": "Something went wrong trying to invite the users.",
+ "We couldn't invite those users. Please check the users you want to invite and try again.": "We couldn't invite those users. Please check the users you want to invite and try again.",
"Failed to find the following users": "Failed to find the following users",
"The following users might not exist or are invalid, and cannot be invited: %(csvNames)s": "The following users might not exist or are invalid, and cannot be invited: %(csvNames)s",
"Recent Conversations": "Recent Conversations",
"Suggestions": "Suggestions",
+ "Recently Direct Messaged": "Recently Direct Messaged",
"Show more": "Show more",
"Direct Messages": "Direct Messages",
"If you can't find someone, ask them for their username, or share your username (%(userId)s) or
profile link.": "If you can't find someone, ask them for their username, or share your username (%(userId)s) or
profile link.",
"Go": "Go",
- "An error has occurred.": "An error has occurred.",
- "Verify this user to mark them as trusted. Trusting users gives you extra peace of mind when using end-to-end encrypted messages.": "Verify this user to mark them as trusted. Trusting users gives you extra peace of mind when using end-to-end encrypted messages.",
- "Verifying this user will mark their device as trusted, and also mark your device as trusted to them.": "Verifying this user will mark their device as trusted, and also mark your device as trusted to them.",
- "Waiting for partner to confirm...": "Waiting for partner to confirm...",
- "Incoming Verification Request": "Incoming Verification Request",
- "Integrations are disabled": "Integrations are disabled",
- "Enable 'Manage Integrations' in Settings to do this.": "Enable 'Manage Integrations' in Settings to do this.",
- "Integrations not allowed": "Integrations not allowed",
- "Your Riot doesn't allow you to use an Integration Manager to do this. Please contact an admin.": "Your Riot doesn't allow you to use an Integration Manager to do this. Please contact an admin.",
+ "If you can't find someone, ask them for their username (e.g. @user:server.com) or
share this room.": "If you can't find someone, ask them for their username (e.g. @user:server.com) or
share this room.",
"You added a new device '%(displayName)s', which is requesting encryption keys.": "You added a new device '%(displayName)s', which is requesting encryption keys.",
"Your unverified device '%(displayName)s' is requesting encryption keys.": "Your unverified device '%(displayName)s' is requesting encryption keys.",
"Start verification": "Start verification",
From 1a961358f0fe7956cefc246281960c9761f500ae Mon Sep 17 00:00:00 2001
From: Travis Ralston
Date: Thu, 16 Jan 2020 14:40:25 -0700
Subject: [PATCH 7/8] Don't show recents and suggestions for users already in
the room
---
src/components/views/dialogs/InviteDialog.js | 28 +++++++++++++++++---
1 file changed, 24 insertions(+), 4 deletions(-)
diff --git a/src/components/views/dialogs/InviteDialog.js b/src/components/views/dialogs/InviteDialog.js
index 7448b1a5a35..e176d3b105f 100644
--- a/src/components/views/dialogs/InviteDialog.js
+++ b/src/components/views/dialogs/InviteDialog.js
@@ -300,12 +300,24 @@ export default class InviteDialog extends React.PureComponent {
throw new Error("When using KIND_INVITE a roomId is required for an InviteDialog");
}
+ let alreadyInvited = [];
+ if (props.roomId) {
+ const room = MatrixClientPeg.get().getRoom(props.roomId);
+ if (!room) throw new Error("Room ID given to InviteDialog does not look like a room");
+ alreadyInvited = [
+ ...room.getMembersWithMembership('invite'),
+ ...room.getMembersWithMembership('join'),
+ ...room.getMembersWithMembership('ban'), // so we don't try to invite them
+ ].map(m => m.userId);
+ }
+
+
this.state = {
targets: [], // array of Member objects (see interface above)
filterText: "",
- recents: this._buildRecents(),
+ recents: this._buildRecents(alreadyInvited),
numRecentsShown: INITIAL_ROOMS_SHOWN,
- suggestions: this._buildSuggestions(),
+ suggestions: this._buildSuggestions(alreadyInvited),
numSuggestionsShown: INITIAL_ROOMS_SHOWN,
serverResultsMixin: [], // { user: DirectoryMember, userId: string }[], like recents and suggestions
threepidResultsMixin: [], // { user: ThreepidMember, userId: string}[], like recents and suggestions
@@ -320,10 +332,13 @@ export default class InviteDialog extends React.PureComponent {
this._editorRef = createRef();
}
- _buildRecents(): {userId: string, user: RoomMember, lastActive: number} {
+ _buildRecents(excludedTargetIds: string[]): {userId: string, user: RoomMember, lastActive: number} {
const rooms = DMRoomMap.shared().getUniqueRoomsWithIndividuals();
const recents = [];
for (const userId in rooms) {
+ // Filter out user IDs that are already in the room / should be excluded
+ if (excludedTargetIds.includes(userId)) continue;
+
const room = rooms[userId];
const member = room.getMember(userId);
if (!member) continue; // just skip people who don't have memberships for some reason
@@ -342,7 +357,7 @@ export default class InviteDialog extends React.PureComponent {
return recents;
}
- _buildSuggestions(): {userId: string, user: RoomMember} {
+ _buildSuggestions(excludedTargetIds: string[]): {userId: string, user: RoomMember} {
const maxConsideredMembers = 200;
const client = MatrixClientPeg.get();
const excludedUserIds = [client.getUserId(), SdkConfig.get()['welcomeUserId']];
@@ -359,6 +374,11 @@ export default class InviteDialog extends React.PureComponent {
const joinedMembers = room.getJoinedMembers().filter(u => !excludedUserIds.includes(u.userId));
for (const member of joinedMembers) {
+ // Filter out user IDs that are already in the room / should be excluded
+ if (excludedTargetIds.includes(member.userId)) {
+ continue;
+ }
+
if (!members[member.userId]) {
members[member.userId] = {
member: member,
From e42663fc627187cee9a59e65cd8ff1abccb95bf3 Mon Sep 17 00:00:00 2001
From: Travis Ralston
Date: Thu, 16 Jan 2020 14:45:17 -0700
Subject: [PATCH 8/8] Appease the linter
---
src/components/views/dialogs/InviteDialog.js | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/src/components/views/dialogs/InviteDialog.js b/src/components/views/dialogs/InviteDialog.js
index e176d3b105f..1b7a50c084b 100644
--- a/src/components/views/dialogs/InviteDialog.js
+++ b/src/components/views/dialogs/InviteDialog.js
@@ -509,7 +509,9 @@ export default class InviteDialog extends React.PureComponent {
console.error(err);
this.setState({
busy: false,
- errorText: _t("We couldn't invite those users. Please check the users you want to invite and try again."),
+ errorText: _t(
+ "We couldn't invite those users. Please check the users you want to invite and try again.",
+ ),
});
});
};