v3: added comment likes, added votes/likes list view, added db migrations mechanism, updated project dependencies
All checks were successful
Build and Publish Docker Image / build-and-push (push) Successful in 42s
All checks were successful
Build and Publish Docker Image / build-and-push (push) Successful in 42s
This commit is contained in:
@@ -306,6 +306,38 @@ export function notifyDumpOwnerNewComment(
|
||||
);
|
||||
}
|
||||
|
||||
export function notifyCommentOwnerLike(
|
||||
likerId: string,
|
||||
commentId: string,
|
||||
): void {
|
||||
const likerRow = db.prepare(
|
||||
`SELECT username FROM users WHERE id = ?;`,
|
||||
).get(likerId) as { username: string } | undefined;
|
||||
|
||||
const commentRow = db.prepare(
|
||||
`SELECT c.user_id, c.dump_id, d.title as dump_title
|
||||
FROM comments c JOIN dumps d ON c.dump_id = d.id WHERE c.id = ?;`,
|
||||
).get(commentId) as
|
||||
| { user_id: string; dump_id: string; dump_title: string }
|
||||
| undefined;
|
||||
|
||||
if (!likerRow || !commentRow) return;
|
||||
if (likerId === commentRow.user_id) return; // no self-notification
|
||||
|
||||
createNotification(
|
||||
commentRow.user_id,
|
||||
"comment_liked",
|
||||
{
|
||||
likerId,
|
||||
likerUsername: likerRow.username,
|
||||
commentId,
|
||||
dumpId: commentRow.dump_id,
|
||||
dumpTitle: commentRow.dump_title,
|
||||
},
|
||||
`like:${commentId}:${likerId}`,
|
||||
);
|
||||
}
|
||||
|
||||
export function notifyPlaylistFollowersNewDump(
|
||||
playlistId: string,
|
||||
playlistTitle: string,
|
||||
|
||||
Reference in New Issue
Block a user