11const { Router } = require ( 'express' ) ;
2- const { getLoggedInUser, sendNotification } = require ( '../lib/helpers' ) ;
2+ const { getLoggedInUser } = require ( '../lib/helpers' ) ;
33const Comment = require ( '../entities/comment' ) ;
44const Plugin = require ( '../entities/plugin' ) ;
55const user = require ( '../entities/user' ) ;
6+ const sendEmail = require ( '../lib/sendEmail' ) ;
67
78const router = Router ( ) ;
89
@@ -130,7 +131,7 @@ router.post('/', async (req, res) => {
130131 updateVoteInPlugin ( vote , pluginId ) ;
131132 }
132133
133- sendNotification ( plugin . author_email , plugin . author , `Review update for your Acode plugin - ${ plugin . name } .` , getNotificationMessage ( ) ) ;
134+ sendEmail ( plugin . author_email , plugin . author , `Review update for your Acode plugin - ${ plugin . name } .` , getNotificationMessage ( ) ) ;
134135
135136 return ;
136137 }
@@ -152,7 +153,7 @@ router.post('/', async (req, res) => {
152153 res . send ( { message : 'Comment added' , comment : row } ) ;
153154 voteMessage = vote !== Comment . VOTE_NULL ? `${ loggedInUser . name } voted ${ Comment . getVoteString ( vote ) } ` : '' ;
154155 commentMessage = comment ? `${ loggedInUser . name } commented: ${ comment } ` : '' ;
155- sendNotification ( plugin . author_email , plugin . author , `New review for your Acode plugin - ${ plugin . name } .` , getNotificationMessage ( ) ) ;
156+ sendEmail ( plugin . author_email , plugin . author , `New review for your Acode plugin - ${ plugin . name } .` , getNotificationMessage ( ) ) ;
156157 } catch ( error ) {
157158 res . status ( 500 ) . send ( { error : error . message } ) ;
158159 }
@@ -239,7 +240,7 @@ router.post('/:commentId/reply', async (req, res) => {
239240
240241 try {
241242 const [ commenter ] = await user . get ( [ user . NAME , user . EMAIL ] , [ user . ID , comment . user_id ] ) ;
242- sendNotification ( commenter . email , commenter . name , `Reply to your comment on Acode plugin - ${ plugin . name } .` , `<p>${ reply } </p>` ) ;
243+ sendEmail ( commenter . email , commenter . name , `Reply to your comment on Acode plugin - ${ plugin . name } .` , `<p>${ reply } </p>` ) ;
243244 } catch ( error ) {
244245 // eslint-disable-next-line no-console
245246 console . error ( error ) ;
0 commit comments