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