Score user ID searches higher when they match nearly exactly
This commit is contained in:
parent
720450f372
commit
9acf70c693
1 changed files with 9 additions and 0 deletions
|
@ -482,6 +482,15 @@ export default class InviteDialog extends React.PureComponent {
|
||||||
record.score += scoreBoost;
|
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);
|
const members = Object.values(memberScores);
|
||||||
members.sort((a, b) => {
|
members.sort((a, b) => {
|
||||||
if (a.score === b.score) {
|
if (a.score === b.score) {
|
||||||
|
|
Loading…
Reference in a new issue