0
0

Fix hashtags contained in private notes are shown in trends (#5805)

* Update trend.ts

* Fix query

* Update create.ts

* Update create.ts

* Update trend.ts
This commit is contained in:
Acid Chicken (硫酸鶏) 2020-02-02 05:42:58 +09:00 committed by GitHub
parent 721531c5b5
commit c30960d6bf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 1 deletions

View File

@ -1,3 +1,4 @@
import { Brackets } from 'typeorm';
import define from '../../define';
import { fetchMeta } from '../../../../misc/fetch-meta';
import { Notes } from '../../../../models';
@ -59,6 +60,10 @@ export default define(meta, async () => {
const tagNotes = await Notes.createQueryBuilder('note')
.where(`note.createdAt > :date`, { date: new Date(now.getTime() - rangeA) })
.andWhere(new Brackets(qb => { qb
.where(`note.visibility = 'public'`)
.orWhere(`note.visibility = 'home'`);
}))
.andWhere(`note.tags != '{}'`)
.select(['note.tags', 'note.userId'])
.cache(60000) // 1 min

View File

@ -203,7 +203,9 @@ export default async (user: User, data: Option, silent = false) => new Promise<N
}
// ハッシュタグ更新
updateHashtags(user, tags);
if (data.visibility === 'public' || data.visibility === 'home') {
updateHashtags(user, tags);
}
// Increment notes count (user)
incNotesCountOfUser(user);