Merge pull request #33817 from sokumon/fix-awesomebar
fix: if getpage sends 404 remove it from awesombar results
This commit is contained in:
commit
7938d0eaed
2 changed files with 15 additions and 3 deletions
|
|
@ -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) => {
|
||||
|
|
|
|||
|
|
@ -39,6 +39,9 @@ frappe.views.pageview = {
|
|||
}
|
||||
callback();
|
||||
},
|
||||
error: function () {
|
||||
frappe.search.utils.results_to_hide.push(name);
|
||||
},
|
||||
freeze: true,
|
||||
});
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue