Compare commits

...

3 Commits

Author SHA1 Message Date
nek0 c8b4531513 linted 2021-10-16 17:50:28 +02:00
nek0 51f618309d expand shell nix with missing dependencies 2021-10-16 17:50:12 +02:00
nek0 8a7ba17c81 remove unwanted config options 2021-10-16 17:49:50 +02:00
4 changed files with 15 additions and 17 deletions

View File

@ -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"

View File

@ -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, mime-mail, mtl, network, opaleye , http-types, iproute, lib, libyaml, 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
mime-mail mtl opaleye postgresql-simple product-profunctors libyaml 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

View File

@ -1,25 +1,21 @@
{-# 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
{ settingsCurrency :: T.Text { settingsBlockRegistration :: Bool
, settingsDecimalPlaces :: Int
, settingsBlockRegistration :: Bool
} }
deriving (Show) deriving (Show)
instance ToDatabase Settings where instance ToDatabase Settings where
type InTuple Settings = (T.Text, Int, Bool) type InTuple Settings = Bool
toDatabase (Settings currency places reg) = (currency, places, reg) toDatabase (Settings reg) = reg
instance FromDatabase Settings where instance FromDatabase Settings where
type OutTuple Settings = (T.Text, Int, Bool) type OutTuple Settings = Bool
fromDatabase (currency, places, reg) = Settings currency places reg fromDatabase reg = Settings reg

View File

@ -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,12 +90,14 @@ 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
sendmail <- asks rsSendmailPath sendmailPath <- asks rsSendmailPath
liftIO $ do liftIO $ do
existence <- doesFileExist sendmail existence <- doesFileExist sendmailPath
if existence if existence
then then
renderSendMailCustom sendmail [] mail renderSendMailCustom sendmailPath [] mail
else else
print "Warning: sending notification failed: Sendmail not present!" print ("Warning: sending notification failed: Sendmail not present!"
:: String)