Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
netbe committed Jan 27, 2025
1 parent 0928d4a commit 779fb1a
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 40 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -75,12 +75,8 @@ public struct OneOnOneMigrator: OneOnOneMigratorInterface {
in: context
)




await context.perform {



_ = context.saveOrRollback()
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ final class OneOnOneMigratorTests: XCTestCase {
XCTAssertEqual(mlsMessages[0].textMessageData?.messageText, "Hello World!")
XCTAssertTrue(mlsMessages[1].isKnock)
XCTAssertTrue(mlsMessages[2].isImage)

let systemMessage = try XCTUnwrap(mlsMessages[3] as? ZMSystemMessage)
XCTAssertEqual(systemMessage.systemMessageType, .mlsMigrationFinalized)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -712,11 +712,11 @@ struct ConversationEventPayloadProcessor {
domain: payload.qualifiedID?.domain,
in: context
)

conversation.conversationType = self.conversationType(for: conversation, from: conversationType)
updateAttributes(from: payload, for: conversation, context: context)
assignMessageProtocol(from: payload, for: conversation, in: context)

updateMetadata(from: payload, for: conversation, context: context)
updateMembers(from: payload, for: conversation, context: context)
updateConversationTimestamps(for: conversation, serverTimestamp: serverTimestamp)
Expand Down Expand Up @@ -864,11 +864,11 @@ struct ConversationEventPayloadProcessor {
conversation.messageProtocol = newMessageProtocol
}

private func updateMessageProtocol(
from payload: Payload.Conversation,
for conversation: ZMConversation,
in context: NSManagedObjectContext
) {
private func updateMessageProtocol(
from payload: Payload.Conversation,
for conversation: ZMConversation,
in context: NSManagedObjectContext
) {

guard let messageProtocolString = payload.messageProtocol else {
WireLogger.eventProcessing.warn("message protocol is missing")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -972,33 +972,6 @@ final class ConversationEventPayloadProcessorTests: MessagingTestBase {
XCTAssertTrue(self.oneToOneConversation.isArchived)
}
}

func testUpdateOrCreateConversation_OneToOne_Updates_MessageProtocol_InsertsSystemMessage() async throws {
// given
let qualifiedID = await syncMOC.perform {
self.oneToOneConversation.messageProtocol = .proteus
return self.oneToOneConversation.qualifiedID!
}
let payload = Payload.Conversation.stub(
qualifiedID: qualifiedID,
type: .oneOnOne,
messageProtocol: "mls"
)

// when
await sut.updateOrCreateConversation(
from: payload,
in: syncMOC
)

// then
try await syncMOC.perform {
let lastMessage = try XCTUnwrap(self.oneToOneConversation.lastMessage)
XCTAssertTrue(lastMessage.isSystem)
XCTAssertEqual(self.oneToOneConversation.messageProtocol, .mls)

}
}

// MARK: Self conversation

Expand Down

0 comments on commit 779fb1a

Please sign in to comment.