Compare commits

..

No commits in common. "1b8c913c5812258be55fcd2f25b792efeadd86f8" and "38ecd78db16061b3c4dd5814b586f281a56cb304" have entirely different histories.

9 changed files with 19 additions and 41 deletions

View file

@ -113,7 +113,7 @@ notifyUser user bev quant price master = do
"VERDAMMT NOCHMAL!!!"
else
return ""
liftIO $ sendMail master email "Einkauf beim Matematen"
liftIO $ sendMail email "Einkauf beim Matematen"
[lt|
Hallo #{userIdent user},

View file

@ -191,7 +191,7 @@ checkAlert bId oldamount = do
master <- getYesod
let tos = appEmail $ appSettings master
mapM_ (\to ->
liftIO $ sendMail master to "Niedriger Bestand"
liftIO $ sendMail to "Niedriger Bestand"
[stext|
Hallo,
@ -204,18 +204,16 @@ Dein Matemat
|]
) tos
sendMail :: MonadIO m => App -> Text -> Text -> TL.Text -> m ()
sendMail master to subject body = liftIO $ do
let sendmailLocation = appSendmailLocation $ appSettings master
fromMail = appFromMail $ appSettings master
renderSendMailCustom sendmailLocation []
sendMail :: MonadIO m => Text -> Text -> TL.Text -> m ()
sendMail to subject body =
liftIO $ renderSendMail
Mail
{ mailFrom = Address Nothing "noreply"
, mailTo = [Address Nothing to]
, mailCc = []
, mailBcc = []
, mailHeaders = [("Subject", subject),
("List-Id", "\"Matemat\" <"<> (fromString fromMail) <>">")]
("List-Id", "\"Matemat\" <matemat@matemat.hq.c3d2.de>")]
, mailParts =[[Part
{ partType = "text/plain; charset=utf-8"
, partEncoding = None

View file

@ -119,8 +119,7 @@ postModifyUserR uId =
, UserAvatar =. userConfAvatar uc
, UserPin =. userConfPIN uc
]
master <- getYesod
liftIO $ notify user (userConfEmail uc) master
liftIO $ notify user (userConfEmail uc)
handleBarcodes (Left uId) (fromMaybe [] $ userConfBarcode uc)
setMessageI MsgUserEdited
redirect $ SelectR uId
@ -145,13 +144,12 @@ modifyUserForm user bs = UserConf
ents <- runDB $ selectList [] [Asc AvatarIdent]
optionsPairs $ map (\ent -> ((avatarIdent $ entityVal ent), entityKey ent)) ents
notify :: User -> Maybe Text -> App -> IO ()
notify user email master
notify :: User -> Maybe Text -> IO ()
notify user email
| (userEmail user) == email = return ()
| otherwise = case userEmail user of
Just address ->
sendMail master address "Profiländerung"
[stext|
Just address -> sendMail address "Profiländerung"
[stext|
Hallo #{userIdent user},
deine Profileinstellungen wurden geändert.
@ -160,5 +158,5 @@ Nur damit du Bescheid weißt.
Grüße,
der Matemat
|]
|]
Nothing -> return ()

View file

@ -76,7 +76,7 @@ transferForm = areq currencyField (bfs MsgValue) (Just 0)
notify :: User -> User -> Int -> App -> IO ()
notify sender rcpt amount master = do
when (isJust $ userEmail sender) $
liftIO $ sendMail master (fromJust $ userEmail sender) "Guthabentransfer beim Matematen"
liftIO $ sendMail (fromJust $ userEmail sender) "Guthabentransfer beim Matematen"
[stext|
Hallo #{userIdent sender}
@ -87,7 +87,7 @@ Viele Grüße,
Dein Matemat
|]
when (isJust $ userEmail rcpt) $
liftIO $ sendMail master (fromJust $ userEmail rcpt) "Guthabentransfer eingetroffen"
liftIO $ sendMail (fromJust $ userEmail rcpt) "Guthabentransfer eingetroffen"
[stext|
Hallo #{userIdent rcpt}

View file

@ -13,11 +13,6 @@
--
-- 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/>.
{-# LANGUAGE DerivingStrategies #-}
{-# LANGUAGE StandaloneDeriving #-}
{-# LANGUAGE UndecidableInstances #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE FlexibleInstances #-}
module Model where
import ClassyPrelude.Yesod

View file

@ -80,10 +80,6 @@ data AppSettings = AppSettings
-- ^ Block user creation
, appAdminCreds :: Maybe Login
-- ^ 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
@ -129,9 +125,6 @@ instance FromJSON AppSettings where
appAdminCreds <- o .:? "credentials"
appSendmailLocation <- o .: "sendmail-location"
appFromMail <- o .: "from-mail"
return AppSettings {..}
-- | Settings for 'widgetFile', such as which template languages to support and

View file

@ -36,9 +36,6 @@ copyright_link: "https://github.com/nek0/yammat"
block_users: false
sendmail-location: "/usr/sbin/sendmail"
from-mail: "matemat@matemat.hq.c3d2.de"
# optional administrative credentials.
# credentials:
# login: "admin"

View file

@ -16,9 +16,8 @@
checks = packages;
hydraJobs =
hydraJobs = forSystems (system:
let
system = builtins.head systems;
pkgs = nixpkgs.legacyPackages.${system};
ghcVersions =
builtins.filter (p:
@ -28,12 +27,12 @@
builtins.foldl' (checks: ghcVersion:
let
haskellPackages = pkgs.haskell.packages.${ghcVersion};
inherit (pkgs.haskell.lib.compose) justStaticExecutables;
in
checks // {
"${ghcVersion}".yammat = justStaticExecutables(haskellPackages.callPackage ./pkg.nix {});
"${ghcVersion}".yammat = haskellPackages.callPackage ./pkg.nix {};
}
) {} ghcVersions;
) {} ghcVersions
);
devShell = forSystems (system:
import ./shell.nix {

View file

@ -1,5 +1,5 @@
name: yammat
version: 0.0.9
version: 0.0.8
cabal-version: >= 1.8
build-type: Simple
license: AGPL-3
@ -68,8 +68,6 @@ library
DerivingStrategies
StandaloneDeriving
UndecidableInstances
DataKinds
FlexibleInstances
build-depends: base >= 4 && < 5
, yesod >= 1.6