summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/models/entities/note.ts2
-rw-r--r--src/server/api/common/generate-visibility-query.ts2
-rw-r--r--src/server/api/endpoints/notes/mentions.ts4
3 files changed, 5 insertions, 3 deletions
diff --git a/src/models/entities/note.ts b/src/models/entities/note.ts
index 2be7d2b33c..9a85532637 100644
--- a/src/models/entities/note.ts
+++ b/src/models/entities/note.ts
@@ -7,6 +7,8 @@ import { Channel } from './channel';
@Entity()
@Index('IDX_NOTE_TAGS', { synchronize: false })
+@Index('IDX_NOTE_MENTIONS', { synchronize: false })
+@Index('IDX_NOTE_VISIBLE_USER_IDS', { synchronize: false })
export class Note {
@PrimaryColumn(id())
public id: string;
diff --git a/src/server/api/common/generate-visibility-query.ts b/src/server/api/common/generate-visibility-query.ts
index 72ed1c46ea..00a50f8211 100644
--- a/src/server/api/common/generate-visibility-query.ts
+++ b/src/server/api/common/generate-visibility-query.ts
@@ -22,7 +22,7 @@ export function generateVisibilityQuery(q: SelectQueryBuilder<any>, me?: { id: U
// または 自分自身
.orWhere('note.userId = :userId1', { userId1: me.id })
// または 自分宛て
- .orWhere(':userId2 = ANY(note.visibleUserIds)', { userId2: me.id })
+ .orWhere(`'{"${me.id}"}' <@ note.visibleUserIds`)
.orWhere(new Brackets(qb => { qb
// または フォロワー宛ての投稿であり、
.where('note.visibility = \'followers\'')
diff --git a/src/server/api/endpoints/notes/mentions.ts b/src/server/api/endpoints/notes/mentions.ts
index 34936c9b54..dddd08eee6 100644
--- a/src/server/api/endpoints/notes/mentions.ts
+++ b/src/server/api/endpoints/notes/mentions.ts
@@ -60,8 +60,8 @@ export default define(meta, async (ps, user) => {
const query = makePaginationQuery(Notes.createQueryBuilder('note'), ps.sinceId, ps.untilId)
.andWhere(new Brackets(qb => { qb
- .where(`:meId = ANY(note.mentions)`, { meId: user.id })
- .orWhere(`:meId = ANY(note.visibleUserIds)`, { meId: user.id });
+ .where(`'{"${user.id}"}' <@ note.mentions`)
+ .orWhere(`'{"${user.id}"}' <@ note.visibleUserIds`);
}))
.innerJoinAndSelect('note.user', 'user')
.leftJoinAndSelect('note.reply', 'reply')