Skip to content

WPB-21964: Add Wire Meetings delete#5066

Open
blackheaven wants to merge 2 commits intodevelopfrom
gdifolco/WPB-21964-wire-meetings-delete
Open

WPB-21964: Add Wire Meetings delete#5066
blackheaven wants to merge 2 commits intodevelopfrom
gdifolco/WPB-21964-wire-meetings-delete

Conversation

@blackheaven
Copy link
Contributor

https://wearezeta.atlassian.net/browse/WPB-21964

Checklist

  • Add a new entry in an appropriate subdirectory of changelog.d
  • Read and follow the PR guidelines

@blackheaven blackheaven requested review from a team as code owners February 26, 2026 13:29
@zebot zebot added the ok-to-test Approved for running tests in CI, overrides not-ok-to-test if both labels exist label Feb 26, 2026
Copy link
Contributor

@battermann battermann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Other than the 2 comments, it looks good!

Comment on lines +148 to +151
ConversationSubsystem.GetConversation cid ->
ConvStore.getConversation cid
ConversationSubsystem.DeleteConversation cid ->
ConvStore.deleteConversation cid
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a bit strange, I would assume the ConversationSubsystem to also handle authorization/team membership checks.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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, in galley do directly check permissions.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is only delegating to ConversationStore, can't you use ConverstationStore directly where you need this? Otherwise it's the wrong abstraction, IMO.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@akshaymankar reminded me that we should not use other's subsystems store in #4918 (comment)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 ;-))

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should make sure that the team -> conversation index also gets removed (I think only relevant for cassandra)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should it be part of ConversationSubsystem?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 action

I don't know how to best achieve this, either.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See #5068

Comment on lines +828 to +834
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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ok-to-test Approved for running tests in CI, overrides not-ok-to-test if both labels exist

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants