Skip to content

Commit

Permalink
Merge pull request #31775 from FitseTLT/fix-recently-used-tags-bug
Browse files Browse the repository at this point in the history
fix:31760 recently used tags issue
  • Loading branch information
bondydaa authored Nov 27, 2023
2 parents bb82910 + 48a2b46 commit 10310d8
Showing 1 changed file with 15 additions and 14 deletions.
29 changes: 15 additions & 14 deletions src/libs/OptionsListUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -910,24 +910,19 @@ function getCategoryListSections(categories, recentlyUsedCategories, selectedOpt
* @returns {Array<Object>}
*/
function getTagsOptions(tags) {
return _.map(tags, (tag) => {
// This is to remove unnecessary escaping backslash in tag name sent from backend.
const tagName = tag.name && tag.name.replace(/\\{1,2}:/g, ':');

return {
text: tagName,
keyForList: tagName,
searchText: tagName,
tooltipText: tagName,
isDisabled: !tag.enabled,
};
});
return _.map(tags, (tag) => ({
text: tag.name,
keyForList: tag.name,
searchText: tag.name,
tooltipText: tag.name,
isDisabled: !tag.enabled,
}));
}

/**
* Build the section list for tags
*
* @param {Object[]} tags
* @param {Object[]} rawTags
* @param {String} tags[].name
* @param {Boolean} tags[].enabled
* @param {String[]} recentlyUsedTags
Expand All @@ -937,8 +932,14 @@ function getTagsOptions(tags) {
* @param {Number} maxRecentReportsToShow
* @returns {Array<Object>}
*/
function getTagListSections(tags, recentlyUsedTags, selectedOptions, searchInputValue, maxRecentReportsToShow) {
function getTagListSections(rawTags, recentlyUsedTags, selectedOptions, searchInputValue, maxRecentReportsToShow) {
const tagSections = [];
const tags = _.map(rawTags, (tag) => {
// This is to remove unnecessary escaping backslash in tag name sent from backend.
const tagName = tag.name && tag.name.replace(/\\{1,2}:/g, ':');

return {...tag, name: tagName};
});
const sortedTags = sortTags(tags);
const enabledTags = _.filter(sortedTags, (tag) => tag.enabled);
const numberOfTags = _.size(enabledTags);
Expand Down

0 comments on commit 10310d8

Please sign in to comment.