From 9acf70c69360c83698d13174e67eafe423d9c776 Mon Sep 17 00:00:00 2001 From: Travis Ralston Date: Wed, 12 Feb 2020 01:55:20 +0000 Subject: [PATCH] Score user ID searches higher when they match nearly exactly --- src/components/views/dialogs/InviteDialog.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/components/views/dialogs/InviteDialog.js b/src/components/views/dialogs/InviteDialog.js index 8fec2437f6..caf94bb8de 100644 --- a/src/components/views/dialogs/InviteDialog.js +++ b/src/components/views/dialogs/InviteDialog.js @@ -482,6 +482,15 @@ export default class InviteDialog extends React.PureComponent { record.score += scoreBoost; } + // Last chance: if the user ID matches the search term, score it higher + if (this.state.filterText && this.state.filterText[0] === '@') { + for (const memberId in memberScores) { + if (memberId.startsWith(this.state.filterText)) { + memberScores[memberId] += 2; // arbitrary score bump + } + } + } + const members = Object.values(memberScores); members.sort((a, b) => { if (a.score === b.score) {