Send acceptance email only to applicants
This commit is contained in:
parent
72b3e25913
commit
47c6ebf9a1
|
@ -198,8 +198,9 @@ acceptApplication user = void $ do
|
|||
Nothing -> throwError $ "No valid application for " <> show user <> "!"
|
||||
Just email -> do
|
||||
time <- currentTime
|
||||
markAsAccepted user time
|
||||
void $ sendApplicationAcceptedEmail $ dBEmailEmail $ entityVal email
|
||||
applicationAccepted <- markAsAccepted user time
|
||||
when applicationAccepted $
|
||||
sendApplicationAcceptedEmail $ dBEmailEmail $ entityVal email
|
||||
|
||||
rejectApplication :: (MonadDB m, MonadTime m, MonadError GQLError m, MonadEmail m) => UserID -> m Unit
|
||||
rejectApplication user = void $ do
|
||||
|
|
|
@ -160,8 +160,8 @@ updateEmail user email secret = getExpireTime >>= \expires -> runQuery $ do
|
|||
, dBEmailVid = Just verificationId
|
||||
}
|
||||
|
||||
markAsAccepted :: MonadDB m => UserID -> Time -> m ()
|
||||
markAsAccepted userID time = runQuery $ update $ \user -> do
|
||||
markAsAccepted :: MonadDB m => UserID -> Time -> m Bool
|
||||
markAsAccepted userID time = fmap (> 0) $ runQuery $ updateCount $ \user -> do
|
||||
set user [DBUserAccepted =. just (val time)]
|
||||
where_ $ user ^. DBUserId ==. val (toDBKey userID) &&. isApplicant user
|
||||
|
||||
|
|
Loading…
Reference in New Issue