Conversation
battermann
left a comment
There was a problem hiding this comment.
Other than the 2 comments, it looks good!
| ConversationSubsystem.GetConversation cid -> | ||
| ConvStore.getConversation cid | ||
| ConversationSubsystem.DeleteConversation cid -> | ||
| ConvStore.deleteConversation cid |
There was a problem hiding this comment.
This is a bit strange, I would assume the ConversationSubsystem to also handle authorization/team membership checks.
There was a problem hiding this comment.
I would agree, except that:
- Other operations don't (I agree that it could be a defect)
- As far as I can see, only
getLocalConvForUser, ingalleydo directly check permissions.
There was a problem hiding this comment.
It is only delegating to ConversationStore, can't you use ConverstationStore directly where you need this? Otherwise it's the wrong abstraction, IMO.
There was a problem hiding this comment.
@akshaymankar reminded me that we should not use other's subsystems store in #4918 (comment)
There was a problem hiding this comment.
IDK, why shouldn't the meeting subsystem use the conversation store? Because a meeting is a conversation, right? (we should not be more catholic than the pope ;-))
There was a problem hiding this comment.
If you ask me, the right solution would be to move all the code related to conversation deletion from galley to the conversation subsystem, including all the permission checks and what not. Then call this from here and also from galley. This would also solve the other comment about the team to conversation index and other clean up operations that are still missing here. But this would take some more effort as there are a lot of dependencies.
| case maybeConv of | ||
| Just conv | ||
| | conv.metadata.cnvmGroupConvType == Just MeetingConversation -> | ||
| lift $ ConversationSubsystem.deleteConversation convId |
There was a problem hiding this comment.
We should make sure that the team -> conversation index also gets removed (I think only relevant for cassandra)
There was a problem hiding this comment.
Should it be part of ConversationSubsystem?
There was a problem hiding this comment.
I am not sure. It would be best if it would use the same code as normal conversation deletion through the conversation action. There is even much more to consider than just the team to conversation index. See:
SConversationDeleteTag -> do
let deleteGroup groupId = do
E.removeAllMLSClients groupId
E.deleteAllProposals groupId
let cid = storedConv.id_
for_ (storedConv & mlsMetadata <&> cnvmlsGroupId . fst) $ \gidParent -> do
sconvs <- E.listSubConversations cid
for_ (Map.assocs sconvs) $ \(subid, mlsData) -> do
let gidSub = cnvmlsGroupId mlsData
E.deleteSubConversation cid subid
deleteGroup gidSub
deleteGroup gidParent
key <- E.makeKey (tUnqualified lcnv)
E.deleteCode key
case convTeam storedConv of
Nothing -> E.deleteConversation (tUnqualified lcnv)
Just tid -> E.deleteTeamConversation tid (tUnqualified lcnv)
pure $ mkPerformActionResult actionI don't know how to best achieve this, either.
| deleteConversationImpl :: (Member ConversationStore r) => ConvId -> Sem r () | ||
| deleteConversationImpl cid = do | ||
| mConv <- ConvStore.getConversation cid | ||
| forM_ mConv $ \conv -> do | ||
| forM_ conv.metadata.cnvmTeam $ \tid -> | ||
| ConvStore.deleteTeamConversation tid cid | ||
| ConvStore.deleteConversation cid |
There was a problem hiding this comment.
Now we have duplicated the conversation deletion logic. And compared to the galley implementation there are some other clean ups still missing. Also no permission check here.
https://wearezeta.atlassian.net/browse/WPB-21964
Checklist
changelog.d