mirror of
https://git.joinsharkey.org/Sharkey/Sharkey.git
synced 2024-11-30 07:03:08 +02:00
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:
parent
721531c5b5
commit
c30960d6bf
2 changed files with 8 additions and 1 deletions
|
@ -1,3 +1,4 @@
|
||||||
|
import { Brackets } from 'typeorm';
|
||||||
import define from '../../define';
|
import define from '../../define';
|
||||||
import { fetchMeta } from '../../../../misc/fetch-meta';
|
import { fetchMeta } from '../../../../misc/fetch-meta';
|
||||||
import { Notes } from '../../../../models';
|
import { Notes } from '../../../../models';
|
||||||
|
@ -59,6 +60,10 @@ export default define(meta, async () => {
|
||||||
|
|
||||||
const tagNotes = await Notes.createQueryBuilder('note')
|
const tagNotes = await Notes.createQueryBuilder('note')
|
||||||
.where(`note.createdAt > :date`, { date: new Date(now.getTime() - rangeA) })
|
.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 != '{}'`)
|
.andWhere(`note.tags != '{}'`)
|
||||||
.select(['note.tags', 'note.userId'])
|
.select(['note.tags', 'note.userId'])
|
||||||
.cache(60000) // 1 min
|
.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)
|
// Increment notes count (user)
|
||||||
incNotesCountOfUser(user);
|
incNotesCountOfUser(user);
|
||||||
|
|
Loading…
Reference in a new issue