fix last errors
This commit is contained in:
parent
bf0af54438
commit
600fb00c63
3 changed files with 9 additions and 9 deletions
|
@ -10,7 +10,7 @@ import Control.Monad.Reader (asks)
|
||||||
|
|
||||||
import Types
|
import Types
|
||||||
import Model.Journal
|
import Model.Journal
|
||||||
import Control.Role (checkCapability)
|
import Util
|
||||||
|
|
||||||
journalShow
|
journalShow
|
||||||
:: Maybe (Int, AuthMethod)
|
:: Maybe (Int, AuthMethod)
|
||||||
|
|
|
@ -15,7 +15,7 @@ import Data.Maybe (fromMaybe, isJust)
|
||||||
|
|
||||||
import Types
|
import Types
|
||||||
import Model
|
import Model
|
||||||
import Control.Role (checkCapability)
|
import Util
|
||||||
|
|
||||||
productNew
|
productNew
|
||||||
:: Maybe (Int, AuthMethod)
|
:: Maybe (Int, AuthMethod)
|
||||||
|
|
14
src/Util.hs
14
src/Util.hs
|
@ -9,7 +9,7 @@ import Opaleye
|
||||||
|
|
||||||
import Data.ByteString.Lazy (fromStrict)
|
import Data.ByteString.Lazy (fromStrict)
|
||||||
|
|
||||||
import Data.Maybe (fromMaybe)
|
import Data.Maybe (fromMaybe, fromJust)
|
||||||
|
|
||||||
import Data.Profunctor.Product.Default (Default)
|
import Data.Profunctor.Product.Default (Default)
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@ import qualified Data.Text.Encoding as E
|
||||||
|
|
||||||
import Database.PostgreSQL.Simple
|
import Database.PostgreSQL.Simple
|
||||||
|
|
||||||
import Control.Monad (void)
|
import Control.Monad (void, filterM)
|
||||||
import Control.Monad.Reader (asks)
|
import Control.Monad.Reader (asks)
|
||||||
import Control.Monad.IO.Class (liftIO)
|
import Control.Monad.IO.Class (liftIO)
|
||||||
|
|
||||||
|
@ -111,17 +111,17 @@ sendAdminNotification
|
||||||
sendAdminNotification subject message = do
|
sendAdminNotification subject message = do
|
||||||
conn <- asks rsConnection
|
conn <- asks rsConnection
|
||||||
allUsers <- userDetailsSelectAll conn
|
allUsers <- userDetailsSelectAll conn
|
||||||
admins <- mapM
|
admins <- filterM
|
||||||
(\uid -> checkCapability uid roleCanManageSettings. userDetailsId)
|
((`checkCapability` roleCanManageSettings) . userDetailsId)
|
||||||
allUsers
|
allUsers
|
||||||
mapM_
|
mapM_
|
||||||
(\ UserDetails {..} ->
|
(\ UserDetails{..} ->
|
||||||
let mail = Mail
|
let mail = Mail
|
||||||
{ mailFrom = Address Nothing "noreply"
|
{ mailFrom = Address Nothing "noreply"
|
||||||
, mailTo =
|
, mailTo =
|
||||||
[ Address
|
[ Address
|
||||||
(Just userDetailsIdent)
|
(Just userDetailsIdent)
|
||||||
userDetailsEmail
|
(fromJust userDetailsEmail)
|
||||||
]
|
]
|
||||||
, mailCc = []
|
, mailCc = []
|
||||||
, mailBcc =[]
|
, mailBcc =[]
|
||||||
|
@ -132,7 +132,7 @@ sendAdminNotification subject message = do
|
||||||
, partEncoding = None
|
, partEncoding = None
|
||||||
, partDisposition = DefaultDisposition
|
, partDisposition = DefaultDisposition
|
||||||
, partHeaders = []
|
, partHeaders = []
|
||||||
, partContent = PartContent (fromString $ E.encodeUtf8 message)
|
, partContent = PartContent (fromString $ T.unpack message)
|
||||||
}
|
}
|
||||||
]]
|
]]
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue