mirror of
https://github.com/simplex-chat/simplex-chat.git
synced 2025-06-28 20:29:53 +00:00
unprocessed group invitations - highlight, print on start (#174)
This commit is contained in:
parent
ea89c9d8c8
commit
962287c439
2 changed files with 24 additions and 16 deletions
|
@ -444,20 +444,20 @@ subscribeUserConnections = void . runExceptT $ do
|
||||||
(subscribe (contactConnId ct) >> showContactSubscribed c) `catchError` showContactSubError c
|
(subscribe (contactConnId ct) >> showContactSubscribed c) `catchError` showContactSubError c
|
||||||
subscribeGroups user = do
|
subscribeGroups user = do
|
||||||
groups <- withStore (`getUserGroups` user)
|
groups <- withStore (`getUserGroups` user)
|
||||||
forM_ groups $ \Group {members, membership, localDisplayName = g} -> do
|
forM_ groups $ \g@Group {members, membership, localDisplayName = gn} -> do
|
||||||
let connectedMembers = mapMaybe (\m -> (m,) <$> memberConnId m) members
|
let connectedMembers = mapMaybe (\m -> (m,) <$> memberConnId m) members
|
||||||
if memberStatus membership == GSMemInvited
|
if memberStatus membership == GSMemInvited
|
||||||
then pure ()
|
then showUnprocessedGroupInvitation g
|
||||||
else
|
else
|
||||||
if null connectedMembers
|
if null connectedMembers
|
||||||
then
|
then
|
||||||
if memberActive membership
|
if memberActive membership
|
||||||
then showGroupEmpty g
|
then showGroupEmpty gn
|
||||||
else showGroupRemoved g
|
else showGroupRemoved gn
|
||||||
else do
|
else do
|
||||||
forM_ connectedMembers $ \(GroupMember {localDisplayName = c}, cId) ->
|
forM_ connectedMembers $ \(GroupMember {localDisplayName = c}, cId) ->
|
||||||
subscribe cId `catchError` showMemberSubError g c
|
subscribe cId `catchError` showMemberSubError gn c
|
||||||
showGroupSubscribed g
|
showGroupSubscribed gn
|
||||||
subscribeFiles user = do
|
subscribeFiles user = do
|
||||||
withStore (`getLiveSndFileTransfers` user) >>= mapM_ subscribeSndFile
|
withStore (`getLiveSndFileTransfers` user) >>= mapM_ subscribeSndFile
|
||||||
withStore (`getLiveRcvFileTransfers` user) >>= mapM_ subscribeRcvFile
|
withStore (`getLiveRcvFileTransfers` user) >>= mapM_ subscribeRcvFile
|
||||||
|
|
|
@ -31,6 +31,7 @@ module Simplex.Chat.View
|
||||||
showGroupSubscribed,
|
showGroupSubscribed,
|
||||||
showGroupEmpty,
|
showGroupEmpty,
|
||||||
showGroupRemoved,
|
showGroupRemoved,
|
||||||
|
showUnprocessedGroupInvitation,
|
||||||
showMemberSubError,
|
showMemberSubError,
|
||||||
showReceivedMessage,
|
showReceivedMessage,
|
||||||
showReceivedGroupMessage,
|
showReceivedGroupMessage,
|
||||||
|
@ -183,6 +184,10 @@ showGroupEmpty = printToView . groupEmpty
|
||||||
showGroupRemoved :: ChatReader m => GroupName -> m ()
|
showGroupRemoved :: ChatReader m => GroupName -> m ()
|
||||||
showGroupRemoved = printToView . groupRemoved
|
showGroupRemoved = printToView . groupRemoved
|
||||||
|
|
||||||
|
showUnprocessedGroupInvitation :: ChatReader m => Group -> m ()
|
||||||
|
showUnprocessedGroupInvitation Group {localDisplayName = ldn, groupProfile = GroupProfile {fullName}} =
|
||||||
|
printToView [unprocessedGroupInvitation ldn fullName]
|
||||||
|
|
||||||
showMemberSubError :: ChatReader m => GroupName -> ContactName -> ChatError -> m ()
|
showMemberSubError :: ChatReader m => GroupName -> ContactName -> ChatError -> m ()
|
||||||
showMemberSubError = printToView .:. memberSubError
|
showMemberSubError = printToView .:. memberSubError
|
||||||
|
|
||||||
|
@ -494,17 +499,20 @@ groupMembers Group {membership, members} = map groupMember . filter (not . remov
|
||||||
|
|
||||||
groupsList :: [(GroupName, Text, GroupMemberStatus)] -> [StyledString]
|
groupsList :: [(GroupName, Text, GroupMemberStatus)] -> [StyledString]
|
||||||
groupsList [] = ["you have no groups!", "to create: " <> highlight' "/g <name>"]
|
groupsList [] = ["you have no groups!", "to create: " <> highlight' "/g <name>"]
|
||||||
groupsList gs = map groupNames $ sort gs
|
groupsList gs = map groupSS $ sort gs
|
||||||
where
|
where
|
||||||
groupNames (displayName, fullName, GSMemInvited) =
|
groupSS (displayName, fullName, GSMemInvited) = unprocessedGroupInvitation displayName fullName
|
||||||
ttyGroup displayName
|
groupSS (displayName, fullName, _) = ttyGroup displayName <> optFullName displayName fullName
|
||||||
<> optFullName displayName fullName
|
|
||||||
<> " - you are invited ("
|
unprocessedGroupInvitation :: GroupName -> Text -> StyledString
|
||||||
<> highlight' ("/j " <> T.unpack displayName)
|
unprocessedGroupInvitation displayName fullName =
|
||||||
<> " to join, "
|
highlight ("#" <> displayName)
|
||||||
<> highlight' ("/d #" <> T.unpack displayName)
|
<> optFullName displayName fullName
|
||||||
<> " to delete invitation)"
|
<> " - you are invited ("
|
||||||
groupNames (displayName, fullName, _) = ttyGroup displayName <> optFullName displayName fullName
|
<> highlight ("/j " <> displayName)
|
||||||
|
<> " to join, "
|
||||||
|
<> highlight ("/d #" <> displayName)
|
||||||
|
<> " to delete invitation)"
|
||||||
|
|
||||||
contactsMerged :: Contact -> Contact -> [StyledString]
|
contactsMerged :: Contact -> Contact -> [StyledString]
|
||||||
contactsMerged _to@Contact {localDisplayName = c1} _from@Contact {localDisplayName = c2} =
|
contactsMerged _to@Contact {localDisplayName = c1} _from@Contact {localDisplayName = c2} =
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue