-
Notifications
You must be signed in to change notification settings - Fork 333
Implement status updates for remote conversations #1753
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
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
f5e00f5
to
6f87eb8
Compare
cc9a235
to
ce68561
Compare
mdimjasevic
approved these changes
Sep 14, 2021
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks great!
I left some comments inlined. I wasn't sure what's going on there so it'd be great if you could clarify that.
This factors out metadata fields from the `Conversation` type so that they can be reused elsewhere without duplicating code. At the moment they are only used in the internal `GET i/conversations/:cnv/meta` endpoint, but later on this extraction will be useful to improve the `get-conversations` federation RPC.
This is a refactoring of `LocalMember` to extract the member status fields (hidden/muted/archived) to their own type, so that they can later be reused to transform a remote conversation to a local one. Also, the `InternalMember` type constructor has been removed, since the only used instantiation of it was the `LocalMember` type synomyn.
The user domain has to be the same as the origin domain, so omitting it does not lose any information and saves us a check (which we weren't doing anyway).
This removes the hack of returning a fake self member in the get-conversations RPC, by introducing a different type for remote conversations. A `RemoteConversation` object contains the same information as a normal `Conversation`, except the self member is replaced by simply a `RoleName`, which is the only bit of information for remote users that is actually stored locally. The functions in `Galley.API.Mapping` have been rewritten to fit the new convention. Notes: - the Mapping tests have been commented out; they probably should be rewritten and become unit tests; - remote conversation status flags are still always set to their default values.
Since one2one conversations with remote users are not implemented yet, the test has been simplified, and it now only creates a group conversation.
Attempting to set hidden flag would incorrectly set the archived flag. This is now fixed.
Co-authored-by: Marko Dimjašević <[email protected]>
681b892
to
6d867cd
Compare
Moved the schema definition of `ConversationMetadata` closer to the type definition.
Replaced the hardcoded admin role for local members to a randomly generated role.
The user alice was incorrectly created as a local user, only to be then regarded as a remote one. This didn't impact the functionality of the test, but it created an unnecessary local user, and made the logic of the test confusing.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR implements the ability to update status flags (hidden/muted/archived) for remote conversations.
This adds fields to the cassandra table containing remote conversation membership information for local users, namely
otr_muted_status
,otr_muted_ref
,otr_archived
,otr_archived_ref
,hidden
,hidden_ref
. Note that the conversation role is not part of this table, because it is stored in the same backend as the conversation itself.The qualified endpoint stub for setting self member status has now been fully implemented.
The PR also contains a few refactorings, which were useful because of the split between self member status fields and conversation role:
get-conversations
RPC (SQCORE-917)Conversation
typeLocalMember
type and remove the type variableget-conversations
RPC return a (new type)RemoteConversation
,which does not contain any self member status fields, only a conversation role.
Checklist
make git-add-cassandra-schema
to update the cassandra schema documentation.changelog.d
.