summaryrefslogtreecommitdiff
path: root/src/services/note/reaction/create.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/services/note/reaction/create.ts')
-rw-r--r--src/services/note/reaction/create.ts16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/services/note/reaction/create.ts b/src/services/note/reaction/create.ts
index 6c0a852f34..897c816de8 100644
--- a/src/services/note/reaction/create.ts
+++ b/src/services/note/reaction/create.ts
@@ -18,17 +18,17 @@ export default async (user: User, note: Note, reaction?: string) => {
// TODO: cache
reaction = await toDbReaction(reaction, user.host);
- let record: NoteReaction;
+ let record: NoteReaction = {
+ id: genId(),
+ createdAt: new Date(),
+ noteId: note.id,
+ userId: user.id,
+ reaction
+ };
// Create reaction
try {
- record = await NoteReactions.save({
- id: genId(),
- createdAt: new Date(),
- noteId: note.id,
- userId: user.id,
- reaction
- });
+ await NoteReactions.insert(record);
} catch (e) {
if (isDuplicateKeyValueError(e)) {
record = await NoteReactions.findOneOrFail({