Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: MLS 1:1 conversations [WPB-2183] #15508

Merged

Conversation

PatrykBuniX
Copy link
Contributor

@PatrykBuniX PatrykBuniX commented Jul 27, 2023

StoryWPB-2183 [Web] [Clients] Select protocol for 1-1 conversation

When MLS is supported and both of the users in a connection support MLS protocol (supported_protocols field on user entity includes "mls") we want to:

  • establish 1:1 MLS conversation
  • add the other user into the MLS group
  • move all the events (messages) into the new conversation
  • hide old proteus conversation

@codecov
Copy link

codecov bot commented Jul 27, 2023

Codecov Report

Merging #15508 (6ce3972) into feat/mls-1to1-conversations (2c82c9a) will decrease coverage by 1.08%.
The diff coverage is 23.36%.

❗ Current head 6ce3972 differs from pull request most recent head 631a3ac. Consider uploading reports for the commit 631a3ac to get more accurate results

@@                       Coverage Diff                       @@
##           feat/mls-1to1-conversations   #15508      +/-   ##
===============================================================
- Coverage                        44.67%   43.59%   -1.08%     
===============================================================
  Files                              668      653      -15     
  Lines                            22671    22328     -343     
  Branches                          5169     5096      -73     
===============================================================
- Hits                             10128     9734     -394     
- Misses                           11245    11343      +98     
+ Partials                          1298     1251      -47     

@PatrykBuniX PatrykBuniX force-pushed the feat/WPB-2183-select-protocol-for-1-1 branch from 3a3fa92 to 3798581 Compare August 2, 2023 07:09
@PatrykBuniX PatrykBuniX force-pushed the feat/WPB-2183-select-protocol-for-1-1 branch 4 times, most recently from bdf6e9a to 634bb1d Compare August 14, 2023 02:07
@PatrykBuniX PatrykBuniX force-pushed the feat/WPB-2183-select-protocol-for-1-1 branch 2 times, most recently from 768e328 to 85ccb79 Compare August 17, 2023 08:23
@PatrykBuniX PatrykBuniX changed the base branch from dev to release/miles August 17, 2023 08:23
@PatrykBuniX PatrykBuniX force-pushed the feat/WPB-2183-select-protocol-for-1-1 branch from 947d9a4 to b556546 Compare August 28, 2023 07:27
@PatrykBuniX PatrykBuniX changed the base branch from release/miles to feat/mls-1to1-conversations August 28, 2023 07:27
@PatrykBuniX PatrykBuniX force-pushed the feat/WPB-2183-select-protocol-for-1-1 branch 5 times, most recently from 740db03 to 3ade197 Compare September 5, 2023 07:32
@PatrykBuniX PatrykBuniX force-pushed the feat/WPB-2183-select-protocol-for-1-1 branch from 61d562f to b437fae Compare September 6, 2023 16:33
@PatrykBuniX PatrykBuniX marked this pull request as ready for review September 7, 2023 08:10
@PatrykBuniX PatrykBuniX requested review from otto-the-bot and a team as code owners September 7, 2023 08:10
@PatrykBuniX PatrykBuniX force-pushed the feat/WPB-2183-select-protocol-for-1-1 branch 2 times, most recently from 75860e5 to bc45fa2 Compare September 12, 2023 14:38
src/i18n/en-US.json Outdated Show resolved Hide resolved
src/script/page/AppMain.tsx Outdated Show resolved Hide resolved
Comment on lines -416 to -419
if (connections.length) {
await Promise.allSettled(conversationRepository.mapConnections(connections));
}

Copy link
Contributor

Choose a reason for hiding this comment

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

I guess this is done by the init1To1Conversations right? Maybe it would make sense to put it in another function or is this to tied to actual 1:1 conversations?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Correct, this logic was moved to init1To1Conversations, I don't quite get what you mean, you've commented on removed code 🤔

Copy link
Contributor

Choose a reason for hiding this comment

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

