Compare commits
No commits in common. "c8b4531513d0a89a2ebfb0d4bbcad74f3dff0f0b" and "02bc5a89a7e64b13346d290580edcb341edb744f" have entirely different histories.
c8b4531513
...
02bc5a89a7
|
@ -8,5 +8,5 @@ listen_port: 8000
|
|||
#max_connections_per_client: 10
|
||||
currency: "meow"
|
||||
currency_fraction: 2
|
||||
#block_registration: false
|
||||
block_registration: false
|
||||
sendmail_path: "/run/wrappers/bin/sendmail"
|
||||
|
|
|
@ -31,7 +31,7 @@ let
|
|||
, base64-bytestring, bytestring, case-insensitive, clock
|
||||
, containers, directory, extra, haskell-gettext, hspec
|
||||
, hspec-discover, hspec-wai, hspec-wai-json, http-api-data
|
||||
, http-types, iproute, lib, libyaml, mime-mail, mtl, network, opaleye
|
||||
, http-types, iproute, lib, mime-mail, mtl, network, opaleye
|
||||
, optparse-applicative, postgresql-simple
|
||||
, postgresql-simple-migration, product-profunctors, profunctors
|
||||
, pureMD5, random-bytestring, resource-pool, servant, servant-rawm
|
||||
|
@ -48,7 +48,7 @@ let
|
|||
libraryHaskellDepends = [
|
||||
aeson base base16-bytestring base64-bytestring bytestring
|
||||
containers directory extra haskell-gettext http-api-data http-types
|
||||
libyaml mime-mail mtl opaleye postgresql-simple product-profunctors
|
||||
mime-mail mtl opaleye postgresql-simple product-profunctors
|
||||
profunctors pureMD5 random-bytestring servant servant-rawm
|
||||
servant-rawm-server servant-server stm text time wai wai-logger
|
||||
warp
|
||||
|
|
|
@ -1,21 +1,25 @@
|
|||
{-# LANGUAGE TypeFamilies #-}
|
||||
module Types.Settings where
|
||||
|
||||
import qualified Data.Text as T
|
||||
|
||||
import Classes
|
||||
|
||||
data Settings = Settings
|
||||
{ settingsBlockRegistration :: Bool
|
||||
{ settingsCurrency :: T.Text
|
||||
, settingsDecimalPlaces :: Int
|
||||
, settingsBlockRegistration :: Bool
|
||||
}
|
||||
deriving (Show)
|
||||
|
||||
instance ToDatabase Settings where
|
||||
|
||||
type InTuple Settings = Bool
|
||||
type InTuple Settings = (T.Text, Int, Bool)
|
||||
|
||||
toDatabase (Settings reg) = reg
|
||||
toDatabase (Settings currency places reg) = (currency, places, reg)
|
||||
|
||||
instance FromDatabase Settings where
|
||||
|
||||
type OutTuple Settings = Bool
|
||||
type OutTuple Settings = (T.Text, Int, Bool)
|
||||
|
||||
fromDatabase reg = Settings reg
|
||||
fromDatabase (currency, places, reg) = Settings currency places reg
|
||||
|
|
12
src/Util.hs
12
src/Util.hs
|
@ -63,7 +63,7 @@ sendUserNotification recipient subject message =
|
|||
, mailTo =
|
||||
[ Address
|
||||
(Just $ userDetailsIdent recipient)
|
||||
email
|
||||
(email)
|
||||
]
|
||||
, mailCc = []
|
||||
, mailBcc = []
|
||||
|
@ -90,14 +90,12 @@ sendAdminNotification subject message =
|
|||
-- TODO: Grab administrators from settings and actually send the mails to them
|
||||
return ()
|
||||
|
||||
sendNotification :: Mail -> MateHandler ()
|
||||
sendNotification mail = do
|
||||
sendmailPath <- asks rsSendmailPath
|
||||
sendmail <- asks rsSendmailPath
|
||||
liftIO $ do
|
||||
existence <- doesFileExist sendmailPath
|
||||
existence <- doesFileExist sendmail
|
||||
if existence
|
||||
then
|
||||
renderSendMailCustom sendmailPath [] mail
|
||||
renderSendMailCustom sendmail [] mail
|
||||
else
|
||||
print ("Warning: sending notification failed: Sendmail not present!"
|
||||
:: String)
|
||||
print "Warning: sending notification failed: Sendmail not present!"
|
||||
|
|
Loading…
Reference in a new issue