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