Search for users on paste (#11304)
Signed-off-by: Peter Scheu <peter.scheu@aceart.de>
This commit is contained in:
@@ -870,11 +870,17 @@ export default class InviteDialog extends React.PureComponent<Props, IInviteDial
|
||||
return;
|
||||
}
|
||||
|
||||
const text = e.clipboardData.getData("text");
|
||||
const potentialAddresses = this.parseFilter(text);
|
||||
// one search term which is not a mxid or email address
|
||||
if (potentialAddresses.length === 1 && !potentialAddresses[0].includes("@")) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Prevent the text being pasted into the input
|
||||
e.preventDefault();
|
||||
|
||||
// Process it as a list of addresses to add instead
|
||||
const text = e.clipboardData.getData("text");
|
||||
const possibleMembers = [
|
||||
// If we can avoid hitting the profile endpoint, we should.
|
||||
...this.state.recents,
|
||||
@@ -889,8 +895,6 @@ export default class InviteDialog extends React.PureComponent<Props, IInviteDial
|
||||
// Will be displayed as filter text to provide feedback.
|
||||
const unableToAddMore: string[] = [];
|
||||
|
||||
const potentialAddresses = this.parseFilter(text);
|
||||
|
||||
for (const address of potentialAddresses) {
|
||||
const member = possibleMembers.find((m) => m.userId === address);
|
||||
if (member) {
|
||||
|
||||
Reference in New Issue
Block a user