From 0a64d121d9a1345e4a5dd71686fd3be400558595 Mon Sep 17 00:00:00 2001 From: syuilo Date: Sun, 7 Feb 2021 10:43:34 +0900 Subject: Resolve #7149 --- src/services/note/create.ts | 5 +++-- src/services/update-hashtag.ts | 3 ++- 2 files changed, 5 insertions(+), 3 deletions(-) (limited to 'src/services') diff --git a/src/services/note/create.ts b/src/services/note/create.ts index f6593996e9..62ec92f2bc 100644 --- a/src/services/note/create.ts +++ b/src/services/note/create.ts @@ -33,6 +33,7 @@ import { addNoteToAntenna } from '../add-note-to-antenna'; import { countSameRenotes } from '../../misc/count-same-renotes'; import { deliverToRelays } from '../relay'; import { Channel } from '../../models/entities/channel'; +import { normalizeForSearch } from '../../misc/normalize-for-search'; type NotificationType = 'reply' | 'renote' | 'quote' | 'mention'; @@ -460,7 +461,7 @@ async function insertNote(user: User, data: Option, tags: string[], emojis: stri text: data.text, hasPoll: data.poll != null, cw: data.cw == null ? null : data.cw, - tags: tags.map(tag => tag.toLowerCase()), + tags: tags.map(tag => normalizeForSearch(tag)), emojis, userId: user.id, viaMobile: data.viaMobile!, @@ -547,7 +548,7 @@ function index(note: Note) { index: config.elasticsearch.index || 'misskey_note', id: note.id.toString(), body: { - text: note.text.toLowerCase(), + text: normalizeForSearch(note.text), userId: note.userId, userHost: note.userHost } diff --git a/src/services/update-hashtag.ts b/src/services/update-hashtag.ts index 1c67ef881e..1dcb582791 100644 --- a/src/services/update-hashtag.ts +++ b/src/services/update-hashtag.ts @@ -3,6 +3,7 @@ import { Hashtags, Users } from '../models'; import { hashtagChart } from './chart'; import { genId } from '../misc/gen-id'; import { Hashtag } from '../models/entities/hashtag'; +import { normalizeForSearch } from '../misc/normalize-for-search'; export async function updateHashtags(user: User, tags: string[]) { for (const tag of tags) { @@ -21,7 +22,7 @@ export async function updateUsertags(user: User, tags: string[]) { } export async function updateHashtag(user: User, tag: string, isUserAttached = false, inc = true) { - tag = tag.toLowerCase(); + tag = normalizeForSearch(tag); const index = await Hashtags.findOne({ name: tag }); -- cgit v1.3.1-freya