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 <> "!"
|
Nothing -> throwError $ "No valid application for " <> show user <> "!"
|
||||||
Just email -> do
|
Just email -> do
|
||||||
time <- currentTime
|
time <- currentTime
|
||||||
markAsAccepted user time
|
applicationAccepted <- markAsAccepted user time
|
||||||
void $ sendApplicationAcceptedEmail $ dBEmailEmail $ entityVal email
|
when applicationAccepted $
|
||||||
|
sendApplicationAcceptedEmail $ dBEmailEmail $ entityVal email
|
||||||
|
|
||||||
rejectApplication :: (MonadDB m, MonadTime m, MonadError GQLError m, MonadEmail m) => UserID -> m Unit
|
rejectApplication :: (MonadDB m, MonadTime m, MonadError GQLError m, MonadEmail m) => UserID -> m Unit
|
||||||
rejectApplication user = void $ do
|
rejectApplication user = void $ do
|
||||||
|
|
|
@ -160,8 +160,8 @@ updateEmail user email secret = getExpireTime >>= \expires -> runQuery $ do
|
||||||
, dBEmailVid = Just verificationId
|
, dBEmailVid = Just verificationId
|
||||||
}
|
}
|
||||||
|
|
||||||
markAsAccepted :: MonadDB m => UserID -> Time -> m ()
|
markAsAccepted :: MonadDB m => UserID -> Time -> m Bool
|
||||||
markAsAccepted userID time = runQuery $ update $ \user -> do
|
markAsAccepted userID time = fmap (> 0) $ runQuery $ updateCount $ \user -> do
|
||||||
set user [DBUserAccepted =. just (val time)]
|
set user [DBUserAccepted =. just (val time)]
|
||||||
where_ $ user ^. DBUserId ==. val (toDBKey userID) &&. isApplicant user
|
where_ $ user ^. DBUserId ==. val (toDBKey userID) &&. isApplicant user
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue