From 0df086e07f5186131f96cebe61a57dd145bb3f95 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Wolfgang=20Hu=C3=9F?= Date: Wed, 4 Sep 2019 15:38:28 +0200 Subject: [PATCH] Rename variables --- .../migration/neo4j/contributions/contributions.cql | 8 ++++---- webapp/components/Editor/Editor.vue | 5 +++-- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/deployment/legacy-migration/maintenance-worker/migration/neo4j/contributions/contributions.cql b/deployment/legacy-migration/maintenance-worker/migration/neo4j/contributions/contributions.cql index e3ec9ad44..8207b5a97 100644 --- a/deployment/legacy-migration/maintenance-worker/migration/neo4j/contributions/contributions.cql +++ b/deployment/legacy-migration/maintenance-worker/migration/neo4j/contributions/contributions.cql @@ -147,10 +147,10 @@ MATCH (c:Category {id: categoryId}) MERGE (p)-[:CATEGORIZED]->(c) WITH p, post.tags AS tags UNWIND tags AS tag -WITH '[^\\p{L}0-9]' as regexMatchAllNonUnicodeOrDigits -WITH apoc.text.replace(tag, regexMatchAllNonUnicodeOrDigits, '') as tagNoSpacesAllowed -WITH '^((\\p{L}+[\\p{L}0-9]*)|([0-9]+\\p{L}+[\\p{L}0-9]*))$' as regexHashtagMustNotIncludeOnlyDigits -CALL apoc.when(tagNoSpacesAllowed =~ regexHashtagMustNotIncludeOnlyDigits, 'RETURN tagNoSpacesAllowed', '', {tagNoSpacesAllowed: tagNoSpacesAllowed}) +WITH '[^\\p{L}0-9]' as regexMatchAllNonUnicodeLettersOrDigits +WITH apoc.text.replace(tag, regexMatchAllNonUnicodeLettersOrDigits, '') as tagNoSpacesAllowed +WITH '^((\\p{L}+[\\p{L}0-9]*)|([0-9]+\\p{L}+[\\p{L}0-9]*))$' as regexHashtagMustIncludeOnlyUnicodeLettersOrDigitsButNotOnlyDigits +CALL apoc.when(tagNoSpacesAllowed =~ regexHashtagMustIncludeOnlyUnicodeLettersOrDigitsButNotOnlyDigits, 'RETURN tagNoSpacesAllowed', '', {tagNoSpacesAllowed: tagNoSpacesAllowed}) YIELD value as validated WHERE validated.tagNoSpacesAllowed IS NOT NULL MERGE (t:Tag { id: validated.tagNoSpacesAllowed, disabled: false, deleted: false }) diff --git a/webapp/components/Editor/Editor.vue b/webapp/components/Editor/Editor.vue index 25080737a..75f550c2a 100644 --- a/webapp/components/Editor/Editor.vue +++ b/webapp/components/Editor/Editor.vue @@ -215,8 +215,9 @@ export default { }, sanitizeQuery(query) { if (this.suggestionType === HASHTAG) { - const regexMatchAllNonUnicodeOrDigits = build('[^\\pL0-9]') - query = replace(query, regexMatchAllNonUnicodeOrDigits, '', 'all') + // remove all non unicode letters and non digits + const regexMatchAllNonUnicodeLettersOrDigits = build('[^\\pL0-9]') + query = replace(query, regexMatchAllNonUnicodeLettersOrDigits, '', 'all') // if the query is only made of digits, make it empty return query.replace(/[0-9]/gm, '') === '' ? '' : query }