Page MenuHomePhabricator

[lib] Allow creating thick threads from existing threads
ClosedPublic

Authored by tomek on Jul 29 2024, 3:38 AM.
Tags
None
Referenced Files
Unknown Object (File)
Wed, Dec 18, 12:50 PM
Unknown Object (File)
Wed, Dec 18, 12:50 PM
Unknown Object (File)
Wed, Dec 18, 12:50 PM
Unknown Object (File)
Wed, Dec 18, 12:50 PM
Unknown Object (File)
Wed, Dec 18, 12:50 PM
Unknown Object (File)
Wed, Dec 18, 12:50 PM
Unknown Object (File)
Wed, Dec 18, 12:50 PM
Unknown Object (File)
Wed, Dec 18, 12:50 PM
Subscribers

Details

Summary

Extend createThickRawThreadInfo so that it can create a thread with all the props.

Test Plan

Tested in combination with the rest of the stack by e.g. processing an operation that creates a new thread.

Diff Detail

Repository
rCOMM Comm
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

Harbormaster returned this revision to the author for changes because remote builds failed.Jul 29 2024, 3:42 AM
Harbormaster failed remote builds in B30739: Diff 42869!
tomek requested review of this revision.Jul 29 2024, 4:13 AM
lib/shared/dm-ops/create-thread-spec.js
47 ↗(On Diff #42876)

I'm not sure if it is safe to share this between clients because it can contain an encryptionKey.

What about +community?: ?string, field?

I'm not sure if it is safe to share this between clients because it can contain an encryptionKey.

This seems like something we need to figure out. But we should be able to use the same mechanism as we use for keyserver chats, right?

lib/shared/dm-ops/create-thread-spec.js
80 ↗(On Diff #42907)

This field is also optional (+parentThreadID?: ?string,). Should we add it in an if?

103 ↗(On Diff #42907)

This field is also optional (+containingThreadID?: ?string,). Should we add it in an if?

tomek added inline comments.
lib/shared/dm-ops/create-thread-spec.js
80 ↗(On Diff #42907)

The fields that are added in ifs are the ones for which types are optional non-nullable (+field?: T). When a field is optional and nullable, we don't have to move it to an if.

47 ↗(On Diff #42876)

It seems like we could safely do that because the DM is E2E encrypted. @bartek or @ashoat could you confirm?

To give more context, this field has ClientAvatar type, which has ClientEncryptedImageAvatar as its subtype in which we store an encryptionKey. This value would be sent as a part of an encrypted P2P message to other peers.

What about +community?: ?string, field?

I got a little confused here. But I think that communities are always thin because they live on keyservers. So for a thick thread, it is not possible to assign a community. Am I right?

I'm not sure if it is safe to share this between clients because it can contain an encryptionKey.

This seems like something we need to figure out. But we should be able to use the same mechanism as we use for keyserver chats, right?

Yeah, we could use the same mechanism. But if we're able to use ClientAvatar directly, the solution would be simpler.

lib/shared/dm-ops/create-thread-spec.js
47 ↗(On Diff #42876)

I think we can. The general idea is that blob-stored media (including avatars) are AES-encrypted, and peers allowed to see their content, receive the AES encryption key via DM which is E2E encrypted.
So this is exactly what we want here

What about +community?: ?string, field?

I got a little confused here. But I think that communities are always thin because they live on keyservers. So for a thick thread, it is not possible to assign a community. Am I right?

createThickRawThreadInfo returns MutableThickRawThreadInfo which includes a community field. I am also confused why that is, but it is types as +community?: ?string,, so I am assuming it can hold some value. If so, we should be able to set it

In D12914#366368, @inka wrote:

What about +community?: ?string, field?

I got a little confused here. But I think that communities are always thin because they live on keyservers. So for a thick thread, it is not possible to assign a community. Am I right?

createThickRawThreadInfo returns MutableThickRawThreadInfo which includes a community field. I am also confused why that is, but it is types as +community?: ?string,, so I am assuming it can hold some value. If so, we should be able to set it

Ok, let's add it for consistency, but it is still confusing. @ashoat do you know why MutableThickRawThreadInfo includes community?

This revision is now accepted and ready to land.Aug 1 2024, 6:38 AM

Ok, let's add it for consistency, but it is still confusing. @ashoat do you know why MutableThickRawThreadInfo includes community?

This was my mistake. Would it be easy to remove at this point? We might consider a follow-up task for this if not.

Ok, let's add it for consistency, but it is still confusing. @ashoat do you know why MutableThickRawThreadInfo includes community?

This was my mistake. Would it be easy to remove at this point? We might consider a follow-up task for this if not.

This comment wasn't responded to. It looks like this diff was landing with support for the community column, which isn't ideal, but probably won't be an issue if nobody calls it with community set.

Still, at the very least I'd like to see a follow-up task created for removing community from ThickRawThreadInfo (and any related types).

Ok, let's add it for consistency, but it is still confusing. @ashoat do you know why MutableThickRawThreadInfo includes community?

This was my mistake. Would it be easy to remove at this point? We might consider a follow-up task for this if not.

This comment wasn't responded to. It looks like this diff was landing with support for the community column, which isn't ideal, but probably won't be an issue if nobody calls it with community set.

Still, at the very least I'd like to see a follow-up task created for removing community from ThickRawThreadInfo (and any related types).

Ahhh, sorry for this! I started working on it and forgot to reply. I created a task to track https://linear.app/comm/issue/ENG-8937/remove-community-from-mutablethickrawthreadinfo. Overall it should be a quick change.