-
Notifications
You must be signed in to change notification settings - Fork 15
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
refactor: process conversation rename event - WPB-10177 #2175
base: develop
Are you sure you want to change the base?
Conversation
… up redundant messages code - WPB-10177
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.
LGTM, minor suggestions
message, | ||
to: conversation | ||
var systemMessageType: MessageType = switch reason { | ||
case .userDeleted, .left: |
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.
case .userDeleted, .left: | |
case .userDeleted, .userLeft: |
member: (senderID, senderDomain), | ||
date: date | ||
) | ||
case .removed: |
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.
case .removed: | |
case .userRemoved: |
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.
Nice work!
) | ||
|
||
guard let localConversation else { | ||
return WireLogger.eventProcessing.error( |
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.
Personally I find this pattern (returning void by calling something that returns void) super confusing. If I look at WireLogger.eventProcessing.error
without knowing about our WireLogger I assume we are actually throwing an error then see that there is no throw
. Is this a common pattern? I've only seen it at Wire.
to conversation: ZMConversation | ||
func updateConversationName( | ||
newName: String, | ||
conversationID: UUID, |
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.
Optional: We do have a lot of ID (UUID), domain (String?) pairs. They are almost a QualifiedID
but not quite. I wonder if there is an improvement we can make here to save some boilerplate.
I also wonder if it is worth representing a conversation id+domain differently from a sender id+domain to prevent accidentally passing incorrect values.
I would consider introducing the following kinds of types:
struct ConversationID {
id: UUID
domain: String?
}
) async -> Set<ZMUser> { | ||
await withTaskGroup(of: ZMUser.self) { taskGroup in | ||
for userID in userIDs { | ||
taskGroup.addTask { [self] in |
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.
Not a request for change but just a thought:
I think there is probably unnecessary overhead with awaiting, locking in core data etc here. To avoid this we I think we should have a UserLocalStore.fetchOrCreateUsers(userIDs: [(id: UUID, domain: String?)]) -> [ZMUser]
and have everything done within a single perform.
When wrapping core data it is probably more performant that our methods accept arrays of values I guess.
WPB-10177
Key points
This PR is part of the quick sync refactoring plan and is related to processing the multiple events we receive from the backend or the push channel.
Specifically, this PR is about porting the existing implementation of the
ConversationRename
event.In addition:
ConversationRepository
now that we have a dedicatedMessageRepository
MessageRepository
where we need to.Testing
Checklist
[WPB-XXX]
.