My question is: would it make sense to have a separate function that does the connection mapping (rather than doing it inside of the init1to1conversations method). In order to split reponsibilities. But maybe it doesn't make sense, I leave you judge of this :D

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, I'd leave it as it is now - we're initialising 1:1 conversation every time we map through connection (and find a 1:1 conversation for this connection), so i'd say it's tied to it. Right after that we need to map through team-owned 1:1 conversations (that don't have connections assigned) anyway, I prefer to have initApp method calling a single method that takes care of initialising all the 1:1 conversations.

@PatrykBuniX PatrykBuniX merged commit cf32137 into feat/mls-1to1-conversations Oct 11, 2023
6 checks passed
@PatrykBuniX PatrykBuniX deleted the feat/WPB-2183-select-protocol-for-1-1 branch October 11, 2023 07:38
PatrykBuniX added a commit that referenced this pull request Nov 9, 2023
* feat: MLS 1:1 conversations [WPB-2183] (#15508)

* feat: self user supported protocols

* runfix: initialise supported protocols with null

* test: uncomment scenarios

* refactor: move self supported protocols to self repository

* feat: initial work on 1:1 mls conversations

* feat: move all conversation events to mls conversation

* feat: replace proteus 1:1 with mls 1:1

* feat: delete proteus 1:1 after moving events to mls 1:1

* runfix: fetch all known users on app load to get fresh supported protocols

* feat: establish mls group when both users support mls

* feat: if proteus 1:1 was active conversation, switch to mls

* init 1:1 conversation when navigating between conversations

* runfix: always use mls 1:1 if its already known by client

* runfix: add missing return statement

* feat: get 1to1 team conversation

* feat: assign user connection to conversation

* chore: add todo

* feat: hide proteus 1:1 after receiving welcome to mls 1:1

* chore: remove mls 1:1 feature flags

* refactor: find 1:1 by uid and protocol

* runfix: insert group creation message to 1:1 mls after replcing

* test: fix conversation repo test

* test: update loadUsers case

* chore: add todo comment

* test: fix test

* feat: get1to1Conversation

* runfix: do not insert group creation message

* feat: update participating user ids and entities after establishing

* refactor: move group establishment part to core

* chore: bump core

* runfix: is mls 1:1 already established

* feat: add delay to the user that has received connection accepted event

* chore: add comment to establishment delay

* chore: todo comment

* refactor: get initialised conversation

* runfix: put history state back to sethistoryparam call

* chore: improve comments

* chore: improve comments

* chore: improve comments

* test: refactor get1to1conversation tests

* test: get1To1Conversation

* chore: fix log

* refactor: replace proteus as a part of init mls

* refactor: simplify mls init for unconnected connections

* refactor: pass quid instead of the whole user entity

* feat: migrate conversation's local properties

* refactor: move establishment delay to establish method

* test: establish 1:1 mls conversation

* test: replacing proteus 1:1 with mls 1:1

* test: move conversation events

* feat: add readOnly flag for conversation (#15759)

* feat: add readOnly flag for conversation

* fix: fix pipeline issue

* feat:  Mark 1:1 conversation as read-only if there's no common protocol

* feat: disable audio/video call buttons if readonly conversation

* refactor: rename variable

* fix: remove test trigger

* fix: code review comments

* fix: test pipeline

* feat: rename variable and trigger conversation readonly

* fix: remove TODO comment

* runfix: improve styles of readonly warning message

* runfix: change info svg icon color

* runfix: hide proteus conversation before establishing a group

* runfix: show conversation before establishment delay

* refactor: init 1to1 conversation on app load

* feat: handle case for multiple team 1:1 with the same user

* refactor: remove unused type

* feat: reevaluate the list of supported protocols on mls feature config update

* runfix: reevaluate slef protocols only on team protocols update

* chore: bump core

* refactor: remove unused method after merge

* feat: re-evaluate 1:1 converstions after updating self-supported protocols

* runfix: read otheruserid from participants list on welcome message

* runfix: add connect type to is1to1conversation proteus search

* runfix: establish mls group before showing it

* chore: remove unused translation

* chore: removed unrelated code

* refactor: improve naming

* chore: bump core

---------

Co-authored-by: Arjita <[email protected]>

* runfix: do not mark already established mls conversation as readonly (#15990)

* runfix: do not mark already established mls conversation as readonly

* test: mark conversation as readonly

* feat: refetch user protocols when navigating to convo (#15991)

* runfix: init all 1to1

* runfix: show readonly mls conversation

* runfix: remove readonly state after protocol is supported by both users

* runfix: add missing return statement

* feat: mls 1:1 conversation listen to user update event (#15996)

* feat: listen to user update event

* feat: init 1:1 conversation on other user update event

* test: emit supportedProtocolsUpdated event

* test: listen for supported protocols update

* runfix: re-init conversation only if it did exist before

* docs: improve js doc in 1:1 methods

* chore: test name

* feat: mls 1to1 blacklist migrated proteus (#16025)

* [tmp] blacklist proteus after migration

* feat: add ability to blacklist a conversation

* feat: blacklist proteus conversation after deleting it locally

* test: blacklist conversation

* runfix: make sure user is updated with new protocols before emitting event

* feat: update protocols on migration config update (#16027)

* feat: refresh self protocols on mls migration config update

* docs: add comment to refreshing protocols on mls migration feat update

* feat: init 1to1 conversations after restoring a backup (#16028)

* test: add missing mocks

* runfix: add missing mock

* runfix: add user entity to mls 1:1 conversation

* feat: add readonly proteus to blacklist (#16036)

* feat: add readonly proteus 1:1 to blacklist

* test: readonly proteus conversation

* runfix: mls 1to1 establishment on user protocols update (#16083)

* runfix: add delay for establishing 1:1 after user update event

* runfix: md breakpoint call button disabled on readonly convo

* runfix: do not delay mls init if user does not support mls anyway

* refactor: should open mls 1:1

* test: update tests

* docs: add comment for 1:1 conversation delay

* runfix: hide actions menu on readonly conversation (#16091)

* refactor: is proteus/mls 1:1 convo with user

* runfix: do not mark conversation as readonly if it's already established

* runfix: is proteus 1to1 with user

* runfix: don't call supported endpoints with old be versions

---------

Co-authored-by: Arjita <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants