flavours/glitch/reducers/compose.js: Fix toLowerCase TypeError

[Error] TypeError: e.toLowerCase is not a function. (In 'e.toLowerCase()', 'e.toLowerCase' is undefined)

Some added context: https://queer.hacktivis.me/notice/9g4OfhpIWQLNoZ3mLI
This commit is contained in:
Haelwenn (lanodan) Monnier 2019-02-21 21:52:48 +01:00
parent 4700e27d12
commit 3554d8fc2f
No known key found for this signature in database
GPG key ID: D5B7A8E43C997DEE

View file

@ -295,7 +295,7 @@ const expiresInFromExpiresAt = expires_at => {
const mergeLocalHashtagResults = (suggestions, prefix, tagHistory) => {
prefix = prefix.toLowerCase();
if (suggestions.length < 4) {
const localTags = tagHistory.filter(tag => tag.toLowerCase().startsWith(prefix) && !suggestions.some(suggestion => suggestion.type === 'hashtag' && suggestion.name.toLowerCase() === tag.toLowerCase()));
const localTags = tagHistory.filter(tag => tag && tag.toLowerCase().startsWith(prefix) && !suggestions.some(suggestion => suggestion.type === 'hashtag' && suggestion.name.toLowerCase() === tag.toLowerCase()));
return suggestions.concat(localTags.slice(0, 4 - suggestions.length).toJS().map(tag => ({ type: 'hashtag', name: tag })));
} else {
return suggestions;