chore(firm): add setting for global communications cc
This commit is contained in:
parent
b7d6474ace
commit
b9f2d3bda4
@ -1025,8 +1025,7 @@ handleFirmCommR ultDest cs = do
|
|||||||
return (E.just $ cmp E.^. UserCompanyCompany, emp E.^. UserId)
|
return (E.just $ cmp E.^. UserCompanyCompany, emp E.^. UserId)
|
||||||
)
|
)
|
||||||
-- get supervisors of employees
|
-- get supervisors of employees
|
||||||
--sprs <- mkCompanyUsrList <$> runDB (E.select $ do
|
sprs <- mkCompanyUsrList <$> runDB (E.select $ do
|
||||||
sprs' <- runDB (E.select $ do
|
|
||||||
(spr :& cmp) <- E.from $ E.table @User `E.leftJoin` E.table @UserCompany `E.on` (\(spr :& cmp) -> spr E.^. UserId E.=?. cmp E.?. UserCompanyUser)
|
(spr :& cmp) <- E.from $ E.table @User `E.leftJoin` E.table @UserCompany `E.on` (\(spr :& cmp) -> spr E.^. UserId E.=?. cmp E.?. UserCompanyUser)
|
||||||
E.where_ $ (E.isTrue (cmp E.?. UserCompanySupervisor) E.&&. cmp E.?. UserCompanyCompany `E.in_` E.justValList csKeys)
|
E.where_ $ (E.isTrue (cmp E.?. UserCompanySupervisor) E.&&. cmp E.?. UserCompanyCompany `E.in_` E.justValList csKeys)
|
||||||
E.||. (spr E.^. UserId E.=?. E.val mbUser)
|
E.||. (spr E.^. UserId E.=?. E.val mbUser)
|
||||||
@ -1038,9 +1037,6 @@ handleFirmCommR ultDest cs = do
|
|||||||
E.orderBy [E.ascNullsFirst $ cmp E.?. UserCompanyCompany]
|
E.orderBy [E.ascNullsFirst $ cmp E.?. UserCompanyCompany]
|
||||||
return (cmp E.?. UserCompanyCompany, spr E.^. UserId)
|
return (cmp E.?. UserCompanyCompany, spr E.^. UserId)
|
||||||
)
|
)
|
||||||
$logInfoS "Firm" "!!!Messaging here!!!"
|
|
||||||
unless (checkAsc (fst <$> sprs')) ($logErrorS "Firm" ("Supervisor list isn't ascending!!!" <> tshow (fst <$> sprs'))) -- TODO: REMOVE THIS CHECK AND THE FOLLOWING LINE FOR PRODUCTION !!!
|
|
||||||
let sprs = mkCompanyUsrList sprs'
|
|
||||||
|
|
||||||
commR CommunicationRoute
|
commR CommunicationRoute
|
||||||
{ crHeading = SomeMessage $ case cs of { [c] -> MsgFirmNotification c ; _ -> MsgFirmsNotification }
|
{ crHeading = SomeMessage $ case cs of { [c] -> MsgFirmNotification c ; _ -> MsgFirmsNotification }
|
||||||
|
|||||||
@ -148,6 +148,7 @@ commR CommunicationRoute{..} = do
|
|||||||
|
|
||||||
MsgRenderer mr <- getMsgRenderer
|
MsgRenderer mr <- getMsgRenderer
|
||||||
mbCurrentRoute <- getCurrentRoute
|
mbCurrentRoute <- getCurrentRoute
|
||||||
|
globalCC <- getsYesod $ view _appCommunicationGlobalCC
|
||||||
|
|
||||||
let
|
let
|
||||||
lookupUser :: UserId -> (UserDisplayName,UserSurname)
|
lookupUser :: UserId -> (UserDisplayName,UserSurname)
|
||||||
@ -165,9 +166,12 @@ commR CommunicationRoute{..} = do
|
|||||||
, (pos, recp) <- zip [0..] $ map entityKey recps
|
, (pos, recp) <- zip [0..] $ map entityKey recps
|
||||||
] ++
|
] ++
|
||||||
[ ( (BoundedPosition RecipientCustom, pos)
|
[ ( (BoundedPosition RecipientCustom, pos)
|
||||||
, (Right recp, True)
|
, (recp, True)
|
||||||
)
|
)
|
||||||
| (pos, recp) <- zip [0..] . Set.toList $ Set.fromList (map entityKey chosenRecipients) \\ Set.fromList (concatMap (map entityKey) $ view _2 <$> suggestedRecipients)
|
| (pos, recp) <- zip [0..]
|
||||||
|
( mcons (Left <$> globalCC)
|
||||||
|
(Right <$> Set.toList (Set.fromList (map entityKey chosenRecipients) \\ Set.fromList (concatMap (map entityKey) $ view _2 <$> suggestedRecipients)))
|
||||||
|
)
|
||||||
]
|
]
|
||||||
activeCategories = map RecipientGroup (view _1 <$> suggestedRecipients) `snoc` RecipientCustom
|
activeCategories = map RecipientGroup (view _1 <$> suggestedRecipients) `snoc` RecipientCustom
|
||||||
|
|
||||||
|
|||||||
@ -245,6 +245,7 @@ data AppSettings = AppSettings
|
|||||||
, appJobMaxFlush :: Maybe Natural
|
, appJobMaxFlush :: Maybe Natural
|
||||||
|
|
||||||
, appCommunicationAttachmentsMaxSize :: Maybe Natural
|
, appCommunicationAttachmentsMaxSize :: Maybe Natural
|
||||||
|
, appCommunicationGlobalCC :: Maybe UserEmail
|
||||||
|
|
||||||
, appFileChunkingParams :: FastCDCParameters
|
, appFileChunkingParams :: FastCDCParameters
|
||||||
|
|
||||||
@ -804,6 +805,7 @@ instance FromJSON AppSettings where
|
|||||||
appJobMaxFlush <- o .:? "job-max-flush"
|
appJobMaxFlush <- o .:? "job-max-flush"
|
||||||
|
|
||||||
appCommunicationAttachmentsMaxSize <- o .:? "communication-attachments-max-size"
|
appCommunicationAttachmentsMaxSize <- o .:? "communication-attachments-max-size"
|
||||||
|
appCommunicationGlobalCC <- o .:? "communication-global-cc"
|
||||||
|
|
||||||
appLegalExternal <- o .: "legal-external"
|
appLegalExternal <- o .: "legal-external"
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user