cbody added
This commit is contained in:
parent
28486657ea
commit
c229a01376
@ -738,7 +738,9 @@ MassInputDeleteCell: Entfernen
|
|||||||
NavigationFavourites: Favoriten
|
NavigationFavourites: Favoriten
|
||||||
|
|
||||||
CommSubject: Betreff
|
CommSubject: Betreff
|
||||||
|
CommBody: Nachricht
|
||||||
CommRecipients: Empfänger
|
CommRecipients: Empfänger
|
||||||
|
CommRecipientsSelectBy: Auswahl nach
|
||||||
CommDuplicateRecipients n@Int: #{tshow n} #{pluralDE n "doppelter" "doppelte"} Empfänger ignoriert
|
CommDuplicateRecipients n@Int: #{tshow n} #{pluralDE n "doppelter" "doppelte"} Empfänger ignoriert
|
||||||
CommSuccess n@Int: Nachricht wurde an #{tshow n} Empfänger versandt
|
CommSuccess n@Int: Nachricht wurde an #{tshow n} Empfänger versandt
|
||||||
|
|
||||||
|
|||||||
@ -92,24 +92,10 @@ commR CommunicationRoute{..} = do
|
|||||||
, pure ( AddRecipientCustom
|
, pure ( AddRecipientCustom
|
||||||
, Set.fromList . map (Left . CI.mk) <$> apreq multiEmailField (fslI AddRecipientCustom & addName (nudge $ toPathPiece AddRecipientCustom)) Nothing )
|
, Set.fromList . map (Left . CI.mk) <$> apreq multiEmailField (fslI AddRecipientCustom & addName (nudge $ toPathPiece AddRecipientCustom)) Nothing )
|
||||||
]
|
]
|
||||||
(addRes, addWdgt) <- multiActionM addOptions ("foobar" & addName (nudge "select")) Nothing csrf
|
(addRes, addWdgt) <- multiActionM addOptions (fslI MsgCommRecipientsSelectBy & addName (nudge "select")) Nothing csrf
|
||||||
-- lookupUserDisplayName :: UserId -> UserDisplayName
|
|
||||||
-- lookupUserDisplayName <- liftHandlerT . runDB $ do
|
|
||||||
-- let uids = toListOf (_FormSuccess . folded . _Right) addRes
|
|
||||||
-- names <- forM uids getJustEntity
|
|
||||||
-- return $ \uid -> case filter ((== uid) . entityKey) names of
|
|
||||||
-- [Entity _ User{..}] -> userDisplayName
|
|
||||||
-- _other -> error "UserId lookpup failed"
|
|
||||||
let addRes' = addRes <&> \newSet oldMap ->
|
let addRes' = addRes <&> \newSet oldMap ->
|
||||||
-- if
|
let freshSet = newSet `Set.difference` Set.fromList (Map.elems oldMap)
|
||||||
-- | collisions <- newSet `Set.intersection` Set.fromList (Map.elems oldMap)
|
in FormSuccess . Map.fromList . zip [maybe 0 (succ . fst) (Map.lookupMax oldMap)..] $ Set.toList freshSet
|
||||||
-- , not $ Set.null collisions ->
|
|
||||||
-- -- FormFailure [ mr . MsgCommDuplicateRecipients . map (either CI.original lookupUserDisplayName) $ Set.toList collisions ]
|
|
||||||
-- FormFailure [ mr . MsgCommDuplicateRecipients $ Set.size collisions ]
|
|
||||||
-- | otherwise -> FormSuccess . Map.fromList . zip [maybe 0 (succ . fst) (Map.lookupMax oldMap)..] $ Set.toList newSet
|
|
||||||
let freshSet = newSet `Set.difference` Set.fromList (Map.elems oldMap)
|
|
||||||
in FormSuccess . Map.fromList . zip [maybe 0 (succ . fst) (Map.lookupMax oldMap)..] $ Set.toList freshSet
|
|
||||||
|
|
||||||
addWdgt' = mconcat [ toWidget csrf, addWdgt, fvInput submitView ]
|
addWdgt' = mconcat [ toWidget csrf, addWdgt, fvInput submitView ]
|
||||||
return (addRes', addWdgt')
|
return (addRes', addWdgt')
|
||||||
|
|
||||||
@ -129,6 +115,7 @@ commR CommunicationRoute{..} = do
|
|||||||
((commRes,commWdgt),commEncoding) <- runFormPost . identifyForm FIDCommunication . renderAForm FormStandard $ Communication
|
((commRes,commWdgt),commEncoding) <- runFormPost . identifyForm FIDCommunication . renderAForm FormStandard $ Communication
|
||||||
<$> recipientAForm
|
<$> recipientAForm
|
||||||
<*> aopt textField (fslI MsgCommSubject) Nothing
|
<*> aopt textField (fslI MsgCommSubject) Nothing
|
||||||
|
<*> areq htmlField (fslI MsgCommBody) Nothing
|
||||||
formResult commRes $ \comm -> do
|
formResult commRes $ \comm -> do
|
||||||
runDBJobs $ queueDBJob =<< mapReaderT lift (crJob comm)
|
runDBJobs $ queueDBJob =<< mapReaderT lift (crJob comm)
|
||||||
addMessageI Success . MsgCommSuccess . Set.size $ cRecipients comm
|
addMessageI Success . MsgCommSuccess . Set.size $ cRecipients comm
|
||||||
|
|||||||
@ -55,6 +55,7 @@ deriveJSON defaultOptions
|
|||||||
data Communication = Communication
|
data Communication = Communication
|
||||||
{ cRecipients :: Set (Either UserEmail UserId)
|
{ cRecipients :: Set (Either UserEmail UserId)
|
||||||
, cSubject :: Maybe Text
|
, cSubject :: Maybe Text
|
||||||
|
, cBody :: Html
|
||||||
} deriving (Eq, Ord, Read, Show, Generic, Typeable)
|
} deriving (Eq, Ord, Read, Show, Generic, Typeable)
|
||||||
|
|
||||||
instance Hashable Communication
|
instance Hashable Communication
|
||||||
|
|||||||
Reference in New Issue
Block a user