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
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};
Comment thread
luacmartins marked this conversation as resolved.
});
const sortedTags = sortTags(tags);
const enabledTags = _.filter(sortedTags, (tag) => tag.enabled);
const numberOfTags = _.size(enabledTags);
Expand Down