mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
Use filter order in group candidates list
This commit is contained in:
@ -1637,7 +1637,7 @@ export function getEntitiesList({ doFilter = false, doSort = true } = {}) {
|
|||||||
subEntities = entitiesFilter.applyFilters(subEntities, { clearScoreCache: false, tempOverrides: { [FILTER_TYPES.FOLDER]: FILTER_STATES.UNDEFINED }, clearFuzzySearchCaches: false });
|
subEntities = entitiesFilter.applyFilters(subEntities, { clearScoreCache: false, tempOverrides: { [FILTER_TYPES.FOLDER]: FILTER_STATES.UNDEFINED }, clearFuzzySearchCaches: false });
|
||||||
}
|
}
|
||||||
if (doSort) {
|
if (doSort) {
|
||||||
sortEntitiesList(subEntities);
|
sortEntitiesList(subEntities, false);
|
||||||
}
|
}
|
||||||
entity.entities = subEntities;
|
entity.entities = subEntities;
|
||||||
entity.hidden = subCount - subEntities.length;
|
entity.hidden = subCount - subEntities.length;
|
||||||
@ -1665,7 +1665,7 @@ export function getEntitiesList({ doFilter = false, doSort = true } = {}) {
|
|||||||
|
|
||||||
// Sort before returning if requested
|
// Sort before returning if requested
|
||||||
if (doSort) {
|
if (doSort) {
|
||||||
sortEntitiesList(entities);
|
sortEntitiesList(entities, false);
|
||||||
}
|
}
|
||||||
entitiesFilter.clearFuzzySearchCaches();
|
entitiesFilter.clearFuzzySearchCaches();
|
||||||
return entities;
|
return entities;
|
||||||
|
@ -1267,14 +1267,15 @@ function getGroupCharacters({ doFilter, onlyMembers } = {}) {
|
|||||||
.filter((x) => isGroupMember(thisGroup, x.avatar) == onlyMembers)
|
.filter((x) => isGroupMember(thisGroup, x.avatar) == onlyMembers)
|
||||||
.map((x, index) => ({ item: x, id: index, type: 'character' }));
|
.map((x, index) => ({ item: x, id: index, type: 'character' }));
|
||||||
|
|
||||||
|
if (doFilter) {
|
||||||
|
candidates = groupCandidatesFilter.applyFilters(candidates);
|
||||||
|
}
|
||||||
|
|
||||||
if (onlyMembers) {
|
if (onlyMembers) {
|
||||||
candidates.sort(sortMembersFn);
|
candidates.sort(sortMembersFn);
|
||||||
} else {
|
} else {
|
||||||
sortEntitiesList(candidates);
|
const useFilterOrder = doFilter && !!$('#rm_group_filter').val();
|
||||||
}
|
sortEntitiesList(candidates, useFilterOrder);
|
||||||
|
|
||||||
if (doFilter) {
|
|
||||||
candidates = groupCandidatesFilter.applyFilters(candidates);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return candidates;
|
return candidates;
|
||||||
|
@ -60,7 +60,6 @@ export {
|
|||||||
loadMovingUIState,
|
loadMovingUIState,
|
||||||
collapseNewlines,
|
collapseNewlines,
|
||||||
playMessageSound,
|
playMessageSound,
|
||||||
sortEntitiesList,
|
|
||||||
fixMarkdown,
|
fixMarkdown,
|
||||||
power_user,
|
power_user,
|
||||||
send_on_enter_options,
|
send_on_enter_options,
|
||||||
@ -2080,8 +2079,9 @@ const compareFunc = (first, second) => {
|
|||||||
/**
|
/**
|
||||||
* Sorts an array of entities based on the current sort settings
|
* Sorts an array of entities based on the current sort settings
|
||||||
* @param {any[]} entities An array of objects with an `item` property
|
* @param {any[]} entities An array of objects with an `item` property
|
||||||
|
* @param {boolean} forceSearch Whether to force search sorting
|
||||||
*/
|
*/
|
||||||
function sortEntitiesList(entities) {
|
export function sortEntitiesList(entities, forceSearch) {
|
||||||
if (power_user.sort_field == undefined || entities.length === 0) {
|
if (power_user.sort_field == undefined || entities.length === 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -2091,7 +2091,7 @@ function sortEntitiesList(entities) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const isSearch = $('#character_sort_order option[data-field="search"]').is(':selected');
|
const isSearch = forceSearch || $('#character_sort_order option[data-field="search"]').is(':selected');
|
||||||
|
|
||||||
entities.sort((a, b) => {
|
entities.sort((a, b) => {
|
||||||
// Sort tags/folders will always be at the top
|
// Sort tags/folders will always be at the top
|
||||||
|
Reference in New Issue
Block a user