Make autocomplete aware of anonymous usernames.
This commit is contained in:
parent
6b8c4e19cc
commit
1493b2c96b
|
@ -30,11 +30,16 @@ export class AutocompleteFeature extends Component<Props, State> {
|
||||||
);
|
);
|
||||||
|
|
||||||
// Get all the usernames on the page without their leading @s, and get
|
// Get all the usernames on the page without their leading @s, and get
|
||||||
// all the username from the saved user labels.
|
// all the usernames from the saved user labels.
|
||||||
|
const usernameElements = querySelectorAll<HTMLElement>('.link-user');
|
||||||
const usernames = [
|
const usernames = [
|
||||||
...querySelectorAll('.link-user').map((value) =>
|
...usernameElements.map((value) => {
|
||||||
value.textContent!.replace(/^@/, '').toLowerCase(),
|
if (props.settings.features.anonymizeUsernames) {
|
||||||
),
|
return (value.dataset.trxUsername ?? '<unknown>').toLowerCase();
|
||||||
|
}
|
||||||
|
|
||||||
|
return value.textContent!.replace(/^@/, '').toLowerCase();
|
||||||
|
}),
|
||||||
...props.settings.data.userLabels.map((value) => value.username),
|
...props.settings.data.userLabels.map((value) => value.username),
|
||||||
].sort((a, b) => a.localeCompare(b));
|
].sort((a, b) => a.localeCompare(b));
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue