Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions web_src/js/features/comp/SearchUserBox.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,12 @@ const {appSubUrl} = window.config;
const looksLikeEmailAddressCheck = /^\S+@\S+$/;

export function initCompSearchUserBox() {
const $searchUserBox = $('#search-user-box');
const allowEmailInput = $searchUserBox.attr('data-allow-email') === 'true';
const allowEmailDescription = $searchUserBox.attr('data-allow-email-description');
const searchUserBox = document.getElementById('search-user-box');
if (!searchUserBox) return;

const $searchUserBox = $(searchUserBox);
const allowEmailInput = searchUserBox.getAttribute('data-allow-email') === 'true';
const allowEmailDescription = searchUserBox.getAttribute('data-allow-email-description') ?? undefined;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch, we need to be aware that getAttribute returns null when not present, while jQuery returned undefined.

$searchUserBox.search({
minCharacters: 2,
apiSettings: {
Expand Down