Fixed memberlinks returning undefined in autocomplete. (#17385)

refs https://github.com/TryGhost/Ghost/pull/17327

- Added an additional condition to avoid the new memberLinks function
from returning undefined, which may lead to nothing being returned at
all in the autocomplete.

---

<!-- Leave the line below if you'd like GitHub Copilot to generate a
summary from your commit -->
<!--
copilot:summary
-->
### <samp>🤖 Generated by Copilot at 59d45a1</samp>

Improved `memberLinks` function in `koenig-lexical-editor.js` to support
optional links and fix a bug.
This commit is contained in:
Ronald Langeveld 2023-07-17 12:45:16 +02:00 committed by GitHub
parent ea2defb76c
commit d1e1dc3e79
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -264,8 +264,9 @@ export default class KoenigLexicalEditor extends Component {
}); });
const memberLinks = () => { const memberLinks = () => {
let links = [];
if (this.membersUtils.paidMembersEnabled) { if (this.membersUtils.paidMembersEnabled) {
return [ links = [
{ {
label: 'Paid signup', label: 'Paid signup',
value: this.config.getSiteUrl('/#/portal/signup') value: this.config.getSiteUrl('/#/portal/signup')
@ -275,6 +276,8 @@ export default class KoenigLexicalEditor extends Component {
value: this.config.getSiteUrl('/#/portal/account/plans') value: this.config.getSiteUrl('/#/portal/account/plans')
}]; }];
} }
return links;
}; };
return [...defaults, ...offersLinks, ...memberLinks()]; return [...defaults, ...offersLinks, ...memberLinks()];
}; };