Skip to content
Snippets Groups Projects
Unverified Commit c30960d6 authored by Acid Chicken (硫酸鶏)'s avatar Acid Chicken (硫酸鶏) Committed by GitHub
Browse files

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
parent 721531c5
No related branches found
No related tags found
No related merge requests found
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
......
......@@ -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);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment