mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-25 20:03:12 +03:00
🐛 Fixed /unsplash search term
not including all words
no issue - card definitions allow multiple params split by spaces in /menu commands but that meant for search terms that included spaces only the first word was being captured - updated the param handling so the last param specified includes all remaining words in the slash command
This commit is contained in:
parent
0f517ad4e6
commit
7ff73753c8
@ -201,9 +201,16 @@ export default class KoenigSlashMenuComponent extends Component {
|
|||||||
let payload = Object.assign({}, item.payload);
|
let payload = Object.assign({}, item.payload);
|
||||||
|
|
||||||
// params are order-dependent and listed in CARD_MENU for each card
|
// params are order-dependent and listed in CARD_MENU for each card
|
||||||
|
// last param will include all remaining text including spaces
|
||||||
if (!isEmpty(item.params) && !isEmpty(params)) {
|
if (!isEmpty(item.params) && !isEmpty(params)) {
|
||||||
item.params.forEach((param, i) => {
|
item.params.forEach((param, i) => {
|
||||||
payload[param] = params[i];
|
let value = params[i];
|
||||||
|
|
||||||
|
if (i === item.params.length - 1) {
|
||||||
|
value = params.slice(i).join(' ');
|
||||||
|
}
|
||||||
|
|
||||||
|
payload[param] = value;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user