Use filter order in group candidates list
| @@ -1637,7 +1637,7 @@ export function getEntitiesList({ doFilter = false, doSort = true } = {}) { | |||
| 1637 | subEntities = entitiesFilter.applyFilters(subEntities, { clearScoreCache: false, tempOverrides: { [FILTER_TYPES.FOLDER]: FILTER_STATES.UNDEFINED }, clearFuzzySearchCaches: false }); | 1637 | subEntities = entitiesFilter.applyFilters(subEntities, { clearScoreCache: false, tempOverrides: { [FILTER_TYPES.FOLDER]: FILTER_STATES.UNDEFINED }, clearFuzzySearchCaches: false }); |
| 1638 | } | 1638 | } |
| 1639 | if (doSort) { | 1639 | if (doSort) { |
| 1640 | sortEntitiesList(subEntities); | 1640 | sortEntitiesList(subEntities, false); |
| 1641 | } | 1641 | } |
| 1642 | entity.entities = subEntities; | 1642 | entity.entities = subEntities; |
| 1643 | entity.hidden = subCount - subEntities.length; | 1643 | entity.hidden = subCount - subEntities.length; |
| @@ -1665,7 +1665,7 @@ export function getEntitiesList({ doFilter = false, doSort = true } = {}) { | |||
| 1665 | 1665 | ||
| 1666 | // Sort before returning if requested | 1666 | // Sort before returning if requested |
| 1667 | if (doSort) { | 1667 | if (doSort) { |
| 1668 | sortEntitiesList(entities); | 1668 | sortEntitiesList(entities, false); |
| 1669 | } | 1669 | } |
| 1670 | entitiesFilter.clearFuzzySearchCaches(); | 1670 | entitiesFilter.clearFuzzySearchCaches(); |
| 1671 | return entities; | 1671 | return entities; |
| @@ -1267,14 +1267,15 @@ function getGroupCharacters({ doFilter, onlyMembers } = {}) { | |||
| 1267 | .filter((x) => isGroupMember(thisGroup, x.avatar) == onlyMembers) | 1267 | .filter((x) => isGroupMember(thisGroup, x.avatar) == onlyMembers) |
| 1268 | .map((x, index) => ({ item: x, id: index, type: 'character' })); | 1268 | .map((x, index) => ({ item: x, id: index, type: 'character' })); |
| 1269 | 1269 | ||
| 1270 | if (doFilter) { | ||
| 1271 | candidates = groupCandidatesFilter.applyFilters(candidates); | ||
| 1272 | } | ||
| 1273 | |||
| 1270 | if (onlyMembers) { | 1274 | if (onlyMembers) { |
| 1271 | candidates.sort(sortMembersFn); | 1275 | candidates.sort(sortMembersFn); |
| 1272 | } else { | 1276 | } else { |
| 1273 | sortEntitiesList(candidates); | 1277 | const useFilterOrder = doFilter && !!$('#rm_group_filter').val(); |
| 1274 | } | 1278 | sortEntitiesList(candidates, useFilterOrder); |
| 1275 | |||
| 1276 | if (doFilter) { | ||
| 1277 | candidates = groupCandidatesFilter.applyFilters(candidates); | ||
| 1278 | } | 1279 | } |
| 1279 | 1280 | ||
| 1280 | return candidates; | 1281 | return candidates; |
| @@ -60,7 +60,6 @@ export { | |||
| 60 | loadMovingUIState, | 60 | loadMovingUIState, |
| 61 | collapseNewlines, | 61 | collapseNewlines, |
| 62 | playMessageSound, | 62 | playMessageSound, |
| 63 | sortEntitiesList, | ||
| 64 | fixMarkdown, | 63 | fixMarkdown, |
| 65 | power_user, | 64 | power_user, |
| 66 | send_on_enter_options, | 65 | send_on_enter_options, |
| @@ -2080,8 +2079,9 @@ const compareFunc = (first, second) => { | |||
| 2080 | /** | 2079 | /** |
| 2081 | * Sorts an array of entities based on the current sort settings | 2080 | * Sorts an array of entities based on the current sort settings |
| 2082 | * @param {any[]} entities An array of objects with an `item` property | 2081 | * @param {any[]} entities An array of objects with an `item` property |
| 2082 | * @param {boolean} forceSearch Whether to force search sorting | ||
| 2083 | */ | 2083 | */ |
| 2084 | function sortEntitiesList(entities) { | 2084 | export function sortEntitiesList(entities, forceSearch) { |
| 2085 | if (power_user.sort_field == undefined || entities.length === 0) { | 2085 | if (power_user.sort_field == undefined || entities.length === 0) { |
| 2086 | return; | 2086 | return; |
| 2087 | } | 2087 | } |
| @@ -2091,7 +2091,7 @@ function sortEntitiesList(entities) { | |||
| 2091 | return; | 2091 | return; |
| 2092 | } | 2092 | } |
| 2093 | 2093 | ||
| 2094 | const isSearch = $('#character_sort_order option[data-field="search"]').is(':selected'); | 2094 | const isSearch = forceSearch || $('#character_sort_order option[data-field="search"]').is(':selected'); |
| 2095 | 2095 | ||
| 2096 | entities.sort((a, b) => { | 2096 | entities.sort((a, b) => { |
| 2097 | // Sort tags/folders will always be at the top | 2097 | // Sort tags/folders will always be at the top |