forked from rDrama/rDrama
1
0
Fork 0

simplify globalUsers and globalGroups

master
Aevann 2024-03-07 18:38:09 +02:00
parent ffaeaea70b
commit 6ed0c57951
3 changed files with 6 additions and 14 deletions

View File

@ -169,7 +169,7 @@ function update_inline_emoji_modal(event)
// Do the search (and do something with it)
const resultSet = groupsSearchDictionary.completeSearch(current_word.substring(1));
const found = globalGroups.filter(i => resultSet.has(i.name));
const found = globalGroups.filter(i => resultSet.has(i));
populate_inline_group_modal(found, event.target);
});
@ -188,7 +188,7 @@ function update_inline_emoji_modal(event)
// Do the search (and do something with it)
const resultSet = usersSearchDictionary.completeSearch(current_word.substring(1));
const found = globalUsers.filter(i => resultSet.has(i.name));
const found = globalUsers.filter(i => resultSet.has(i));
populate_inline_user_modal(found, event.target);
});

View File

@ -58,9 +58,7 @@ function makeGroupsSearchDictionary() {
{
const group = groups[i];
groupsSearchDictionary.updateTag(group, group);
globalGroups.push({
name: group,
});
globalGroups.push(group);
}
groupSearchDictionaryState = "ready";
@ -105,10 +103,8 @@ function populate_inline_group_modal(results, textbox)
const MAXXX = 50;
// Not sure why the results is a Set... but oh well
let i = 0;
for (let group of results)
for (let name of results)
{
let name = group.name
if (i++ > MAXXX) return i;
let group_option = document.createElement("div");
group_option.className = "inline-modal-option group-option " + (i === 1 ? "selected" : "");

View File

@ -58,9 +58,7 @@ function makeUsersSearchDictionary() {
{
const user = users[i];
usersSearchDictionary.updateTag(user, user);
globalUsers.push({
name: user,
});
globalUsers.push(user);
}
userSearchDictionaryState = "ready";
@ -105,10 +103,8 @@ function populate_inline_user_modal(results, textbox)
const MAXXX = 50;
// Not sure why the results is a Set... but oh well
let i = 0;
for (let user of results)
for (let name of results)
{
let name = user.name
if (i++ > MAXXX) return i;
let user_option = document.createElement("div");
user_option.className = "inline-modal-option user-option " + (i === 1 ? "selected" : "");