Compare commits
5 Commits
38ecd78db1
...
1b8c913c58
Author | SHA1 | Date |
---|---|---|
nek0 | 1b8c913c58 | |
nek0 | d67f517e04 | |
sand20 | e7069228a8 | |
Astro | 63191180a5 | |
Astro | 29a34b4759 |
|
@ -113,7 +113,7 @@ notifyUser user bev quant price master = do
|
||||||
"VERDAMMT NOCHMAL!!!"
|
"VERDAMMT NOCHMAL!!!"
|
||||||
else
|
else
|
||||||
return ""
|
return ""
|
||||||
liftIO $ sendMail email "Einkauf beim Matematen"
|
liftIO $ sendMail master email "Einkauf beim Matematen"
|
||||||
[lt|
|
[lt|
|
||||||
Hallo #{userIdent user},
|
Hallo #{userIdent user},
|
||||||
|
|
||||||
|
|
|
@ -191,7 +191,7 @@ checkAlert bId oldamount = do
|
||||||
master <- getYesod
|
master <- getYesod
|
||||||
let tos = appEmail $ appSettings master
|
let tos = appEmail $ appSettings master
|
||||||
mapM_ (\to ->
|
mapM_ (\to ->
|
||||||
liftIO $ sendMail to "Niedriger Bestand"
|
liftIO $ sendMail master to "Niedriger Bestand"
|
||||||
[stext|
|
[stext|
|
||||||
Hallo,
|
Hallo,
|
||||||
|
|
||||||
|
@ -204,16 +204,18 @@ Dein Matemat
|
||||||
|]
|
|]
|
||||||
) tos
|
) tos
|
||||||
|
|
||||||
sendMail :: MonadIO m => Text -> Text -> TL.Text -> m ()
|
sendMail :: MonadIO m => App -> Text -> Text -> TL.Text -> m ()
|
||||||
sendMail to subject body =
|
sendMail master to subject body = liftIO $ do
|
||||||
liftIO $ renderSendMail
|
let sendmailLocation = appSendmailLocation $ appSettings master
|
||||||
|
fromMail = appFromMail $ appSettings master
|
||||||
|
renderSendMailCustom sendmailLocation []
|
||||||
Mail
|
Mail
|
||||||
{ mailFrom = Address Nothing "noreply"
|
{ mailFrom = Address Nothing "noreply"
|
||||||
, mailTo = [Address Nothing to]
|
, mailTo = [Address Nothing to]
|
||||||
, mailCc = []
|
, mailCc = []
|
||||||
, mailBcc = []
|
, mailBcc = []
|
||||||
, mailHeaders = [("Subject", subject),
|
, mailHeaders = [("Subject", subject),
|
||||||
("List-Id", "\"Matemat\" <matemat@matemat.hq.c3d2.de>")]
|
("List-Id", "\"Matemat\" <"<> (fromString fromMail) <>">")]
|
||||||
, mailParts =[[Part
|
, mailParts =[[Part
|
||||||
{ partType = "text/plain; charset=utf-8"
|
{ partType = "text/plain; charset=utf-8"
|
||||||
, partEncoding = None
|
, partEncoding = None
|
||||||
|
|
|
@ -119,7 +119,8 @@ postModifyUserR uId =
|
||||||
, UserAvatar =. userConfAvatar uc
|
, UserAvatar =. userConfAvatar uc
|
||||||
, UserPin =. userConfPIN uc
|
, UserPin =. userConfPIN uc
|
||||||
]
|
]
|
||||||
liftIO $ notify user (userConfEmail uc)
|
master <- getYesod
|
||||||
|
liftIO $ notify user (userConfEmail uc) master
|
||||||
handleBarcodes (Left uId) (fromMaybe [] $ userConfBarcode uc)
|
handleBarcodes (Left uId) (fromMaybe [] $ userConfBarcode uc)
|
||||||
setMessageI MsgUserEdited
|
setMessageI MsgUserEdited
|
||||||
redirect $ SelectR uId
|
redirect $ SelectR uId
|
||||||
|
@ -144,12 +145,13 @@ modifyUserForm user bs = UserConf
|
||||||
ents <- runDB $ selectList [] [Asc AvatarIdent]
|
ents <- runDB $ selectList [] [Asc AvatarIdent]
|
||||||
optionsPairs $ map (\ent -> ((avatarIdent $ entityVal ent), entityKey ent)) ents
|
optionsPairs $ map (\ent -> ((avatarIdent $ entityVal ent), entityKey ent)) ents
|
||||||
|
|
||||||
notify :: User -> Maybe Text -> IO ()
|
notify :: User -> Maybe Text -> App -> IO ()
|
||||||
notify user email
|
notify user email master
|
||||||
| (userEmail user) == email = return ()
|
| (userEmail user) == email = return ()
|
||||||
| otherwise = case userEmail user of
|
| otherwise = case userEmail user of
|
||||||
Just address -> sendMail address "Profiländerung"
|
Just address ->
|
||||||
[stext|
|
sendMail master address "Profiländerung"
|
||||||
|
[stext|
|
||||||
Hallo #{userIdent user},
|
Hallo #{userIdent user},
|
||||||
|
|
||||||
deine Profileinstellungen wurden geändert.
|
deine Profileinstellungen wurden geändert.
|
||||||
|
@ -158,5 +160,5 @@ Nur damit du Bescheid weißt.
|
||||||
Grüße,
|
Grüße,
|
||||||
|
|
||||||
der Matemat
|
der Matemat
|
||||||
|]
|
|]
|
||||||
Nothing -> return ()
|
Nothing -> return ()
|
||||||
|
|
|
@ -76,7 +76,7 @@ transferForm = areq currencyField (bfs MsgValue) (Just 0)
|
||||||
notify :: User -> User -> Int -> App -> IO ()
|
notify :: User -> User -> Int -> App -> IO ()
|
||||||
notify sender rcpt amount master = do
|
notify sender rcpt amount master = do
|
||||||
when (isJust $ userEmail sender) $
|
when (isJust $ userEmail sender) $
|
||||||
liftIO $ sendMail (fromJust $ userEmail sender) "Guthabentransfer beim Matematen"
|
liftIO $ sendMail master (fromJust $ userEmail sender) "Guthabentransfer beim Matematen"
|
||||||
[stext|
|
[stext|
|
||||||
Hallo #{userIdent sender}
|
Hallo #{userIdent sender}
|
||||||
|
|
||||||
|
@ -87,7 +87,7 @@ Viele Grüße,
|
||||||
Dein Matemat
|
Dein Matemat
|
||||||
|]
|
|]
|
||||||
when (isJust $ userEmail rcpt) $
|
when (isJust $ userEmail rcpt) $
|
||||||
liftIO $ sendMail (fromJust $ userEmail rcpt) "Guthabentransfer eingetroffen"
|
liftIO $ sendMail master (fromJust $ userEmail rcpt) "Guthabentransfer eingetroffen"
|
||||||
[stext|
|
[stext|
|
||||||
Hallo #{userIdent rcpt}
|
Hallo #{userIdent rcpt}
|
||||||
|
|
||||||
|
|
5
Model.hs
5
Model.hs
|
@ -13,6 +13,11 @@
|
||||||
--
|
--
|
||||||
-- You should have received a copy of the GNU Affero General Public License
|
-- You should have received a copy of the GNU Affero General Public License
|
||||||
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
|
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
{-# LANGUAGE DerivingStrategies #-}
|
||||||
|
{-# LANGUAGE StandaloneDeriving #-}
|
||||||
|
{-# LANGUAGE UndecidableInstances #-}
|
||||||
|
{-# LANGUAGE DataKinds #-}
|
||||||
|
{-# LANGUAGE FlexibleInstances #-}
|
||||||
module Model where
|
module Model where
|
||||||
|
|
||||||
import ClassyPrelude.Yesod
|
import ClassyPrelude.Yesod
|
||||||
|
|
|
@ -80,6 +80,10 @@ data AppSettings = AppSettings
|
||||||
-- ^ Block user creation
|
-- ^ Block user creation
|
||||||
, appAdminCreds :: Maybe Login
|
, appAdminCreds :: Maybe Login
|
||||||
-- ^ optional admin credentials
|
-- ^ optional admin credentials
|
||||||
|
, appSendmailLocation :: FilePath
|
||||||
|
-- ^ location of system's sendmail command
|
||||||
|
, appFromMail :: String
|
||||||
|
-- ^ Email address from which the yammat appears to send emails
|
||||||
}
|
}
|
||||||
|
|
||||||
data Login = Login
|
data Login = Login
|
||||||
|
@ -125,6 +129,9 @@ instance FromJSON AppSettings where
|
||||||
|
|
||||||
appAdminCreds <- o .:? "credentials"
|
appAdminCreds <- o .:? "credentials"
|
||||||
|
|
||||||
|
appSendmailLocation <- o .: "sendmail-location"
|
||||||
|
appFromMail <- o .: "from-mail"
|
||||||
|
|
||||||
return AppSettings {..}
|
return AppSettings {..}
|
||||||
|
|
||||||
-- | Settings for 'widgetFile', such as which template languages to support and
|
-- | Settings for 'widgetFile', such as which template languages to support and
|
||||||
|
|
|
@ -36,6 +36,9 @@ copyright_link: "https://github.com/nek0/yammat"
|
||||||
|
|
||||||
block_users: false
|
block_users: false
|
||||||
|
|
||||||
|
sendmail-location: "/usr/sbin/sendmail"
|
||||||
|
from-mail: "matemat@matemat.hq.c3d2.de"
|
||||||
|
|
||||||
# optional administrative credentials.
|
# optional administrative credentials.
|
||||||
# credentials:
|
# credentials:
|
||||||
# login: "admin"
|
# login: "admin"
|
||||||
|
|
|
@ -16,8 +16,9 @@
|
||||||
|
|
||||||
checks = packages;
|
checks = packages;
|
||||||
|
|
||||||
hydraJobs = forSystems (system:
|
hydraJobs =
|
||||||
let
|
let
|
||||||
|
system = builtins.head systems;
|
||||||
pkgs = nixpkgs.legacyPackages.${system};
|
pkgs = nixpkgs.legacyPackages.${system};
|
||||||
ghcVersions =
|
ghcVersions =
|
||||||
builtins.filter (p:
|
builtins.filter (p:
|
||||||
|
@ -27,12 +28,12 @@
|
||||||
builtins.foldl' (checks: ghcVersion:
|
builtins.foldl' (checks: ghcVersion:
|
||||||
let
|
let
|
||||||
haskellPackages = pkgs.haskell.packages.${ghcVersion};
|
haskellPackages = pkgs.haskell.packages.${ghcVersion};
|
||||||
|
inherit (pkgs.haskell.lib.compose) justStaticExecutables;
|
||||||
in
|
in
|
||||||
checks // {
|
checks // {
|
||||||
"${ghcVersion}".yammat = haskellPackages.callPackage ./pkg.nix {};
|
"${ghcVersion}".yammat = justStaticExecutables(haskellPackages.callPackage ./pkg.nix {});
|
||||||
}
|
}
|
||||||
) {} ghcVersions
|
) {} ghcVersions;
|
||||||
);
|
|
||||||
|
|
||||||
devShell = forSystems (system:
|
devShell = forSystems (system:
|
||||||
import ./shell.nix {
|
import ./shell.nix {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
name: yammat
|
name: yammat
|
||||||
version: 0.0.8
|
version: 0.0.9
|
||||||
cabal-version: >= 1.8
|
cabal-version: >= 1.8
|
||||||
build-type: Simple
|
build-type: Simple
|
||||||
license: AGPL-3
|
license: AGPL-3
|
||||||
|
@ -68,6 +68,8 @@ library
|
||||||
DerivingStrategies
|
DerivingStrategies
|
||||||
StandaloneDeriving
|
StandaloneDeriving
|
||||||
UndecidableInstances
|
UndecidableInstances
|
||||||
|
DataKinds
|
||||||
|
FlexibleInstances
|
||||||
|
|
||||||
build-depends: base >= 4 && < 5
|
build-depends: base >= 4 && < 5
|
||||||
, yesod >= 1.6
|
, yesod >= 1.6
|
||||||
|
|
Loading…
Reference in New Issue