mirror of
https://github.com/discourse/discourse.git
synced 2026-08-08 12:08:12 -05:00
DEV: Replace without usage and update deprecation handling (#34971)
Refactor `recentSearches` logic in `search.js` to replace the deprecated `without` with a `filter` function. Update deprecation workflow to log usages of the `discourse.native-array-extensions.without` method.
This commit is contained in:
@@ -258,6 +258,10 @@ const DeprecationWorkflow = new DiscourseDeprecationWorkflow([
|
||||
handler: "log",
|
||||
matchId: "discourse.native-array-extensions.findBy",
|
||||
},
|
||||
{
|
||||
handler: "log",
|
||||
matchId: "discourse.native-array-extensions.without",
|
||||
},
|
||||
{
|
||||
handler: ["silence", "counter"],
|
||||
matchId: /^discourse\.native-array-extensions\..+$/,
|
||||
|
||||
@@ -272,7 +272,7 @@ export function updateRecentSearches(currentUser, term) {
|
||||
let recentSearches = Object.assign(currentUser.recent_searches || []);
|
||||
|
||||
if (recentSearches.includes(term)) {
|
||||
recentSearches = recentSearches.without(term);
|
||||
recentSearches = recentSearches.filter((item) => item !== term);
|
||||
} else if (recentSearches.length === MAX_RECENT_SEARCHES) {
|
||||
recentSearches.popObject();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user