From 4737dc6da91c1b3f8334f241309784321f9027eb Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Sun, 7 Jun 2020 15:30:21 -0500 Subject: [PATCH] Compose: Fix NSFW tag error on CW --- app/soapbox/actions/compose.js | 4 +++- app/soapbox/features/compose/components/upload.js | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/app/soapbox/actions/compose.js b/app/soapbox/actions/compose.js index ff8f765f0..28442f994 100644 --- a/app/soapbox/actions/compose.js +++ b/app/soapbox/actions/compose.js @@ -457,7 +457,9 @@ function insertIntoTagHistory(recognizedTags, text) { const state = getState(); const oldHistory = state.getIn(['compose', 'tagHistory']); const me = state.get('me'); - const names = recognizedTags.map(tag => text.match(new RegExp(`#${tag.name}`, 'i'))[0].slice(1)); + const names = recognizedTags + .filter(tag => text.match(new RegExp(`#${tag.name}`, 'i'))) + .map(tag => tag.name); const intersectedOldHistory = oldHistory.filter(name => names.findIndex(newName => newName.toLowerCase() === name.toLowerCase()) === -1); names.push(...intersectedOldHistory.toJS()); diff --git a/app/soapbox/features/compose/components/upload.js b/app/soapbox/features/compose/components/upload.js index fcfc5e0db..d640823ff 100644 --- a/app/soapbox/features/compose/components/upload.js +++ b/app/soapbox/features/compose/components/upload.js @@ -27,7 +27,7 @@ class Upload extends ImmutablePureComponent { onDescriptionChange: PropTypes.func.isRequired, onOpenFocalPoint: PropTypes.func.isRequired, onSubmit: PropTypes.func.isRequired, - features: PropTypes.map, + features: PropTypes.object, }; state = {