mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-01-06 22:40:14 -05:00
Removed staff with 404 URLs from internal link searches
closes https://linear.app/tryghost/issue/MOM-172 - staff users with no posts won't have a front-end URL so it can be confusing for them to appear in the internal link search results within the editor - added filtering for `/404/` in staff URLs so we don't list unlinkable staff members
This commit is contained in:
parent
6bc91a1e3b
commit
4165a93ec5
1 changed files with 10 additions and 2 deletions
|
@ -374,10 +374,18 @@ export default class KoenigLexicalEditor extends Component {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// only published posts/pages have URLs
|
// only published posts/pages and staff with posts have URLs
|
||||||
const filteredResults = [];
|
const filteredResults = [];
|
||||||
results.forEach((group) => {
|
results.forEach((group) => {
|
||||||
const items = (group.groupName === 'Posts' || group.groupName === 'Pages') ? group.options.filter(i => i.status === 'published') : group.options;
|
let items = group.options;
|
||||||
|
|
||||||
|
if (group.groupName === 'Posts' || group.groupName === 'Pages') {
|
||||||
|
items = items.filter(i => i.status === 'published');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (group.groupName === 'Staff') {
|
||||||
|
items = items.filter(i => !/\/404\//.test(i.url));
|
||||||
|
}
|
||||||
|
|
||||||
if (items.length === 0) {
|
if (items.length === 0) {
|
||||||
return;
|
return;
|
||||||
|
|
Loading…
Reference in a new issue