mirror of
https://github.com/simplex-chat/simplex-chat.git
synced 2025-06-28 12:19:54 +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
|
||||
subscribeGroups user = do
|
||||
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
|
||||
if memberStatus membership == GSMemInvited
|
||||
then pure ()
|
||||
then showUnprocessedGroupInvitation g
|
||||
else
|
||||
if null connectedMembers
|
||||
then
|
||||
if memberActive membership
|
||||
then showGroupEmpty g
|
||||
else showGroupRemoved g
|
||||
then showGroupEmpty gn
|
||||
else showGroupRemoved gn
|
||||
else do
|
||||
forM_ connectedMembers $ \(GroupMember {localDisplayName = c}, cId) ->
|
||||
subscribe cId `catchError` showMemberSubError g c
|
||||
showGroupSubscribed g
|
||||
subscribe cId `catchError` showMemberSubError gn c
|
||||
showGroupSubscribed gn
|
||||
subscribeFiles user = do
|
||||
withStore (`getLiveSndFileTransfers` user) >>= mapM_ subscribeSndFile
|
||||
withStore (`getLiveRcvFileTransfers` user) >>= mapM_ subscribeRcvFile
|
||||
|
|
|
@ -31,6 +31,7 @@ module Simplex.Chat.View
|
|||
showGroupSubscribed,
|
||||
showGroupEmpty,
|
||||
showGroupRemoved,
|
||||
showUnprocessedGroupInvitation,
|
||||
showMemberSubError,
|
||||
showReceivedMessage,
|
||||
showReceivedGroupMessage,
|
||||
|
@ -183,6 +184,10 @@ showGroupEmpty = printToView . groupEmpty
|
|||
showGroupRemoved :: ChatReader m => GroupName -> m ()
|
||||
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 = printToView .:. memberSubError
|
||||
|
||||
|
@ -494,17 +499,20 @@ groupMembers Group {membership, members} = map groupMember . filter (not . remov
|
|||
|
||||
groupsList :: [(GroupName, Text, GroupMemberStatus)] -> [StyledString]
|
||||
groupsList [] = ["you have no groups!", "to create: " <> highlight' "/g <name>"]
|
||||
groupsList gs = map groupNames $ sort gs
|
||||
groupsList gs = map groupSS $ sort gs
|
||||
where
|
||||
groupNames (displayName, fullName, GSMemInvited) =
|
||||
ttyGroup displayName
|
||||
<> optFullName displayName fullName
|
||||
<> " - you are invited ("
|
||||
<> highlight' ("/j " <> T.unpack displayName)
|
||||
<> " to join, "
|
||||
<> highlight' ("/d #" <> T.unpack displayName)
|
||||
<> " to delete invitation)"
|
||||
groupNames (displayName, fullName, _) = ttyGroup displayName <> optFullName displayName fullName
|
||||
groupSS (displayName, fullName, GSMemInvited) = unprocessedGroupInvitation displayName fullName
|
||||
groupSS (displayName, fullName, _) = ttyGroup displayName <> optFullName displayName fullName
|
||||
|
||||
unprocessedGroupInvitation :: GroupName -> Text -> StyledString
|
||||
unprocessedGroupInvitation displayName fullName =
|
||||
highlight ("#" <> displayName)
|
||||
<> optFullName displayName fullName
|
||||
<> " - you are invited ("
|
||||
<> highlight ("/j " <> displayName)
|
||||
<> " to join, "
|
||||
<> highlight ("/d #" <> displayName)
|
||||
<> " to delete invitation)"
|
||||
|
||||
contactsMerged :: Contact -> Contact -> [StyledString]
|
||||
contactsMerged _to@Contact {localDisplayName = c1} _from@Contact {localDisplayName = c2} =
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue