Merge pull request #33817 from sokumon/fix-awesomebar

fix: if getpage sends 404 remove it from awesombar results
This commit is contained in:
Soham Kulkarni 2025-08-29 13:07:24 +05:30 committed by GitHub
commit 7938d0eaed
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 15 additions and 3 deletions

View file

@ -5,7 +5,7 @@ frappe.search.utils = {
setup_recent: function () {
this.recent = JSON.parse(frappe.boot.user.recent || "[]") || [];
},
results_to_hide: [],
get_recent_pages: function (keywords) {
if (keywords === null) keywords = "";
var me = this,
@ -105,10 +105,19 @@ frappe.search.utils = {
out.index = 80;
return out;
});
this.hide_results(options);
return options;
},
hide_results(options) {
if (this.results_to_hide.length == 0) return;
this.results_to_hide.forEach((v, i) => {
options.forEach((o, j) => {
if (o.value == v) {
options.splice(j, 1);
}
});
});
},
get_frequent_links() {
let options = [];
frappe.boot.frequently_visited_links.forEach((link) => {

View file

@ -39,6 +39,9 @@ frappe.views.pageview = {
}
callback();
},
error: function () {
frappe.search.utils.results_to_hide.push(name);
},
freeze: true,
});
}