diff --git a/apps/ios/Shared/Model/AppAPITypes.swift b/apps/ios/Shared/Model/AppAPITypes.swift index 41caa3e1a7..49fce46418 100644 --- a/apps/ios/Shared/Model/AppAPITypes.swift +++ b/apps/ios/Shared/Model/AppAPITypes.swift @@ -1247,7 +1247,7 @@ indirect enum ChatEvent: Decodable, ChatAPIResult { case chatInfoUpdated(user: UserRef, chatInfo: ChatInfo) case newChatItems(user: UserRef, chatItems: [AChatItem]) case chatItemsStatusesUpdated(user: UserRef, chatItems: [AChatItem]) - case chatItemUpdated(user: UserRef, chatItem: AChatItem) + case chatItemUpdated(user: UserRef, chatItemUpdate: AChatItemUpdate) case chatItemReaction(user: UserRef, added: Bool, reaction: ACIReaction) case chatItemsDeleted(user: UserRef, chatItemDeletions: [ChatItemDeletion], byUser: Bool) // group events @@ -1417,7 +1417,7 @@ indirect enum ChatEvent: Decodable, ChatAPIResult { case let .chatItemsStatusesUpdated(u, chatItems): let itemsString = chatItems.map { chatItem in String(describing: chatItem) }.joined(separator: "\n") return withUser(u, itemsString) - case let .chatItemUpdated(u, chatItem): return withUser(u, String(describing: chatItem)) + case let .chatItemUpdated(u, chatItemUpdate): return withUser(u, String(describing: chatItemUpdate)) case let .chatItemReaction(u, added, reaction): return withUser(u, "added: \(added)\n\(String(describing: reaction))") case let .chatItemsDeleted(u, items, byUser): let itemsString = items.map { item in diff --git a/apps/ios/Shared/Model/ChatModel.swift b/apps/ios/Shared/Model/ChatModel.swift index 4d180f2164..23f82f437a 100644 --- a/apps/ios/Shared/Model/ChatModel.swift +++ b/apps/ios/Shared/Model/ChatModel.swift @@ -797,16 +797,46 @@ final class ChatModel: ObservableObject { return itemAdded } + func applyChatItemUpdate(_ cInfo: ChatInfo, _ cItem: ChatItem, _ prevItem: ChatItem) -> Bool { + var chatAdded = false + if cInfo.groupChatScope() == nil { + if let chat = getChat(cInfo.id) { + if chat.chatItems.last?.id == cItem.id { + chat.chatItems = [cItem] + } + let unread = unreadCountChange(prevItem, cItem) { $0.isRcvNew } + let mentions = unreadCountChange(prevItem, cItem) { $0.isRcvNew && $0.meta.userMention } + if unread != 0 || mentions != 0 { + unreadCollector.changeUnreadCounter(cInfo.id, by: unread, unreadMentions: mentions) + } + } else { + addChat(Chat(chatInfo: cInfo, chatItems: [cItem])) + chatAdded = true + } + if cItem.isDeletedContent || cItem.meta.itemDeleted != nil { + VoiceItemState.stopVoiceInChatView(cInfo, cItem) + } + } + if let ciIM = getCIItemsModel(cInfo, cItem), let i = getChatItemIndex(ciIM, cItem) { + _replaceChatItem(ciIM, at: i, with: cItem) + } + return chatAdded + } + + private func _replaceChatItem(_ ciIM: ItemsModel, at i: Int, with cItem: ChatItem) { + let oldStatus = ciIM.reversedChatItems[i].meta.itemStatus + let newStatus = cItem.meta.itemStatus + var ci = cItem + if shouldKeepOldSndCIStatus(oldStatus: oldStatus, newStatus: newStatus) { + ci.meta.itemStatus = oldStatus + } + _updateChatItem(ciIM: ciIM, at: i, with: ci) + ChatItemDummyModel.shared.sendUpdate() // TODO [knocking] review what's this + } + private func _upsertChatItem(_ ciIM: ItemsModel, _ cInfo: ChatInfo, _ cItem: ChatItem) -> Bool { if let i = getChatItemIndex(ciIM, cItem) { - let oldStatus = ciIM.reversedChatItems[i].meta.itemStatus - let newStatus = cItem.meta.itemStatus - var ci = cItem - if shouldKeepOldSndCIStatus(oldStatus: oldStatus, newStatus: newStatus) { - ci.meta.itemStatus = oldStatus - } - _updateChatItem(ciIM: ciIM, at: i, with: ci) - ChatItemDummyModel.shared.sendUpdate() // TODO [knocking] review what's this + _replaceChatItem(ciIM, at: i, with: cItem) return false } else { ciIM.reversedChatItems.insert(cItem, at: hasLiveDummy ? 1 : 0) diff --git a/apps/ios/Shared/Model/NtfManager.swift b/apps/ios/Shared/Model/NtfManager.swift index efd28d0ea5..0d5dcc838e 100644 --- a/apps/ios/Shared/Model/NtfManager.swift +++ b/apps/ios/Shared/Model/NtfManager.swift @@ -25,7 +25,7 @@ enum NtfCallAction { // Spec: spec/services/notifications.md#NtfManager class NtfManager: NSObject, UNUserNotificationCenterDelegate, ObservableObject { - static let shared = NtfManager() + static var shared = NtfManager() public var navigatingToChat = false private var granted = false @@ -274,7 +274,7 @@ class NtfManager: NSObject, UNUserNotificationCenterDelegate, ObservableObject { setNtfBadgeCount(max(0, UIApplication.shared.applicationIconBadgeNumber + count)) } - private func addNotification(_ content: UNMutableNotificationContent) { + func addNotification(_ content: UNMutableNotificationContent) { if !granted { return } let trigger = UNTimeIntervalNotificationTrigger(timeInterval: ntfTimeInterval, repeats: false) let request = UNNotificationRequest(identifier: appNotificationId, content: content, trigger: trigger) diff --git a/apps/ios/Shared/Model/SimpleXAPI.swift b/apps/ios/Shared/Model/SimpleXAPI.swift index cbb0be19ac..65b582e275 100644 --- a/apps/ios/Shared/Model/SimpleXAPI.swift +++ b/apps/ios/Shared/Model/SimpleXAPI.swift @@ -2763,8 +2763,8 @@ func processReceivedMsg(_ res: ChatEvent) async { } } } - case let .chatItemUpdated(user, aChatItem): - await chatItemSimpleUpdate(user, aChatItem) + case let .chatItemUpdated(user, update): + await chatItemUpdate(user, update) case let .chatItemReaction(user, _, r): if active(user) { await MainActor.run { @@ -3238,6 +3238,27 @@ func chatItemSimpleUpdate(_ user: any UserLike, _ aChatItem: AChatItem) async { } } +func chatItemUpdate(_ user: any UserLike, _ update: AChatItemUpdate) async { + let m = ChatModel.shared + let cInfo = update.chatInfo + let cItem = update.chatItem + let prevItem = update.prevChatItem + if active(user) { + if await MainActor.run(body: { m.applyChatItemUpdate(cInfo, cItem, prevItem) }) { + if cItem.showNotification { + NtfManager.shared.notifyMessageReceived(user, cInfo, cItem) + } + } + } else { + let change = unreadCountChange(prevItem, cItem) { $0.isRcvNew && cInfo.ntfsEnabled(chatItem: $0) } + if change > 0 { + await MainActor.run { m.increaseUnreadCounter(user: user) } + } else if change < 0 { + await MainActor.run { m.decreaseUnreadCounter(user: user) } + } + } +} + func groupChatItemsDeleted(_ user: UserRef, _ groupInfo: GroupInfo, _ chatItemIDs: Set, _ member_: GroupMember?) async { let m = ChatModel.shared if !active(user) { diff --git a/apps/ios/SimpleX Unit Tests/ChatItemUpdateTests.swift b/apps/ios/SimpleX Unit Tests/ChatItemUpdateTests.swift new file mode 100644 index 0000000000..82f46dd6e6 --- /dev/null +++ b/apps/ios/SimpleX Unit Tests/ChatItemUpdateTests.swift @@ -0,0 +1,211 @@ +import XCTest +import UserNotifications +@testable import SimpleX +@testable import SimpleXChat + +final class ChatItemUpdateTests: XCTestCase { + private let ntfManager = NtfManager.shared + private let sendCmd = sendSimpleXCmdStr + private var notified: [String] = [] + private var sent: [String] = [] + + @MainActor + override func setUp() async throws { + NtfManager.shared = RecordingNtfManager { [unowned self] in self.notified.append($0) } + ChatModel.shared.currentUser = User.sampleData + ChatModel.shared.users = [UserInfo(user: User.sampleData, unreadCount: 0)] + } + + @MainActor + override func tearDown() async throws { + for chat in ChatModel.shared.chats { ChatModel.shared.removeChat(chat.id) } + ChatModel.shared.im.reversedChatItems = [] + ChatModel.shared.chatId = nil + ChatModel.shared.currentUser = nil + ChatModel.shared.users = [] + NtfManager.shared = ntfManager + UNUserNotificationCenter.current().delegate = ntfManager + sendSimpleXCmdStr = sendCmd + } + + @MainActor + func testEditReplacesLoadedItem() async throws { + let events = try recordedEvents("updates/direct-edit") + try listChat(events[0]) + try openChat(events[0]) + await processReceivedMsg(events[0]) + XCTAssertEqual(loadedTexts(), ["hello"]) + await processReceivedMsg(events[1]) + XCTAssertEqual(loadedTexts(), ["hello there"]) + XCTAssertEqual(previewText(), "hello there") + try await assertCounts(1, 0, 1) + } + + @MainActor + func testUpdateOfItemNotLoadedInsertsNothing() async throws { + let events = try recordedEvents("updates/direct-edit") + try listChat(events[0]) + await processReceivedMsg(events[0]) + try openChat(events[0]) + await processReceivedMsg(events[1]) + XCTAssertEqual(loadedTexts(), []) + XCTAssertEqual(previewText(), "hello there") + await processReceivedMsg(events[2]) + XCTAssertEqual(loadedTexts(), ["how are you"]) + await processReceivedMsg(events[3]) + XCTAssertEqual(loadedTexts(), ["how are you"]) + XCTAssertEqual(previewText(), "how are you") + try await assertCounts(2, 0, 2) + } + + @MainActor + func testCountersFollowPreviousAndNewItem() async throws { + let events = try recordedEvents("updates/group-mention") + try listChat(events[0]) + await processReceivedMsg(events[0]) + try await assertCounts(1, 0, 1) + await processReceivedMsg(events[1]) + try await assertCounts(1, 1, 1) + await processReceivedMsg(events[2]) + try await assertCounts(1, 0, 1) + } + + @MainActor + func testMentionEditsInAnotherProfileChangeItsUnreadCount() async throws { + let events = try recordedEvents("updates/group-mention") + ChatModel.shared.currentUser = otherUser() + await processReceivedMsg(events[0]) + await processReceivedMsg(events[1]) + XCTAssertEqual(ChatModel.shared.users.first?.unreadCount, 1) + await processReceivedMsg(events[2]) + XCTAssertEqual(ChatModel.shared.users.first?.unreadCount, 0) + XCTAssertEqual(notified, []) + } + + @MainActor + func testUpdateOfChatNotListedAddsItAndNotifies() async throws { + let events = try recordedEvents("updates/direct-edit") + await processReceivedMsg(events[1]) + XCTAssertEqual(previewText(), "hello there") + XCTAssertEqual(notified, ["hello there"]) + } + + @MainActor + func testRecreatedItemIsCountedAndNotified() async throws { + let events = try recordedEvents("updates/direct-recreated") + try listChat(events[0]) + await processReceivedMsg(events[0]) + XCTAssertEqual(previewText(), "hello again") + XCTAssertEqual(notified, ["hello again"]) + try await assertCounts(1, 0, 1) + } + + @MainActor + func testEditInAnotherProfileDoesNotNotify() async throws { + let events = try recordedEvents("updates/direct-edit") + ChatModel.shared.currentUser = otherUser() + await processReceivedMsg(events[0]) + await processReceivedMsg(events[1]) + XCTAssertEqual(notified, ["hello"]) + XCTAssertEqual(ChatModel.shared.users.first?.unreadCount, 1) + } + + @MainActor + func testMissedCallDoesNotNotify() async throws { + let events = try recordedEvents("updates/missed-call") + try listChat(events[0]) + await processReceivedMsg(events[0]) + await processReceivedMsg(events[1]) + guard case let .rcvCall(status, _)? = ChatModel.shared.chats.first?.chatItems.last?.content else { return XCTFail("no call item") } + XCTAssertEqual(status, .missed) + XCTAssertEqual(notified, []) + try await assertCounts(1, 0, 1) + } + + @MainActor + func testMissedCallInAnotherProfileDoesNotNotify() async throws { + let events = try recordedEvents("updates/missed-call") + ChatModel.shared.currentUser = otherUser() + await processReceivedMsg(events[0]) + await processReceivedMsg(events[1]) + XCTAssertEqual(notified, []) + XCTAssertEqual(ChatModel.shared.users.first?.unreadCount, 1) + } + + @MainActor + func testUpdateResponseHasUpdatedItem() async throws { + let commands = try XCTUnwrap((try fixtureJSON("updates/update-response") as? [String: [String: Any]])?["commands"]) + let response = try XCTUnwrap(commands.values.first) + sendSimpleXCmdStr = { [unowned self] cmd, _, _ in + self.sent.append(cmd) + return try? JSONSerialization.data(withJSONObject: singleFieldJSON(response)) + } + let item = try await apiUpdateChatItem(type: .direct, id: 2, scope: nil, itemId: 8, updatedMessage: UpdatedMessage(msgContent: .text("hello there"), mentions: [:])) + XCTAssertEqual(sent.count, 1) + XCTAssertTrue(sent.first?.hasPrefix("/_update item @2 8 ") ?? false, "\(sent)") + XCTAssertEqual(item.id, 8) + XCTAssertEqual(item.text, "hello there") + } + + private func recordedEvents(_ fixture: String) throws -> [ChatEvent] { + try XCTUnwrap(try fixtureJSON(fixture) as? [Any]).map { json in + let decoded: APIResult = decodeAPIResult(try JSONSerialization.data(withJSONObject: singleFieldJSON(json))) + let event: ChatEvent? = if case let .result(r) = decoded { r } else { nil } + return try XCTUnwrap(event, "event not decoded: \(decoded.responseType)") + } + } + + private func otherUser() -> User { + var user = User.sampleData + user.userId = 2 + return user + } + + private func chatInfo(_ event: ChatEvent) throws -> ChatInfo { + let chatItems: [AChatItem]? = if case let .newChatItems(_, items) = event { items } else { nil } + return try XCTUnwrap(chatItems?.first?.chatInfo, "not a new item: \(event.responseType)") + } + + @MainActor + private func listChat(_ event: ChatEvent) throws { + ChatModel.shared.addChat(Chat(chatInfo: try chatInfo(event), chatItems: [])) + } + + @MainActor + private func openChat(_ event: ChatEvent) throws { + ChatModel.shared.chatId = try chatInfo(event).id + } + + @MainActor + private func loadedTexts() -> [String] { + ChatModel.shared.im.reversedChatItems.reversed().map(\.text) + } + + @MainActor + private func previewText() -> String? { + ChatModel.shared.chats.first?.chatItems.last?.text + } + + @MainActor + private func assertCounts(_ unread: Int, _ mentions: Int, _ userUnread: Int, file: StaticString = #filePath, line: UInt = #line) async throws { + func counts() -> [Int] { + let stats = ChatModel.shared.chats.first?.chatStats + return [stats?.unreadCount ?? -1, stats?.unreadMentions ?? -1, ChatModel.shared.users.first?.unreadCount ?? -1] + } + try? await waitFor { counts() == [unread, mentions, userUnread] } + XCTAssertEqual(counts(), [unread, mentions, userUnread], file: file, line: line) + } +} + +private final class RecordingNtfManager: NtfManager { + private let record: (String) -> Void + + init(record: @escaping (String) -> Void) { + self.record = record + super.init() + } + + override func addNotification(_ content: UNMutableNotificationContent) { + record(content.body) + } +} diff --git a/apps/ios/SimpleX Unit Tests/NameAlertsTests.swift b/apps/ios/SimpleX Unit Tests/NameAlertsTests.swift index 489e9a48fc..6b3290c351 100644 --- a/apps/ios/SimpleX Unit Tests/NameAlertsTests.swift +++ b/apps/ios/SimpleX Unit Tests/NameAlertsTests.swift @@ -271,11 +271,6 @@ final class NameAlertsTests: XCTestCase { } } - private func fixtureJSON(_ fixture: String) throws -> Any { - let url = URL(fileURLWithPath: #filePath).deletingLastPathComponent().appendingPathComponent("../../../tests/fixtures/api/\(fixture).json") - return try JSONSerialization.jsonObject(with: Data(contentsOf: url)) - } - private func unrecordedRequest(_ request: String) { locked { unrecorded.append(request) } } @@ -325,15 +320,6 @@ final class NameAlertsTests: XCTestCase { } } - @MainActor - private func waitFor(_ condition: @escaping () -> Bool) async throws { - for _ in 0..<600 { - if condition() { return } - try await Task.sleep(nanoseconds: 50_000_000) - } - throw XCTestError(.timeoutWhileWaiting) - } - @MainActor private func presented() -> UIViewController? { if let shown = getTopViewController(), shown.presentingViewController != nil, !shown.isBeingPresented, !shown.isBeingDismissed { shown } else { nil } @@ -408,10 +394,15 @@ private struct SearchHost: View { } } -private func singleFieldJSON(_ value: Any) -> Any { +func fixtureJSON(_ fixture: String) throws -> Any { + let url = URL(fileURLWithPath: #filePath).deletingLastPathComponent().appendingPathComponent("../../../tests/fixtures/api/\(fixture).json") + return try JSONSerialization.jsonObject(with: Data(contentsOf: url)) +} + +func singleFieldJSON(_ value: Any) -> Any { if let object = value as? [String: Any] { var fields = object.mapValues(singleFieldJSON) - guard let tag = object["type"] as? String else { return fields } + guard let tag = object["type"] as? String, !msgContentTypes.contains(tag) else { return fields } fields["type"] = nil return ["_owsf": true, tag: fields] } else if let array = value as? [Any] { @@ -420,3 +411,14 @@ private func singleFieldJSON(_ value: Any) -> Any { return value } } + +private let msgContentTypes: Set = ["text", "link", "image", "video", "voice", "file", "report", "chat"] + +@MainActor +func waitFor(_ condition: @escaping () -> Bool) async throws { + for _ in 0..<600 { + if condition() { return } + try await Task.sleep(nanoseconds: 50_000_000) + } + throw XCTestError(.timeoutWhileWaiting) +} diff --git a/apps/ios/SimpleX.xcodeproj/project.pbxproj b/apps/ios/SimpleX.xcodeproj/project.pbxproj index 0e209cbc73..530bc4c124 100644 --- a/apps/ios/SimpleX.xcodeproj/project.pbxproj +++ b/apps/ios/SimpleX.xcodeproj/project.pbxproj @@ -271,6 +271,7 @@ E5AEC0B22F9C000100270665 /* TerminalItemView.swift in Sources */ = {isa = PBXBuildFile; fileRef = E5AEC0B12F9C000100270665 /* TerminalItemView.swift */; }; E5AEC0C22F9C000100270665 /* SnapshotTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = E5AEC0C12F9C000100270665 /* SnapshotTests.swift */; }; 4E57A1E70000000000000006 /* NameAlertsTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4E57A1E70000000000000005 /* NameAlertsTests.swift */; }; + 4E57A1E70000000000000014 /* ChatItemUpdateTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4E57A1E70000000000000013 /* ChatItemUpdateTests.swift */; }; E5AEC0AF2F91A73500270665 /* ComposeChatLinkView.swift in Sources */ = {isa = PBXBuildFile; fileRef = E5AEC0AE2F91A73500270665 /* ComposeChatLinkView.swift */; }; E5C0BBE82F82B45500EA7527 /* SimpleXAssets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = E5C0BBE72F82B45500EA7527 /* SimpleXAssets.xcassets */; }; E5C0BBEB2F82B45500EA7527 /* SharedAssets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = E5C0BBEA2F82B45500EA7527 /* SharedAssets.xcassets */; }; @@ -682,6 +683,7 @@ E5AEC0C12F9C000100270665 /* SnapshotTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SnapshotTests.swift; sourceTree = ""; }; E5AEC0C32F9C000100270665 /* SimpleX Snapshots.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "SimpleX Snapshots.xctest"; sourceTree = BUILT_PRODUCTS_DIR; }; 4E57A1E70000000000000005 /* NameAlertsTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NameAlertsTests.swift; sourceTree = ""; }; + 4E57A1E70000000000000013 /* ChatItemUpdateTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ChatItemUpdateTests.swift; sourceTree = ""; }; 4E57A1E70000000000000007 /* SimpleX Unit Tests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "SimpleX Unit Tests.xctest"; sourceTree = BUILT_PRODUCTS_DIR; }; E5AEC0AE2F91A73500270665 /* ComposeChatLinkView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ComposeChatLinkView.swift; sourceTree = ""; }; E5C0BBE72F82B45500EA7527 /* SimpleXAssets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = SimpleXAssets.xcassets; sourceTree = ""; }; @@ -1035,6 +1037,7 @@ isa = PBXGroup; children = ( 4E57A1E70000000000000005 /* NameAlertsTests.swift */, + 4E57A1E70000000000000013 /* ChatItemUpdateTests.swift */, ); path = "SimpleX Unit Tests"; sourceTree = ""; @@ -1922,6 +1925,7 @@ buildActionMask = 2147483647; files = ( 4E57A1E70000000000000006 /* NameAlertsTests.swift in Sources */, + 4E57A1E70000000000000014 /* ChatItemUpdateTests.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/apps/ios/SimpleXChat/ChatTypes.swift b/apps/ios/SimpleXChat/ChatTypes.swift index 947b013351..74d514922d 100644 --- a/apps/ios/SimpleXChat/ChatTypes.swift +++ b/apps/ios/SimpleXChat/ChatTypes.swift @@ -3910,6 +3910,12 @@ public struct AChatItem: Decodable, Hashable { public var chatItem: ChatItem } +public struct AChatItemUpdate: Decodable, Hashable { + public var chatInfo: ChatInfo + public var chatItem: ChatItem + public var prevChatItem: ChatItem +} + public struct CIMentionMember: Decodable, Hashable { public var groupMemberId: Int64 public var displayName: String @@ -4669,6 +4675,10 @@ public enum CIStatus: Decodable, Hashable { } } +public func unreadCountChange(_ prevItem: ChatItem, _ cItem: ChatItem, _ counted: (ChatItem) -> Bool) -> Int { + (counted(cItem) ? 1 : 0) - (counted(prevItem) ? 1 : 0) +} + public func shouldKeepOldSndCIStatus(oldStatus: CIStatus, newStatus: CIStatus) -> Bool { switch (oldStatus, newStatus) { case (.sndRcvd, let new) where !new.isSndRcvd: diff --git a/apps/ios/spec/api.md b/apps/ios/spec/api.md index da6cd07932..a274bf67c2 100644 --- a/apps/ios/spec/api.md +++ b/apps/ios/spec/api.md @@ -388,7 +388,7 @@ Event processing entry point: [`processReceivedMsg`](../Shared/Model/SimpleXAPI. | Event | Key Fields | Description | Source | |-------|-----------|-------------|--------| | `newChatItems` | `user, chatItems: [AChatItem]` | New messages received | [L1084](../Shared/Model/AppAPITypes.swift#L1084) | -| `chatItemUpdated` | `user, chatItem: AChatItem` | Message edited remotely | [L1086](../Shared/Model/AppAPITypes.swift#L1086) | +| `chatItemUpdated` | `user, chatItemUpdate: AChatItemUpdate` | Message edited remotely; `chatItemUpdate.prevChatItem` is the item before the update | [L1250](../Shared/Model/AppAPITypes.swift#L1250) | | `chatItemReaction` | `user, added, reaction: ACIReaction` | Reaction added/removed | [L1087](../Shared/Model/AppAPITypes.swift#L1087) | | `chatItemsDeleted` | `user, chatItemDeletions, byUser` | Messages deleted | [L1088](../Shared/Model/AppAPITypes.swift#L1088) | | `chatItemsStatusesUpdated` | `user, chatItems: [AChatItem]` | Delivery status changed | [L1085](../Shared/Model/AppAPITypes.swift#L1085) | diff --git a/apps/ios/spec/services/notifications.md b/apps/ios/spec/services/notifications.md index 1062833f9c..46e34d0e88 100644 --- a/apps/ios/spec/services/notifications.md +++ b/apps/ios/spec/services/notifications.md @@ -63,13 +63,13 @@ The mode is stored in `ChatModel.notificationMode` and persisted in `GroupDefaul **File**: [`Shared/Model/NtfManager.swift`](../../Shared/Model/NtfManager.swift) -Central notification coordinator. Singleton: `NtfManager.shared`. +Central notification coordinator. Singleton: `NtfManager.shared`, a `var` that unit tests replace with a subclass overriding `addNotification`. ### [Class Definition](../../Shared/Model/NtfManager.swift#L27) ```swift class NtfManager: NSObject, UNUserNotificationCenterDelegate, ObservableObject { - static let shared = NtfManager() + static var shared = NtfManager() public var navigatingToChat = false private var granted = false private var prevNtfTime: Dictionary = [:] diff --git a/apps/ios/spec/state.md b/apps/ios/spec/state.md index 88f798666c..a47ceb2f2a 100644 --- a/apps/ios/spec/state.md +++ b/apps/ios/spec/state.md @@ -443,6 +443,19 @@ Haskell core generates ChatEvent.newChatItems → SwiftUI re-renders affected views via @Published observation ``` +### Updating a Message (Event) +``` +Haskell core generates ChatEvent.chatItemUpdated(user, chatItemUpdate: AChatItemUpdate) + → ChatModel.applyChatItemUpdate(chatInfo, chatItem, prevChatItem): + 1. Change ChatStats by the difference between prevItem and cItem + (unread: isRcvNew; mentions: isRcvNew && userMention) + 2. Replace the preview if it is this item + 3. Replace the item in ItemsModel.reversedChatItems if it is loaded, + never insert it + → Another user's event changes that user's unread counter by the same difference + → An update of a locally deleted message creates it again: the core sends newChatItems +``` + ### Sending a Message ``` User taps send in ComposeView diff --git a/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/model/ChatModel.kt b/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/model/ChatModel.kt index 364feeeb28..403af4185a 100644 --- a/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/model/ChatModel.kt +++ b/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/model/ChatModel.kt @@ -691,30 +691,69 @@ object ChatModel { } // update current scope withContext(Dispatchers.Main) { - if (chatItemBelongsToScope(cInfo, cItem)) { - if (cItem.isDeletedContent || cItem.meta.itemDeleted != null) { - AudioPlayer.stop(cItem) - } - val items = chatItems.value - val itemIndex = items.indexOfFirst { it.id == cItem.id } - if (itemIndex >= 0) { - val oldStatus = items[itemIndex].meta.itemStatus - val newStatus = cItem.meta.itemStatus - val ci = if (shouldKeepOldSndCIStatus(oldStatus, newStatus)) { - cItem.copy(meta = cItem.meta.copy(itemStatus = oldStatus)) - } else { - cItem - } - items[itemIndex] = ci - } else { - addToChatItems(cItem) - itemAdded = true - } + if (chatItemBelongsToScope(cInfo, cItem) && !replaceLoadedChatItem(cItem)) { + addToChatItems(cItem) + itemAdded = true } } return itemAdded } + suspend fun applyChatItemUpdate(rhId: Long?, cInfo: ChatInfo, cItem: ChatItem, prevItem: ChatItem): Boolean { + var itemAdded = false + if (cInfo.groupChatScope() == null) { + val i = getChatIndex(rhId, cInfo.id) + if (i >= 0) { + val chat = chats[i] + val unreadChange = unreadCountChange(prevItem, cItem) { it.isRcvNew } + val mentionsChange = unreadCountChange(prevItem, cItem) { it.isRcvNew && it.meta.userMention } + val countersChanged = secondaryContextFilter == null && (unreadChange != 0 || mentionsChange != 0) + val wasUnread = chat.unreadTag + chats[i] = chat.copy( + chatItems = if (chat.chatItems.lastOrNull()?.id == cItem.id) arrayListOf(cItem) else chat.chatItems, + chatStats = if (countersChanged) { + chat.chatStats.copy( + unreadCount = maxOf(0, chat.chatStats.unreadCount + unreadChange), + unreadMentions = maxOf(0, chat.chatStats.unreadMentions + mentionsChange) + ) + } else { + chat.chatStats + } + ) + if (countersChanged) { + changeUnreadCounterInPrimaryContext(rhId, currentUser.value!!, unreadChange) + updateChatTagReadInPrimaryContext(chats[i], wasUnread) + } + } else { + addChat(Chat(remoteHostId = rhId, chatInfo = cInfo, chatItems = arrayListOf(cItem))) + itemAdded = true + } + } + withContext(Dispatchers.Main) { + if (chatItemBelongsToScope(cInfo, cItem)) { + replaceLoadedChatItem(cItem) + } + } + return itemAdded + } + + private fun replaceLoadedChatItem(cItem: ChatItem): Boolean { + if (cItem.isDeletedContent || cItem.meta.itemDeleted != null) { + AudioPlayer.stop(cItem) + } + val items = chatItems.value + val itemIndex = items.indexOfFirst { it.id == cItem.id } + if (itemIndex < 0) return false + val oldStatus = items[itemIndex].meta.itemStatus + val newStatus = cItem.meta.itemStatus + items[itemIndex] = if (shouldKeepOldSndCIStatus(oldStatus, newStatus)) { + cItem.copy(meta = cItem.meta.copy(itemStatus = oldStatus)) + } else { + cItem + } + return true + } + suspend fun updateChatItem(cInfo: ChatInfo, cItem: ChatItem, status: CIStatus? = null, atIndex: Int? = null) { withContext(Dispatchers.Main) { if (chatItemBelongsToScope(cInfo, cItem)) { @@ -3510,6 +3549,13 @@ class AChatItem ( val chatItem: ChatItem ) +@Serializable +class AChatItemUpdate ( + val chatInfo: ChatInfo, + val chatItem: ChatItem, + val prevChatItem: ChatItem +) + @Serializable class ACIReaction( val chatInfo: ChatInfo, @@ -4246,6 +4292,9 @@ sealed class CIStatus { } } +fun unreadCountChange(prevItem: ChatItem, cItem: ChatItem, counted: (ChatItem) -> Boolean): Int = + (if (counted(cItem)) 1 else 0) - (if (counted(prevItem)) 1 else 0) + fun shouldKeepOldSndCIStatus(oldStatus: CIStatus, newStatus: CIStatus): Boolean = when { oldStatus is CIStatus.SndRcvd && newStatus !is CIStatus.SndRcvd -> true diff --git a/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/model/SimpleXAPI.kt b/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/model/SimpleXAPI.kt index 8a7c9fe2a0..17c50556c3 100644 --- a/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/model/SimpleXAPI.kt +++ b/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/model/SimpleXAPI.kt @@ -1350,7 +1350,7 @@ object ChatController { suspend fun apiUpdateChatItem(rh: Long?, type: ChatType, id: Long, scope: GroupChatScope?, itemId: Long, updatedMessage: UpdatedMessage, live: Boolean = false): AChatItem? { val r = sendCmd(rh, CC.ApiUpdateChatItem(type, id, scope, itemId, updatedMessage, live)) when { - r is API.Result && r.res is CR.ChatItemUpdated -> return r.res.chatItem + r is API.Result && r.res is CR.ChatItemUpdated && r.res.chatItem != null -> return r.res.chatItem r is API.Result && r.res is CR.ChatItemNotChanged -> return r.res.chatItem r is API.Error && r.err is ChatError.ChatErrorStore && r.err.storeError is StoreError.LargeMsg -> { val mc = updatedMessage.msgContent @@ -3135,7 +3135,7 @@ object ChatController { } } is CR.ChatItemUpdated -> - chatItemUpdateNotify(rhId, r.user, r.chatItem) + if (r.chatItemUpdate != null) chatItemUpdateNotify(rhId, r.user, r.chatItemUpdate) is CR.ChatItemReaction -> { if (active(r.user)) { withContext(Dispatchers.Main) { @@ -3844,24 +3844,25 @@ object ChatController { } } - private suspend fun chatItemUpdateNotify(rh: Long?, user: UserLike, aChatItem: AChatItem) { - val cInfo = aChatItem.chatInfo - val cItem = aChatItem.chatItem - val notify = { ntfManager.notifyMessageReceived(rh, user, cInfo, cItem) } + private suspend fun chatItemUpdateNotify(rh: Long?, user: UserLike, update: AChatItemUpdate) { + val cInfo = update.chatInfo + val cItem = update.chatItem + val prevItem = update.prevChatItem if (!activeUser(rh, user)) { - notify() + val unreadChange = unreadCountChange(prevItem, cItem) { it.isRcvNew && cInfo.ntfsEnabled(it) } + if (unreadChange > 0) { + withContext(Dispatchers.Main) { chatModel.chatsContext.increaseUnreadCounter(rh, user) } + } else if (unreadChange < 0) { + withContext(Dispatchers.Main) { chatModel.chatsContext.decreaseUnreadCounter(rh, user) } + } } else { val createdChat = withContext(Dispatchers.Main) { - chatModel.chatsContext.upsertChatItem(rh, cInfo, cItem) + chatModel.chatsContext.applyChatItemUpdate(rh, cInfo, cItem, prevItem) } withContext(Dispatchers.Main) { - chatModel.secondaryChatsContext.value?.upsertChatItem(rh, cInfo, cItem) - } - if (createdChat) { - notify() - } else if (cItem.content is CIContent.RcvCall && cItem.content.status == CICallStatus.Missed) { - notify() + chatModel.secondaryChatsContext.value?.applyChatItemUpdate(rh, cInfo, cItem, prevItem) } + if (createdChat) ntfManager.notifyMessageReceived(rh, user, cInfo, cItem) } } @@ -6928,7 +6929,7 @@ sealed class CR { @Serializable @SerialName("newChatItems") class NewChatItems(val user: UserRef, val chatItems: List): CR() @Serializable @SerialName("chatMsgContent") class ChatMsgContent(val user: UserRef, val msgContent: MsgContent): CR() @Serializable @SerialName("chatItemsStatusesUpdated") class ChatItemsStatusesUpdated(val user: UserRef, val chatItems: List): CR() - @Serializable @SerialName("chatItemUpdated") class ChatItemUpdated(val user: UserRef, val chatItem: AChatItem): CR() + @Serializable @SerialName("chatItemUpdated") class ChatItemUpdated(val user: UserRef, val chatItem: AChatItem? = null, val chatItemUpdate: AChatItemUpdate? = null): CR() @Serializable @SerialName("chatItemNotChanged") class ChatItemNotChanged(val user: UserRef, val chatItem: AChatItem): CR() @Serializable @SerialName("chatItemReaction") class ChatItemReaction(val user: UserRef, val added: Boolean, val reaction: ACIReaction): CR() @Serializable @SerialName("reactionMembers") class ReactionMembers(val user: UserRef, val memberReactions: List): CR() @@ -7332,7 +7333,7 @@ sealed class CR { is NewChatItems -> withUser(user, chatItems.joinToString("\n") { json.encodeToString(it) }) is ChatMsgContent -> withUser(user, msgContent.toString()) is ChatItemsStatusesUpdated -> withUser(user, chatItems.joinToString("\n") { json.encodeToString(it) }) - is ChatItemUpdated -> withUser(user, json.encodeToString(chatItem)) + is ChatItemUpdated -> withUser(user, "chatItem: ${json.encodeToString(chatItem)}\nchatItemUpdate: ${json.encodeToString(chatItemUpdate)}") is ChatItemNotChanged -> withUser(user, json.encodeToString(chatItem)) is ChatItemReaction -> withUser(user, "added: $added\n${json.encodeToString(reaction)}") is ReactionMembers -> withUser(user, "memberReactions: ${json.encodeToString(memberReactions)}") diff --git a/apps/multiplatform/common/src/desktopTest/kotlin/chat/simplex/app/ChatItemUpdateTest.kt b/apps/multiplatform/common/src/desktopTest/kotlin/chat/simplex/app/ChatItemUpdateTest.kt new file mode 100644 index 0000000000..eb4b748bd5 --- /dev/null +++ b/apps/multiplatform/common/src/desktopTest/kotlin/chat/simplex/app/ChatItemUpdateTest.kt @@ -0,0 +1,198 @@ +package chat.simplex.app + +import chat.simplex.common.model.* +import chat.simplex.common.platform.NotificationAction +import chat.simplex.common.platform.NtfManager +import chat.simplex.common.platform.chatSendCmdRetry +import chat.simplex.common.platform.ntfManager +import chat.simplex.common.simplexWindowState +import chat.simplex.common.views.call.RcvCallInvitation +import kotlinx.coroutines.Dispatchers +import kotlinx.coroutines.runBlocking +import kotlinx.coroutines.withContext +import kotlinx.serialization.decodeFromString +import kotlinx.serialization.json.Json +import kotlinx.serialization.json.jsonObject +import kotlin.test.* + +class ChatItemUpdateTest { + private val sendCmd = chatSendCmdRetry + private val notifications = mutableListOf() + + @BeforeTest + fun setUp() { + ntfManager = object : NtfManager() { + override fun displayNotification(user: UserLike, chatId: String, displayName: String, msgText: String, image: String?, actions: List Unit>>) { + synchronized(notifications) { notifications += msgText } + } + override fun notifyCallInvitation(invitation: RcvCallInvitation): Boolean = false + override fun hasNotificationsForChat(chatId: String): Boolean = false + override fun cancelNotificationsForChat(chatId: String) {} + override fun cancelNotificationsForUser(userId: Long) {} + override fun cancelCallNotification() {} + override fun cancelAllNotifications() {} + override fun showMessage(title: String, text: String) {} + override fun androidCreateNtfChannelsMaybeShowAlert() {} + } + simplexWindowState.windowFocused.value = false + ChatModel.currentUser.value = User.sampleData + ChatModel.users.add(UserInfo(User.sampleData, 0)) + } + + @AfterTest + fun tearDown() { + ChatModel.chatsContext.chats.value.clear() + ChatModel.chatsContext.chatItems.value.clear() + ChatModel.chatId.value = null + ChatModel.currentUser.value = null + ChatModel.users.clear() + simplexWindowState.windowFocused.value = true + chatSendCmdRetry = sendCmd + } + + @Test + fun editReplacesLoadedItem() = recorded("updates/direct-edit") { (received, edited) -> + listChat(received) + openChat(received) + receive(received) + assertNotified("hello") + assertEquals(listOf("hello"), loadedTexts()) + receive(edited) + assertEquals(listOf("hello there"), loadedTexts()) + assertEquals("hello there", previewText()) + assertNotified("hello") + } + + @Test + fun updateOfItemNotLoadedInsertsNothing() = recorded("updates/direct-edit") { (received, edited, next, earlierEdited) -> + listChat(received) + receive(received) + assertNotified("hello") + openChat(received) + receive(edited) + assertEquals(listOf(), loadedTexts()) + assertEquals("hello there", previewText()) + receive(next) + assertNotified("hello", "how are you") + assertEquals(listOf("how are you"), loadedTexts()) + receive(earlierEdited) + assertEquals(listOf("how are you"), loadedTexts()) + assertEquals("how are you", previewText()) + } + + @Test + fun countersFollowPreviousAndNewItem() = recorded("updates/group-mention") { (received, mentioned, unmentioned) -> + listChat(received) + receive(received) + assertEventually(Triple(1, 0, 1)) { counts() } + receive(mentioned) + assertEquals(Triple(1, 1, 1), counts()) + receive(unmentioned) + assertEquals(Triple(1, 0, 1), counts()) + } + + @Test + fun mentionEditsInAnotherProfileChangeItsUnreadCount() = recorded("updates/group-mention") { (received, mentioned, unmentioned) -> + ChatModel.currentUser.value = User.sampleData.copy(userId = 2) + receive(received) + receive(mentioned) + assertEquals(1, ChatModel.users[0].unreadCount) + receive(unmentioned) + assertEquals(0, ChatModel.users[0].unreadCount) + assertNotified() + } + + @Test + fun updateOfChatNotListedAddsItAndNotifies() = recorded("updates/direct-edit") { (_, edited) -> + receive(edited) + assertEquals("hello there", previewText()) + assertNotified("hello there") + } + + @Test + fun recreatedItemIsCountedAndNotified() = recorded("updates/direct-recreated") { (recreated) -> + listChat(recreated) + receive(recreated) + assertNotified("hello again") + assertEquals("hello again", previewText()) + assertEquals(Triple(1, 0, 1), counts()) + } + + @Test + fun editInAnotherProfileDoesNotNotify() = recorded("updates/direct-edit") { (received, edited) -> + ChatModel.currentUser.value = User.sampleData.copy(userId = 2) + receive(received) + assertNotified("hello") + receive(edited) + assertNotified("hello") + assertEquals(1, ChatModel.users[0].unreadCount) + } + + @Test + fun missedCallDoesNotNotify() = recorded("updates/missed-call") { (invited, missed) -> + listChat(invited) + receive(invited) + assertEventually(Triple(1, 0, 1)) { counts() } + receive(missed) + assertEquals(CICallStatus.Missed, (ChatModel.chatsContext.chats.value.single().chatItems.last().content as CIContent.RcvCall).status) + assertNotified() + } + + @Test + fun missedCallInAnotherProfileDoesNotNotify() = recorded("updates/missed-call") { (invited, missed) -> + ChatModel.currentUser.value = User.sampleData.copy(userId = 2) + receive(invited) + assertEventually(1) { ChatModel.users[0].unreadCount } + receive(missed) + assertNotified() + assertEquals(1, ChatModel.users[0].unreadCount) + } + + @Test + fun responseAndEventDecodeToTheirFields() = recorded("updates/direct-edit") { (_, edited) -> + val response = Json.parseToJsonElement(fixtureText("updates/update-response")).jsonObject.getValue("commands").jsonObject.values.single().toString() + val sent = mutableListOf() + chatSendCmdRetry = { _, cmd, _ -> sent += cmd; response } + val updated = ChatController.apiUpdateChatItem(null, ChatType.Direct, 2, null, 8, UpdatedMessage(MsgContent.MCText("hello there"), mapOf())) + assertTrue(sent.single().startsWith("/_update item @2 8 ")) + assertEquals(8L, updated?.chatItem?.id) + assertEquals("hello there", updated?.chatItem?.text) + val event = edited.result as CR.ChatItemUpdated + assertEquals("hello there", event.chatItemUpdate?.chatItem?.text) + assertEquals("hello", event.chatItemUpdate?.prevChatItem?.text) + assertNull(event.chatItem) + } + + private fun recorded(fixture: String, test: suspend (List) -> Unit) = runBlocking { + test(json.decodeFromString(fixtureText(fixture))) + } + + private suspend fun listChat(event: API) = withContext(Dispatchers.Main) { + ChatModel.chatsContext.updateChat(null, chatInfo(event)) + } + + private fun openChat(event: API) { + ChatModel.chatId.value = chatInfo(event).id + } + + private suspend fun receive(event: API) = ChatController.processReceivedMsg(event) + + private fun chatInfo(event: API): ChatInfo = (event.result as CR.NewChatItems).chatItems.single().chatInfo + + private fun loadedTexts(): List = ChatModel.chatsContext.chatItems.value.map { it.text } + + private fun previewText(): String? = ChatModel.chatsContext.chats.value.single().chatItems.lastOrNull()?.text + + private fun counts(): Triple { + val stats = ChatModel.chatsContext.chats.value.single().chatStats + return Triple(stats.unreadCount, stats.unreadMentions, ChatModel.users[0].unreadCount) + } + + private fun assertNotified(vararg texts: String) = assertEventually(texts.toList()) { synchronized(notifications) { notifications.toList() } } + + private fun assertEventually(expected: T, actual: () -> T) { + val until = System.currentTimeMillis() + 5_000 + while (actual() != expected && System.currentTimeMillis() < until) Thread.sleep(10) + assertEquals(expected, actual()) + } +} diff --git a/apps/multiplatform/common/src/desktopTest/kotlin/chat/simplex/app/NameAlertsTest.kt b/apps/multiplatform/common/src/desktopTest/kotlin/chat/simplex/app/NameAlertsTest.kt index 5b7d7a5f0c..486a65495f 100644 --- a/apps/multiplatform/common/src/desktopTest/kotlin/chat/simplex/app/NameAlertsTest.kt +++ b/apps/multiplatform/common/src/desktopTest/kotlin/chat/simplex/app/NameAlertsTest.kt @@ -418,9 +418,9 @@ class NameAlertsTest { private fun chatInfo(id: String): ChatInfo = ChatModel.chatsContext.chats.value.first { it.id == id }.chatInfo - private fun fixtureText(name: String): String = File("../../../tests/fixtures/api/$name.json").readText() - private companion object { const val SIMPLEX_NAME = "@alice.simplex" } } + +internal fun fixtureText(name: String): String = File("../../../tests/fixtures/api/$name.json").readText() diff --git a/apps/multiplatform/spec/api.md b/apps/multiplatform/spec/api.md index 66cb927bba..48623364d5 100644 --- a/apps/multiplatform/spec/api.md +++ b/apps/multiplatform/spec/api.md @@ -342,7 +342,7 @@ Events handled in `processReceivedMsg` include: | `ContactDeletedByContact` | A contact deleted their side of the conversation | | `ReceivedContactRequest` | An incoming contact request arrived | | `NewChatItems` | New messages received | -| `ChatItemUpdated` | A message was edited | +| `ChatItemUpdated` | A message was edited; the event has `chatItemUpdate: AChatItemUpdate`, whose `prevChatItem` is the item before the update; the response to `apiUpdateChatItem` has `chatItem: AChatItem` | | `ChatItemsDeleted` | Messages were deleted | | `ChatItemReaction` | A reaction was added/removed | | `ChatItemsStatusesUpdated` | Delivery statuses updated | diff --git a/apps/multiplatform/spec/services/notifications.md b/apps/multiplatform/spec/services/notifications.md index b9391dda11..b36ae0a701 100644 --- a/apps/multiplatform/spec/services/notifications.md +++ b/apps/multiplatform/spec/services/notifications.md @@ -43,7 +43,7 @@ The global `ntfManager` instance is declared at [line 18](../../common/src/commo |---|---|---| | `notifyContactConnected` | [L21](../../common/src/commonMain/kotlin/chat/simplex/common/platform/NtfManager.kt#L21) | Displays "contact connected" notification for a `Contact` | | `notifyContactRequestReceived` | [L28](../../common/src/commonMain/kotlin/chat/simplex/common/platform/NtfManager.kt#L28) | Shows contact request notification with an "Accept" action button | -| `notifyMessageReceived` | [L39](../../common/src/commonMain/kotlin/chat/simplex/common/platform/NtfManager.kt#L39) | Conditionally shows message notification based on `ntfsEnabled`, `showNotification`, and whether user is viewing that chat | +| `notifyMessageReceived` | [L39](../../common/src/commonMain/kotlin/chat/simplex/common/platform/NtfManager.kt#L39) | Conditionally shows message notification based on `ntfsEnabled`, `showNotification`, and whether user is viewing that chat. For `chatItemUpdated`, `chatItemUpdateNotify` calls it in the active profile when the update added the chat | | `acceptContactRequestAction` | [L52](../../common/src/commonMain/kotlin/chat/simplex/common/platform/NtfManager.kt#L52) | Accepts a contact request from a notification action | | `openChatAction` | [L59](../../common/src/commonMain/kotlin/chat/simplex/common/platform/NtfManager.kt#L59) | Opens a specific chat from a notification tap, switching user if needed | | `showChatsAction` | [L74](../../common/src/commonMain/kotlin/chat/simplex/common/platform/NtfManager.kt#L74) | Opens the chat list, switching user if needed | diff --git a/apps/multiplatform/spec/state.md b/apps/multiplatform/spec/state.md index 87acb64072..b636f1d272 100644 --- a/apps/multiplatform/spec/state.md +++ b/apps/multiplatform/spec/state.md @@ -205,6 +205,7 @@ The secondary context is used for: - `addChat(chat)` -- adds chat at index 0, triggers pop animation - `reorderChat(chat, toIndex)` -- reorders chat list (e.g., when a chat receives a new message) - `updateChatInfo(rhId, cInfo)` -- updates chat metadata while preserving connection stats +- `applyChatItemUpdate(rhId, cInfo, cItem, prevItem)` -- applies the `chatItemUpdated` event. The item is replaced if it is loaded and the preview if it is the last item; it is not inserted into the loaded items. The counters change by the difference between `prevItem` and `cItem` (unread: `isRcvNew`; mentions: `isRcvNew` and `userMention`). An update of a locally deleted message creates it again, and the core sends it in `newChatItems`. - `hasChat(rhId, id)` / `getChat(id)` -- lookup methods ### ActiveChatState diff --git a/apps/simplex-directory-service/src/Directory/Events.hs b/apps/simplex-directory-service/src/Directory/Events.hs index 7d6fc609b0..5ac779a942 100644 --- a/apps/simplex-directory-service/src/Directory/Events.hs +++ b/apps/simplex-directory-service/src/Directory/Events.hs @@ -101,7 +101,7 @@ crDirectoryEvent_ = \case CEvtGroupDeleted {groupInfo} -> Just $ DEGroupDeleted groupInfo CEvtUnknownMemberAnnounced {groupInfo, unknownMember, announcedMember} -> Just $ DEMemberUpdated {groupInfo, fromMember = unknownMember, toMember = announcedMember} CEvtGroupMemberUpdated {groupInfo, fromMember, toMember} -> Just $ DEMemberUpdated {groupInfo, fromMember, toMember} - CEvtChatItemUpdated {chatItem = AChatItem _ SMDRcv (DirectChat ct) _} -> Just $ DEItemEditIgnored ct + CEvtChatItemUpdated {chatItemUpdate = AChatItemUpdate _ SMDRcv (DirectChat ct) _ _} -> Just $ DEItemEditIgnored ct CEvtChatItemsDeleted {chatItemDeletions = ((ChatItemDeletion (AChatItem _ SMDRcv (DirectChat ct) _) _) : _), byUser = False} -> Just $ DEItemDeleteIgnored ct CEvtNewChatItems {chatItems = (AChatItem _ SMDRcv (DirectChat ct) ci@ChatItem {content = CIRcvMsgContent mc, formattedText = ft, meta = CIMeta {itemLive}}) : _} -> Just $ case (mc, itemLive) of diff --git a/bots/api/EVENTS.md b/bots/api/EVENTS.md index 7c43ce3bd4..0f8a829f99 100644 --- a/bots/api/EVENTS.md +++ b/bots/api/EVENTS.md @@ -230,10 +230,12 @@ Message was deleted by another user. Message was updated by another user. +`chatItemUpdate` has `prevChatItem`, the message before the update. When the bot deleted the message locally, the update creates it again, and it is sent in [NewChatItems](#newchatitems) event. + **Record type**: - type: "chatItemUpdated" - user: [User](./TYPES.md#user) -- chatItem: [AChatItem](./TYPES.md#achatitem) +- chatItemUpdate: [AChatItemUpdate](./TYPES.md#achatitemupdate) --- diff --git a/bots/api/TYPES.md b/bots/api/TYPES.md index 8529a7dc55..330e8bd166 100644 --- a/bots/api/TYPES.md +++ b/bots/api/TYPES.md @@ -5,6 +5,7 @@ This file is generated automatically. - [ACIReaction](#acireaction) - [AChat](#achat) - [AChatItem](#achatitem) +- [AChatItemUpdate](#achatitemupdate) - [AddRelayResult](#addrelayresult) - [AddressSettings](#addresssettings) - [AgentCryptoError](#agentcryptoerror) @@ -292,6 +293,18 @@ This file is generated automatically. - chatItem: [ChatItem](#chatitem) +--- + +## AChatItemUpdate + +Updated message, with the message before the update. + +**Record type**: +- chatInfo: [ChatInfo](#chatinfo) +- chatItem: [ChatItem](#chatitem) +- prevChatItem: [ChatItem](#chatitem) + + --- ## AddRelayResult diff --git a/bots/src/API/Docs/Events.hs b/bots/src/API/Docs/Events.hs index 0531fcc08f..8fb40b5d53 100644 --- a/bots/src/API/Docs/Events.hs +++ b/bots/src/API/Docs/Events.hs @@ -76,7 +76,7 @@ chatEventsDocsData = ], [ ("CEvtChatItemReaction", "Received message reaction."), ("CEvtChatItemsDeleted", "Message was deleted by another user."), - ("CEvtChatItemUpdated", "Message was updated by another user."), + ("CEvtChatItemUpdated", "Message was updated by another user.\n\n`chatItemUpdate` has `prevChatItem`, the message before the update. When the bot deleted the message locally, the update creates it again, and it is sent in [NewChatItems](#newchatitems) event."), ("CEvtGroupChatItemsDeleted", "Group messages are deleted or moderated."), ("CEvtChatItemsStatusesUpdated", "Message delivery status updates.") ] diff --git a/bots/src/API/Docs/Types.hs b/bots/src/API/Docs/Types.hs index c10aa3cc75..b1f8e8d04f 100644 --- a/bots/src/API/Docs/Types.hs +++ b/bots/src/API/Docs/Types.hs @@ -205,6 +205,7 @@ chatTypesDocsData = ((sti @JSONCIStatus) {typeName = "CIStatus"}, STUnion, "JCIS", [], "", ""), (ciQuoteType, STRecord, "", [], "", ""), (STI "AChatItem" [RecordTypeInfo "AChatItem" [FieldInfo "chatInfo" (ti "ChatInfo"), FieldInfo "chatItem" (ti "ChatItem")]], STRecord, "", [], "", ""), + (STI "AChatItemUpdate" [RecordTypeInfo "AChatItemUpdate" [FieldInfo "chatInfo" (ti "ChatInfo"), FieldInfo "chatItem" (ti "ChatItem"), FieldInfo "prevChatItem" (ti "ChatItem")]], STRecord, "", [], "", "Updated message, with the message before the update."), (STI "ACIReaction" [RecordTypeInfo "ACIReaction" [FieldInfo "chatInfo" (ti "ChatInfo"), FieldInfo "chatReaction" (ti "CIReaction")]], STRecord, "", [], "", ""), -- (STI "JSONObject" [], STRecord, "", [], "Arbitrary JSON object."), -- (STI "UTCTime" [], STRecord, "", [], "Timestampe in ISO8601 format as string."), diff --git a/packages/simplex-chat-client/types/typescript/src/events.ts b/packages/simplex-chat-client/types/typescript/src/events.ts index b1e8fc6057..539a65f024 100644 --- a/packages/simplex-chat-client/types/typescript/src/events.ts +++ b/packages/simplex-chat-client/types/typescript/src/events.ts @@ -185,7 +185,7 @@ export namespace CEvt { export interface ChatItemUpdated extends Interface { type: "chatItemUpdated" user: T.User - chatItem: T.AChatItem + chatItemUpdate: T.AChatItemUpdate } export interface GroupChatItemsDeleted extends Interface { diff --git a/packages/simplex-chat-client/types/typescript/src/types.ts b/packages/simplex-chat-client/types/typescript/src/types.ts index 5a1b39429d..43eac56038 100644 --- a/packages/simplex-chat-client/types/typescript/src/types.ts +++ b/packages/simplex-chat-client/types/typescript/src/types.ts @@ -16,6 +16,13 @@ export interface AChatItem { chatInfo: ChatInfo chatItem: ChatItem } +// Updated message, with the message before the update. + +export interface AChatItemUpdate { + chatInfo: ChatInfo + chatItem: ChatItem + prevChatItem: ChatItem +} export interface AddRelayResult { relay: UserChatRelay diff --git a/packages/simplex-chat-nodejs/tests/live.test.ts b/packages/simplex-chat-nodejs/tests/live.test.ts index aef27e3026..526e230c51 100644 --- a/packages/simplex-chat-nodejs/tests/live.test.ts +++ b/packages/simplex-chat-nodejs/tests/live.test.ts @@ -40,7 +40,7 @@ describeIfSmpServerAvailable("Live message tests (use local SMP server)", () => const received = (check: (meta: T.CIMeta) => boolean) => bob.wait("newChatItems", ({chatItems}) => chatItems.some(({chatItem: {meta}}) => check(meta)), timeout) const updated = (check: (meta: T.CIMeta) => boolean) => - bob.wait("chatItemUpdated", ({chatItem: {chatItem: {meta}}}) => check(meta), timeout) + bob.wait("chatItemUpdated", ({chatItemUpdate: {chatItem: {meta}}}) => check(meta), timeout) const live = new api.LiveMessage(alice, CT.Direct, bobContact.contactId, 500) const started = received(meta => meta.itemLive === true && meta.itemText === "") @@ -52,7 +52,7 @@ describeIfSmpServerAvailable("Live message tests (use local SMP server)", () => expect(await updatedLive).toBeDefined() const finalized = updated(meta => meta.itemId === itemId && meta.itemLive === false && meta.itemText === "Hello world") await live.end("Hello world") - expect((await finalized)?.chatItem.chatItem.meta.itemEdited).toBe(false) + expect((await finalized)?.chatItemUpdate.chatItem.meta.itemEdited).toBe(false) const emptyStarted = received(meta => meta.itemLive === true && meta.itemText === "") live.update("") diff --git a/packages/simplex-chat-python/src/simplex_chat/types/_events.py b/packages/simplex-chat-python/src/simplex_chat/types/_events.py index 13f6d5cb6e..221dd6878d 100644 --- a/packages/simplex-chat-python/src/simplex_chat/types/_events.py +++ b/packages/simplex-chat-python/src/simplex_chat/types/_events.py @@ -61,7 +61,7 @@ class ChatItemsDeleted(TypedDict): class ChatItemUpdated(TypedDict): type: Literal["chatItemUpdated"] user: "T.User" - chatItem: "T.AChatItem" + chatItemUpdate: "T.AChatItemUpdate" class GroupChatItemsDeleted(TypedDict): type: Literal["groupChatItemsDeleted"] diff --git a/packages/simplex-chat-python/src/simplex_chat/types/_types.py b/packages/simplex-chat-python/src/simplex_chat/types/_types.py index 85d0065bb9..c69403502f 100644 --- a/packages/simplex-chat-python/src/simplex_chat/types/_types.py +++ b/packages/simplex-chat-python/src/simplex_chat/types/_types.py @@ -16,6 +16,13 @@ class AChatItem(TypedDict): chatInfo: "ChatInfo" chatItem: "ChatItem" +# Updated message, with the message before the update. + +class AChatItemUpdate(TypedDict): + chatInfo: "ChatInfo" + chatItem: "ChatItem" + prevChatItem: "ChatItem" + class AddRelayResult(TypedDict): relay: "UserChatRelay" relayError: NotRequired["ChatError"] diff --git a/plans/2026-11-17-update-event-fixtures.md b/plans/2026-11-17-update-event-fixtures.md new file mode 100644 index 0000000000..56af2c0aca --- /dev/null +++ b/plans/2026-11-17-update-event-fixtures.md @@ -0,0 +1,73 @@ +# App tests of item updates on core recordings + +Repository: simplex-chat/simplex-chat. +Branch: `ep/update-prev-item` (#8219). +Base: master. + +The user's words: + +> to merge 8219, you need to add UI tests using mocked API responses, in the same way we did in merged PRs 8234 and 8241 + +## Composition + +```mermaid +flowchart LR + CT["core tests
direct update, mention edit, missed call"] -->|"eventHook: recordItemEvent"| EV["item events
newChatItems, chatItemUpdated"] + EV -->|"eventsFixture"| F["tests/fixtures/api/updates"] + F --> KT["ChatItemUpdateTest
desktop"] + F --> IT["ChatItemUpdateTests
iOS, hosted by the app"] + KT -->|"processReceivedMsg"| KM["ChatModel: chats, loaded items,
counters, notifications"] + IT -->|"processReceivedMsg"| IM["ChatModel: chats, loaded items,
counters"] +``` + +## Recording + +`tests/ChatTests/Utils.hs`: + +| Function | Mechanics | +|---|---| +| `recordItemEvent events evt` | appends `newChatItems` and `chatItemUpdated` to `events`, encoded as `chatRecvMsg` encodes them | +| `eventsFixture fixture events steps` | clears `events`, runs `steps`, writes `events` as one JSON array | +| `stableJSON` | `itemTs` replaced by 1970-01-01
`itemSharedMsgId` replaced by its key | + +The recipient of each recording has `markRead = False`, so items stay unread, as in an app before the chat is opened. + +| Fixture | Core test | Events of the recipient | +|---|---|---| +| updates/direct-edit | updated item event has the previous item | new "hello"
"hello" edited to "hello there"
new "how are you"
"hello there" edited to "hello, alice" | +| updates/direct-recreated | the same test, after the recipient deletes the item locally | new "hello again", recreated from the update | +| updates/group-mention | should send updated item with mentions added and removed by edit, the recipient's group notifications set to mentions | new "hello"
edited to mention the recipient
edited without the mention | +| updates/missed-call | mark call invitation missed when the caller ends the call | new pending call
the call updated to missed | + +`updates/update-response`, written by `apiFixture` in "updated item event has the previous item": the sender's response to `/_update item @2 8 text hello there`, the edit to "hello there". The test runs the command after the sender's item has the status `snd_rcvd ok complete` in the database, so the item's status in the response is the same on every run. + +## Tests + +Each test lists the chat of the first event without items, unless the test is about a chat not in the list; it receives the events with `processReceivedMsg` and compares the model. + +| Test | Fixture | Checked | Apps | +|---|---|---|---| +| edit replaces loaded item | direct-edit | the open chat has "hello there" in place of "hello"; the preview is "hello there" | both | +| update of item not loaded inserts nothing | direct-edit | the chat opened after "hello" has no loaded items after the edit; the preview changes only while the edited item is the last one | both | +| counters follow previous and new item | group-mention | unread, mentions and the profile's unread: 1 0 1, 1 1 1, 1 0 1 | both | +| mention edits in another profile change its unread count | group-mention | the other profile's unread: 1 after the mention, 0 after its removal; no notification | both | +| update of a chat not in the list adds it | direct-edit, the edit only | the preview is "hello there"; one notification | both | +| recreated item is counted | direct-recreated | the preview is "hello again"; 1 0 1; one notification | both | +| edit in another profile does not notify | direct-edit | one notification, of "hello"; the other profile's unread is 1 | both | +| missed call does not notify | missed-call | the preview is the missed call; no notification | both | +| missed call in another profile does not notify | missed-call | no notification; the other profile's unread is 1 | both | +| update response has the updated item | update-response | `apiUpdateChatItem` sends `/_update item @2 8 ` and returns item 8, "hello there" | both | +| event decodes to its fields | direct-edit | the update event has `chatItemUpdate` with the previous item | Kotlin | + +Notifications: Kotlin replaces `ntfManager` and records `displayNotification`; iOS replaces `NtfManager.shared`, now a `var`, with a subclass that records `addNotification`. + +## Missed calls + +`chatItemUpdateNotify` notifies only in the active profile, when the update added the chat. Its missed call branch is removed: `notifyMessageReceived` displays nothing for `RcvCall`, whose `showNotification` is false, since #5328. The spec line of `notifyMessageReceived` states the same. + +## iOS + +- `singleFieldJSON` converts tagged objects except `MsgContent`, which the core encodes with `type` in both JSON forms, recognized by its tags. +- other types tagged with `type` in both forms are converted: `MsgChatLink`, `LinkContent`, `MsgScope`, `MsgReaction` and `ChatBotCommand`; a fixture with them needs a rule by position, as the tag `group` of `MsgChatLink` is also a tag of `ChatInfo`. +- `fixtureJSON`, `singleFieldJSON` and `waitFor` are at file scope of `NameAlertsTests.swift`, shared by both test classes. +- the debounced unread collector is awaited by `assertCounts`. diff --git a/scripts/ci/README.md b/scripts/ci/README.md index b1c576b3e5..cffdfec2a2 100644 --- a/scripts/ci/README.md +++ b/scripts/ci/README.md @@ -45,7 +45,7 @@ The reduced build runs one Linux job, build-linux (ubuntu-22.04 x86_64), for eve - caches (the steps "Restore ... from cache"); - `cabal build -j --enable-tests --ghc-options=-O0` (step "Build CLI"); - simplex-chat-test with the selected tests (step "Run tests"), each attempt limited to 35 minutes by `timeout`; an attempt that reaches the limit fails, and "Attempt timed out." is printed. -- App test fixtures: core tests write the core's responses that the app tests use to tests/fixtures/api (`/names tests/` to tests/fixtures/api/names, `/contact via address/` to tests/fixtures/api/connect), and fail when a response differs from the committed file; the rewritten files are committed, and the kotlin and ios scopes run for them. +- App test fixtures: core tests write the core's responses and events that the app tests use to tests/fixtures/api (`/names tests/` to tests/fixtures/api/names, `/contact via address/` to tests/fixtures/api/connect, `/updated item event has the previous item/`, `/should send updated item with mentions added and removed by edit/` and `/mark call invitation missed when the caller ends the call/` to tests/fixtures/api/updates), and fail when a recording differs from the committed file; the rewritten files are committed, and the kotlin and ios scopes run for them. - Local: ```sh cp scripts/cabal.project.local.linux cabal.project.local @@ -134,17 +134,13 @@ The reduced build runs one Linux job, build-linux (ubuntu-22.04 x86_64), for eve #### mcp -- Globs: - - packages/simplex-chat-mcp/** - - packages/simplex-chat-nodejs/** - - packages/simplex-chat-client/types/typescript/** +- Globs: packages/simplex-chat-mcp/**. - CI: - - in build-linux: `scope-tests.sh mcp` (step "Test changed scopes"): - - the types package and the Node.js library built from the branch without the add-on, as package-tests.sh builds them; - - `npm ci`, then both installed into the MCP package with `npm install --no-save`; + - in build-linux: `scope-tests.sh mcp` (step "Test changed scopes"), with the published `simplex-chat` and `@simplex-chat/types` of package-lock.json: + - `npm ci`; - `npx tsc` and `npx tsc -p test/tsconfig.json --noEmit`; - `npm test`, the unit tests; - - `npm run test:e2e`, the end-to-end tests. They download libsimplex and the add-on pinned in packages/simplex-chat-nodejs/src/release.ts, and smp-server and xftp-server of the simplexmq release in test/e2e/smpServer.ts; + - `npm run test:e2e`, the end-to-end tests. They download libsimplex and the add-on pinned by the installed `simplex-chat`, and smp-server and xftp-server of the simplexmq release in test/e2e/smpServer.ts; - before a publication: the package with its published dependencies, type-checked and unit tested in job `publish` of build.yml (docs/contributing/RELEASES.md, "MCP server release"). - Local: `scripts/ci/scope-tests.sh mcp`. diff --git a/scripts/ci/packages_release.py b/scripts/ci/packages_release.py index ca4b3aff0d..9a10f5b721 100644 --- a/scripts/ci/packages_release.py +++ b/scripts/ci/packages_release.py @@ -85,11 +85,7 @@ SCOPE_CHANGES = { "badge-web": ["apps/simplex-badge-service/web/**"], "ci-scripts": ["scripts/ci/packages_release.py", "scripts/ci/test_packages_release.py"], "website": ["website/src/js/simplex-lib.jsc", "website/test/**", "website/package.json"], - "mcp": [ - "packages/simplex-chat-mcp/**", - "packages/simplex-chat-nodejs/**", - "packages/simplex-chat-client/types/typescript/**", - ], + "mcp": ["packages/simplex-chat-mcp/**"], "support-bot": ["apps/simplex-support-bot/**"], "support-bot-light": ["apps/simplex-support-bot-light/**", "packages/simplex-chat-python/**"], } diff --git a/scripts/ci/scope-tests.sh b/scripts/ci/scope-tests.sh index eca861c925..eb31146a01 100755 --- a/scripts/ci/scope-tests.sh +++ b/scripts/ci/scope-tests.sh @@ -15,11 +15,8 @@ case "${1:-}" in (cd website && npm test) ;; mcp) - (cd packages/simplex-chat-client/types/typescript && npm install --no-audit --no-fund && npx tsc) - (cd packages/simplex-chat-nodejs && npm install --ignore-scripts --no-save --no-audit --no-fund ../simplex-chat-client/types/typescript && npx tsc && cp src/simplex.* dist) cd packages/simplex-chat-mcp npm ci --no-audit --no-fund - npm install --no-save --no-audit --no-fund ../simplex-chat-nodejs ../simplex-chat-client/types/typescript npx tsc npx tsc -p test/tsconfig.json --noEmit npm test diff --git a/scripts/ci/test_packages_release.py b/scripts/ci/test_packages_release.py index c0cb515bfa..6b7603eae5 100644 --- a/scripts/ci/test_packages_release.py +++ b/scripts/ci/test_packages_release.py @@ -526,9 +526,9 @@ class ChangesTest(GitRepoTest): self.assertEqual(self.builds("packages/simplex-chat-mcp/src/tools.ts"), set()) self.assertEqual(self.values["scopes"], "mcp") - def test_library_change_builds_packages_and_tests_the_mcp_scope(self): + def test_library_change_builds_packages_without_the_mcp_scope(self): self.assertEqual(self.builds("packages/simplex-chat-nodejs/src/api.ts"), {"packages"}) - self.assertEqual(self.values["scopes"], "mcp") + self.assertEqual(self.values["scopes"], "") def test_support_bot_change_tests_its_scope(self): self.assertEqual(self.builds("apps/simplex-support-bot/src/bot.ts"), set()) diff --git a/src/Simplex/Chat/Controller.hs b/src/Simplex/Chat/Controller.hs index 4b820bf8e5..65fa5012e8 100644 --- a/src/Simplex/Chat/Controller.hs +++ b/src/Simplex/Chat/Controller.hs @@ -994,7 +994,7 @@ data ChatEvent | CEvtChatInfoUpdated {user :: User, chatInfo :: AChatInfo} | CEvtNewChatItems {user :: User, chatItems :: [AChatItem]} -- there is the same command response | CEvtChatItemsStatusesUpdated {user :: User, chatItems :: [AChatItem]} - | CEvtChatItemUpdated {user :: User, chatItem :: AChatItem} -- there is the same command response + | CEvtChatItemUpdated {user :: User, chatItemUpdate :: AChatItemUpdate} -- there is the same command response | CEvtChatItemNotChanged {user :: User, chatItem :: AChatItem} -- there is the same command response | CEvtChatItemReaction {user :: User, added :: Bool, reaction :: ACIReaction} -- there is the same command response | CEvtGroupChatItemsDeleted {user :: User, groupInfo :: GroupInfo, chatItemIDs :: [ChatItemId], byUser :: Bool, member_ :: Maybe GroupMember} -- there is the same command response diff --git a/src/Simplex/Chat/Library/Commands.hs b/src/Simplex/Chat/Library/Commands.hs index c758abb259..66c8f2b3c4 100644 --- a/src/Simplex/Chat/Library/Commands.hs +++ b/src/Simplex/Chat/Library/Commands.hs @@ -3645,7 +3645,7 @@ processChatCommand cxt nm = \case liftIO $ removeFile fsFilePath `catchAll_` pure () lift . forM_ agentRcvFileId $ \(AgentRcvFileId aFileId) -> withAgent' (`xftpDeleteRcvFile` aFileId) - aci_ <- resetRcvCIFileStatus user fileId CIFSRcvInvitation + aci_ <- fmap updatedAChatItem <$> resetRcvCIFileStatus user fileId CIFSRcvInvitation pure $ CRRcvFileCancelled user aci_ ftr FileStatus fileId -> withUser $ \user -> do withFastStore (\db -> lookupChatItemByFileId db cxt user fileId) >>= \case @@ -4970,7 +4970,7 @@ processChatCommand cxt nm = \case let content' = CIRcvGroupInvitation (ciGroupInv {status = newStatus} :: CIGroupInvitation) memRole timed_ <- sndGroupCITimed False g Nothing ci' <- withFastStore' $ \db -> updateGroupChatItem db user (groupId' g) ci {meta = meta {itemTimed = timed_}} content' False False Nothing - toView $ CEvtChatItemUpdated user (AChatItem SCTGroup SMDRcv cInfo ci') + toView $ CEvtChatItemUpdated user (AChatItemUpdate SCTGroup SMDRcv cInfo ci' ci) forM_ (timed_ >>= timedDeleteAt') $ startProximateTimedItemThread user (ChatRef CTGroup (groupId' g) Nothing, itemId) _ -> pure () -- prohibited diff --git a/src/Simplex/Chat/Library/Internal.hs b/src/Simplex/Chat/Library/Internal.hs index fbd67489d3..17ca822ddb 100644 --- a/src/Simplex/Chat/Library/Internal.hs +++ b/src/Simplex/Chat/Library/Internal.hs @@ -707,8 +707,8 @@ updateCallItemStatus user ct@Contact {contactId} Call {chatItemId} receivedStatu updateDirectChatItemView :: User -> Contact -> ChatItemId -> ACIContent -> Bool -> Bool -> Maybe CITimed -> Maybe MessageId -> CM () updateDirectChatItemView user ct chatItemId (ACIContent msgDir ciContent) edited live timed_ msgId_ = do - ci' <- withStore $ \db -> updateDirectChatItem db user ct chatItemId ciContent edited live timed_ msgId_ - toView $ CEvtChatItemUpdated user (AChatItem SCTDirect msgDir (DirectChat ct) ci') + (ci, ci') <- withStore $ \db -> updateDirectChatItem db user ct chatItemId ciContent edited live timed_ msgId_ + toView $ CEvtChatItemUpdated user (AChatItemUpdate SCTDirect msgDir (DirectChat ct) ci' ci) callStatusItemContent :: User -> Contact -> ChatItemId -> WebRTCCallStatus -> CM (Maybe ACIContent) callStatusItemContent user Contact {contactId} chatItemId receivedStatus = do @@ -849,12 +849,11 @@ receiveViaCompleteFD user fileId RcvFileDescr {fileDescrText, fileDescrComplete} -- TODO re-enable redirects with relay checks when (isJust redirect) $ do cxt <- chatStoreCxt - aci_ <- withStore $ \db -> do - liftIO $ updateFileCancelled db user fileId (CIFSRcvError $ FileErrOther "redirect not allowed") - lookupChatItemByFileId db cxt user fileId - forM_ aci_ $ \aci -> do - cleanupACIFile aci - toView $ CEvtChatItemUpdated user aci + upd_ <- withStore $ \db -> + updateFileChatItem db cxt user fileId $ updateFileCancelled db user fileId (CIFSRcvError $ FileErrOther "redirect not allowed") + forM_ upd_ $ \upd -> do + cleanupACIFile $ updatedAChatItem upd + toView $ CEvtChatItemUpdated user upd throwChatError $ CEInvalidFileDescription "redirect not allowed" when (rcvSize > maxRcvSize) $ throwChatError $ CEFileRcvChunk "declared file size exceeds the file invitation size" if userApprovedRelays @@ -884,10 +883,10 @@ receiveViaCompleteFD user fileId RcvFileDescr {fileDescrText, fileDescrComplete} pure $ all (ipAddressProtected netCfg) srvs relaysNotApproved :: [XFTPServer] -> CM () relaysNotApproved unknownSrvs = do - aci_ <- resetRcvCIFileStatus user fileId CIFSRcvInvitation - forM_ aci_ $ \aci -> do - cleanupACIFile aci - toView $ CEvtChatItemUpdated user aci + upd_ <- resetRcvCIFileStatus user fileId CIFSRcvInvitation + forM_ upd_ $ \upd -> do + cleanupACIFile $ updatedAChatItem upd + toView $ CEvtChatItemUpdated user upd throwChatError $ CEFileNotApproved fileId unknownSrvs cleanupACIFile :: AChatItem -> CM () @@ -910,15 +909,16 @@ protoServer' ServerCfg {server} = protoServer server getNetworkConfig :: CM' NetworkConfig getNetworkConfig = withAgent' $ liftIO . getFastNetworkConfig -resetRcvCIFileStatus :: User -> FileTransferId -> CIFileStatus 'MDRcv -> CM (Maybe AChatItem) +resetRcvCIFileStatus :: User -> FileTransferId -> CIFileStatus 'MDRcv -> CM (Maybe AChatItemUpdate) resetRcvCIFileStatus user fileId ciFileStatus = do cxt <- chatStoreCxt - withStore $ \db -> do - liftIO $ do - updateCIFileStatus db user fileId ciFileStatus - updateRcvFileStatus db fileId FSNew - updateRcvFileAgentId db fileId Nothing - lookupChatItemByFileId db cxt user fileId + withStore $ \db -> updateFileChatItem db cxt user fileId $ resetRcvFile db user fileId ciFileStatus + +resetRcvFile :: DB.Connection -> User -> FileTransferId -> CIFileStatus 'MDRcv -> IO () +resetRcvFile db user fileId ciFileStatus = do + updateCIFileStatus db user fileId ciFileStatus + updateRcvFileStatus db fileId FSNew + updateRcvFileAgentId db fileId Nothing receiveViaURI :: User -> FileDescriptionURI -> CryptoFile -> CM RcvFileTransfer receiveViaURI user@User {userId} FileDescriptionURI {description} cf@CryptoFile {cryptoArgs} = do @@ -3102,11 +3102,10 @@ saveRcvChatItem' user cd msg@RcvMessage {chatMsgEvent, msgSigned, forwardedByMem let senderBlocked = case cd of CDGroupRcv _g _scope m -> memberBlocked m _ -> False - userReply = not senderBlocked && case cmToQuotedMsg chatMsgEvent of + userReply = case cmToQuotedMsg chatMsgEvent of Just QuotedMsg {msgRef = MsgRef {memberId = Just mId}} -> sameMemberId mId membership _ -> False - userMention' = userReply || any (\CIMention {memberId} -> sameMemberId memberId membership) mentions' - in pure (mentions', userMention') + in pure (mentions', userMentioned membership senderBlocked userReply mentions') memberChatStats :: Bool -> Maybe (Int, MemberAttention, Int) memberChatStats userMention = case cd of CDGroupRcv _g (Just scope) m -> diff --git a/src/Simplex/Chat/Library/Subscriber.hs b/src/Simplex/Chat/Library/Subscriber.hs index fa1241f2c9..7cea9f4a8c 100644 --- a/src/Simplex/Chat/Library/Subscriber.hs +++ b/src/Simplex/Chat/Library/Subscriber.hs @@ -415,10 +415,10 @@ processAgentMsgRcvFile _corrId aFileId msg = do _ -> pure False if badDigest then do - aci_ <- resetRcvCIFileStatus user fileId (CIFSRcvError $ FileErrOther "file digest") - forM_ aci_ cleanupACIFile + upd_ <- resetRcvCIFileStatus user fileId (CIFSRcvError $ FileErrOther "file digest") + forM_ upd_ $ cleanupACIFile . updatedAChatItem agentXFTPDeleteRcvFile aFileId fileId - forM_ aci_ $ \aci -> toView $ CEvtChatItemUpdated user aci + forM_ upd_ $ toView . CEvtChatItemUpdated user else do ci_ <- withStore $ \db -> do liftIO $ do @@ -434,10 +434,10 @@ processAgentMsgRcvFile _corrId aFileId msg = do toView $ CEvtRcvFileWarning user ci e ft RFERR e | e == FILE NOT_APPROVED -> do - aci_ <- resetRcvCIFileStatus user fileId CIFSRcvAborted - forM_ aci_ cleanupACIFile + upd_ <- resetRcvCIFileStatus user fileId CIFSRcvAborted + forM_ upd_ $ cleanupACIFile . updatedAChatItem agentXFTPDeleteRcvFile aFileId fileId - forM_ aci_ $ \aci -> toView $ CEvtChatItemUpdated user aci + forM_ upd_ $ toView . CEvtChatItemUpdated user | otherwise -> do aci_ <- withStore $ \db -> do liftIO $ updateFileCancelled db user fileId (CIFSRcvError $ agentFileError e) @@ -723,10 +723,10 @@ processAgentMessageConn cxt user@User {userId} entity gks_ corrId agentConnId ag ci_ <- withStore $ \db -> getDirectChatItemLast db user contactId >>= liftIO - . mapM (\(ci, content') -> updateDirectChatItem' db user contactId ci content' False False Nothing Nothing) + . mapM (\(ci, content') -> (ci,) <$> updateDirectChatItem' db user contactId ci content' False False Nothing Nothing) . mdeUpdatedCI e case ci_ of - Just ci -> toView $ CEvtChatItemUpdated user (AChatItem SCTDirect SMDRcv (DirectChat ct) ci) + Just (ci, ci') -> toView $ CEvtChatItemUpdated user (AChatItemUpdate SCTDirect SMDRcv (DirectChat ct) ci' ci) _ -> do toView $ CEvtContactRatchetSync user ct (RatchetSyncProgress rss cStats) createInternalChatItem user (CDDirectRcv ct) (CIRcvDecryptionError mde n) Nothing @@ -1226,10 +1226,10 @@ processAgentMessageConn cxt user@User {userId} entity gks_ corrId agentConnId ag ci_ <- withStore $ \db -> getGroupMemberChatItemLast db user groupId (groupMemberId' m') >>= liftIO - . mapM (\(ci, content') -> updateGroupChatItem db user groupId ci content' False False Nothing) + . mapM (\(ci, content') -> (ci,) <$> updateGroupChatItem db user groupId ci content' False False Nothing) . mdeUpdatedCI e case ci_ of - Just ci -> toView $ CEvtChatItemUpdated user (AChatItem SCTGroup SMDRcv (GroupChat gInfo' scopeInfo) ci) + Just (ci, ci') -> toView $ CEvtChatItemUpdated user (AChatItemUpdate SCTGroup SMDRcv (GroupChat gInfo' scopeInfo) ci' ci) _ -> do toView $ CEvtGroupMemberRatchetSync user gInfo' m' (RatchetSyncProgress rss cStats) createInternalChatItem user (CDGroupRcv gInfo' scopeInfo m') (CIRcvDecryptionError mde n) Nothing @@ -1575,11 +1575,11 @@ processAgentMessageConn cxt user@User {userId} entity gks_ corrId agentConnId ag CChatItem SMDRcv ci@ChatItem {content = CIRcvMsgContent oldMC} | mc /= oldMC -> do currentTs <- liftIO getCurrentTime - aci <- withStore' $ \db -> do + ci' <- withStore' $ \db -> do addInitialAndNewCIVersions db (chatItemId' ci) (chatItemTs' ci, oldMC) (currentTs, mc) - aChatItem <$> updateDirectChatItem' db user contactId ci (CIRcvMsgContent mc) True False Nothing Nothing - toView $ CEvtChatItemUpdated user aci - pure $ Just aci + updateDirectChatItem' db user contactId ci (CIRcvMsgContent mc) True False Nothing Nothing + toView $ CEvtChatItemUpdated user (AChatItemUpdate SCTDirect SMDRcv (DirectChat ct) ci' ci) + pure $ Just $ aChatItem ci' | otherwise -> pure $ Just $ aChatItem ci _ -> pure Nothing where @@ -1604,11 +1604,11 @@ processAgentMessageConn cxt user@User {userId} entity gks_ corrId agentConnId ag if mc /= oldMC then do currentTs <- liftIO getCurrentTime - aci <- withStore' $ \db -> do + ci' <- withStore' $ \db -> do addInitialAndNewCIVersions db (chatItemId' ci) (chatItemTs' ci, oldMC) (currentTs, mc) - aChatItem <$> updateGroupChatItem db user groupId ci (CIRcvMsgContent mc) True False Nothing - toView $ CEvtChatItemUpdated user aci - pure $ Just aci + updateGroupChatItem db user groupId ci (CIRcvMsgContent mc) True False Nothing + toView $ CEvtChatItemUpdated user (AChatItemUpdate SCTGroup SMDRcv (GroupChat gInfo Nothing) ci' ci) + pure $ Just $ aChatItem ci' else pure $ Just $ aChatItem ci _ -> pure Nothing where @@ -2049,9 +2049,10 @@ processAgentMessageConn cxt user@User {userId} entity gks_ corrId agentConnId ag _ -> pure () -- the file may already be accepted, so it is reset to an invitation the apps refuse by its prohibition Just prohibited -> do - withStore' $ \db -> setFileProhibited db user fileId prohibited - aci_ <- resetRcvCIFileStatus user fileId CIFSRcvInvitation - forM_ aci_ $ \aci' -> toView $ CEvtChatItemUpdated user aci' + upd_ <- withStore $ \db -> updateFileChatItem db cxt user fileId $ do + setFileProhibited db user fileId prohibited + resetRcvFile db user fileId CIFSRcvInvitation + forM_ upd_ $ toView . CEvtChatItemUpdated user descrBadgeStatus :: Maybe ByteString -> Integer -> RcvFileDescr -> Maybe UTCTime -> BadgeProof -> CM BadgeStatus descrBadgeStatus binding_ fileSize RcvFileDescr {fileDescrText} fileExpires badge = do @@ -2101,7 +2102,7 @@ processAgentMessageConn cxt user@User {userId} entity gks_ corrId agentConnId ag then do let ciContent = ciContentNoParse $ CIRcvChatFeatureRejected CFVoice (ci, cInfo) <- saveRcvChatItem' user (CDDirectRcv ct) msg (Just sharedMsgId) brokerTs ciContent Nothing Nothing False M.empty - toView $ CEvtChatItemUpdated user (AChatItem SCTDirect SMDRcv cInfo ci) + toView $ CEvtNewChatItems user [AChatItem SCTDirect SMDRcv cInfo ci] else do let timed_ = rcvContactCITimed ct ttl ts = ciContentTexts content @@ -2109,7 +2110,7 @@ processAgentMessageConn cxt user@User {userId} entity gks_ corrId agentConnId ag ci' <- withStore' $ \db -> do createChatItemVersion db (chatItemId' ci) brokerTs mc updateDirectChatItem' db user contactId ci content True live Nothing Nothing - toView $ CEvtChatItemUpdated user (AChatItem SCTDirect SMDRcv cInfo ci') + toView $ CEvtNewChatItems user [AChatItem SCTDirect SMDRcv cInfo ci'] where brokerTs = metaBrokerTs msgMeta content = CIRcvMsgContent mc @@ -2122,13 +2123,14 @@ processAgentMessageConn cxt user@User {userId} entity gks_ corrId agentConnId ag let changed = mc /= oldMC if changed || fromMaybe False itemLive then do - ci' <- withStore' $ \db -> do + (ciR, ci') <- withStore' $ \db -> do when changed $ addInitialAndNewCIVersions db (chatItemId' ci) (chatItemTs' ci, oldMC) (brokerTs, mc) reactions <- getDirectCIReactions db ct sharedMsgId - let edited = itemLive /= Just True - updateDirectChatItem' db user contactId ci {reactions} content edited live Nothing $ Just msgId - toView $ CEvtChatItemUpdated user (AChatItem SCTDirect SMDRcv (DirectChat ct) ci') + let ciR = (ci :: ChatItem 'CTDirect 'MDRcv) {reactions} + edited = itemLive /= Just True + (ciR,) <$> updateDirectChatItem' db user contactId ciR content edited live Nothing (Just msgId) + toView $ CEvtChatItemUpdated user (AChatItemUpdate SCTDirect SMDRcv (DirectChat ct) ci' ciR) startUpdatedTimedItemThread user (ChatRef CTDirect contactId Nothing) ci ci' else toView $ CEvtChatItemNotChanged user (AChatItem SCTDirect SMDRcv (DirectChat ct) ci) _ -> messageError "x.msg.update: contact attempted invalid message update" @@ -2358,7 +2360,7 @@ processAgentMessageConn cxt user@User {userId} entity gks_ corrId agentConnId ag ci'' <- case chatDir of CDGroupRcv gi' _ m' -> blockedMemberCI gi' m' ci' CDChannelRcv {} -> pure ci' - toView $ CEvtChatItemUpdated user (AChatItem SCTGroup SMDRcv cInfo ci'') + groupMsgToView cInfo ci'' pure $ Just $ infoToDeliveryContext gInfo' scopeInfo showGroupAsSender where content = CIRcvMsgContent mc @@ -2405,8 +2407,8 @@ processAgentMessageConn cxt user@User {userId} entity gks_ corrId agentConnId ag ciMentions <- getRcvCIMentions db user gInfo ft_ mentions ci' <- updateGroupChatItem db user groupId ci {reactions} content edited live $ Just msgId updateChatItemSignedMsg db (chatItemId' ci) signedMsg_ signedByGMId_ - updateGroupCIMentions db gInfo ci' ciMentions - toView $ CEvtChatItemUpdated user (AChatItem SCTGroup SMDRcv (GroupChat gInfo scopeInfo) ci') + updateGroupCIMentions db gInfo ci' ciMentions >>= updateGroupCIUserMention db cxt user gInfo scopeInfo + toView $ CEvtChatItemUpdated user (AChatItemUpdate SCTGroup SMDRcv (GroupChat gInfo scopeInfo) ci' ci) startUpdatedTimedItemThread user (ChatRef CTGroup groupId $ toChatScope <$> scopeInfo) ci ci' pure $ Just $ infoToDeliveryContext gInfo scopeInfo showGroupAsSender else do diff --git a/src/Simplex/Chat/Messages.hs b/src/Simplex/Chat/Messages.hs index ca0a1373f9..c1141cc364 100644 --- a/src/Simplex/Chat/Messages.hs +++ b/src/Simplex/Chat/Messages.hs @@ -291,6 +291,10 @@ isACIUserMention (AChatItem _ _ _ ci) = isUserMention ci isUserMention :: ChatItem c d -> Bool isUserMention ChatItem {meta = CIMeta {userMention}} = userMention +userMentioned :: GroupMember -> Bool -> Bool -> Map MemberName CIMention -> Bool +userMentioned membership senderBlocked userReply mentions = + not senderBlocked && (userReply || any (\CIMention {memberId} -> sameMemberId memberId membership) mentions) + data CIDirection (c :: ChatType) (d :: MsgDirection) where CIDirectSnd :: CIDirection 'CTDirect 'MDSnd CIDirectRcv :: CIDirection 'CTDirect 'MDRcv @@ -481,6 +485,15 @@ deriving instance Show AChatItem data JSONAnyChatItem c d = JSONAnyChatItem {chatInfo :: ChatInfo c, chatItem :: ChatItem c d} +data AChatItemUpdate = forall c d. (ChatTypeI c, MsgDirectionI d) => AChatItemUpdate (SChatType c) (SMsgDirection d) (ChatInfo c) (ChatItem c d) (ChatItem c d) + +deriving instance Show AChatItemUpdate + +data JSONAnyChatItemUpdate c d = JSONAnyChatItemUpdate {chatInfo :: ChatInfo c, chatItem :: ChatItem c d, prevChatItem :: ChatItem c d} + +updatedAChatItem :: AChatItemUpdate -> AChatItem +updatedAChatItem (AChatItemUpdate c d chatInfo ci _) = AChatItem c d chatInfo ci + aChatItems :: AChat -> [AChatItem] aChatItems (AChat ct Chat {chatInfo, chatItems}) = map aChatItem chatItems where @@ -1562,6 +1575,21 @@ instance ChatTypeI c => ToJSON (CChatItem c) where toJSON (CChatItem _ ci) = J.toJSON ci toEncoding (CChatItem _ ci) = J.toEncoding ci +instance (ChatTypeI c, MsgDirectionI d) => ToJSON (JSONAnyChatItemUpdate c d) where + toJSON = $(JQ.mkToJSON defaultJSON ''JSONAnyChatItemUpdate) + toEncoding = $(JQ.mkToEncoding defaultJSON ''JSONAnyChatItemUpdate) + +instance FromJSON AChatItemUpdate where + parseJSON = J.withObject "AChatItemUpdate" $ \o -> do + AChatInfo c chatInfo <- o .: "chatInfo" + CChatItem d chatItem <- o .: "chatItem" + prev <- o .: "prevChatItem" + pure $ AChatItemUpdate c d chatInfo chatItem prev + +instance ToJSON AChatItemUpdate where + toJSON (AChatItemUpdate _ _ chat item prev) = J.toJSON $ JSONAnyChatItemUpdate chat item prev + toEncoding (AChatItemUpdate _ _ chat item prev) = J.toEncoding $ JSONAnyChatItemUpdate chat item prev + $(JQ.deriveJSON defaultJSON ''ChatItemInfo) $(JQ.deriveJSON defaultJSON ''ChatStats) diff --git a/src/Simplex/Chat/Store/Messages.hs b/src/Simplex/Chat/Store/Messages.hs index 834f53a3fc..39582d4e05 100644 --- a/src/Simplex/Chat/Store/Messages.hs +++ b/src/Simplex/Chat/Store/Messages.hs @@ -64,6 +64,7 @@ module Simplex.Chat.Store.Messages updateChatItemSignedMsg, createGroupCIMentions, updateGroupCIMentions, + updateGroupCIUserMention, deleteGroupChatItem, updateGroupChatItemModerated, deleteMemberCIs, @@ -118,6 +119,7 @@ module Simplex.Chat.Store.Messages getLocalChatItemIdByText', getChatItemByFileId, lookupChatItemByFileId, + updateFileChatItem, getChatItemByGroupId, updateDirectChatItemStatus, setDirectSndChatItemViaProxy, @@ -164,6 +166,7 @@ import Data.Text (Text) import qualified Data.Text as T import Data.Time (addUTCTime) import Data.Time.Clock (UTCTime (..), getCurrentTime) +import Data.Type.Equality (testEquality, (:~:) (Refl)) import Simplex.Chat.Badges (BadgeStatus) import Simplex.Chat.Controller (ChatListQuery (..), ChatPagination (..), PaginationByTime (..)) import Simplex.Chat.Markdown @@ -2230,11 +2233,7 @@ updateGroupScopeUnreadStats db cxt user g@GroupInfo {membership} scopeInfo (unre pure g {membership = membership'} Just member -> do member' <- updateGMStats member - let didRequire = gmRequiresAttention member - nowRequires = gmRequiresAttention member' - if (not nowRequires && didRequire) - then decreaseGroupMembersRequireAttention db user g - else pure g + updateGroupMembersRequireAttention db user g member member' where updateGMStats m@GroupMember {groupMemberId} = do currentTs <- getCurrentTime @@ -2556,10 +2555,10 @@ setDirectSndChatItemViaProxy db User {userId} Contact {contactId} ci viaProxy = DB.execute db "UPDATE chat_items SET via_proxy = ? WHERE user_id = ? AND contact_id = ? AND chat_item_id = ?" (BI viaProxy, userId, contactId, chatItemId' ci) pure ci {meta = (meta ci) {sentViaProxy = Just viaProxy}} -updateDirectChatItem :: MsgDirectionI d => DB.Connection -> User -> Contact -> ChatItemId -> CIContent d -> Bool -> Bool -> Maybe CITimed -> Maybe MessageId -> ExceptT StoreError IO (ChatItem 'CTDirect d) +updateDirectChatItem :: MsgDirectionI d => DB.Connection -> User -> Contact -> ChatItemId -> CIContent d -> Bool -> Bool -> Maybe CITimed -> Maybe MessageId -> ExceptT StoreError IO (ChatItem 'CTDirect d, ChatItem 'CTDirect d) updateDirectChatItem db user ct@Contact {contactId} itemId newContent edited live timed_ msgId_ = do ci <- liftEither . correctDir =<< getDirectCIWithReactions db user ct itemId - liftIO $ updateDirectChatItem' db user contactId ci newContent edited live timed_ msgId_ + (ci,) <$> liftIO (updateDirectChatItem' db user contactId ci newContent edited live timed_ msgId_) getDirectCIWithReactions :: DB.Connection -> User -> Contact -> ChatItemId -> ExceptT StoreError IO (CChatItem 'CTDirect) getDirectCIWithReactions db user ct@Contact {contactId} itemId = @@ -2824,13 +2823,13 @@ createGroupCIMentions db GroupInfo {groupId} ci mentions = do rows = map (\(name, CIMention {memberId}) -> (ciId, groupId, memberId, name)) $ M.assocs mentions ciId = chatItemId' ci -updateGroupCIMentions :: DB.Connection -> GroupInfo -> ChatItem 'CTGroup d -> Map MemberName CIMention -> IO (ChatItem 'CTGroup d) +updateGroupCIMentions :: forall d. DB.Connection -> GroupInfo -> ChatItem 'CTGroup d -> Map MemberName CIMention -> IO (ChatItem 'CTGroup d) updateGroupCIMentions db g ci@ChatItem {mentions} mentions' | mentions' == mentions = pure ci | otherwise = do unless (null mentions) deleteMentions if null mentions' - then pure ci + then pure (ci :: ChatItem 'CTGroup d) {mentions = mentions'} else -- This is a fallback for the error that should not happen in practice. -- In theory, it may happen in item mentions in database are different from item record. withSavepoint db "create_mentions" createMentions >>= \case @@ -2840,6 +2839,23 @@ updateGroupCIMentions db g ci@ChatItem {mentions} mentions' deleteMentions = DB.execute db "DELETE FROM chat_item_mentions WHERE chat_item_id = ?" (Only $ chatItemId' ci) createMentions = createGroupCIMentions db g ci mentions' +updateGroupCIUserMention :: DB.Connection -> StoreCxt -> User -> GroupInfo -> Maybe GroupChatScopeInfo -> ChatItem 'CTGroup 'MDRcv -> IO (ChatItem 'CTGroup 'MDRcv) +updateGroupCIUserMention db cxt user@User {userId} g@GroupInfo {membership} scopeInfo_ ci@ChatItem {chatDir, quotedItem, mentions, meta = meta@CIMeta {itemId, itemStatus, userMention}} + | userMention' == userMention = pure ci + | otherwise = do + DB.execute db "UPDATE chat_items SET user_mention = ? WHERE user_id = ? AND chat_item_id = ?" (BI userMention', userId, itemId) + when (itemStatus == CISRcvNew) $ + forM_ scopeInfo_ $ \scopeInfo -> updateGroupScopeUnreadStats db cxt user g scopeInfo (0, 0, fromEnum userMention - fromEnum userMention') + pure ci {meta = meta {userMention = userMention'}} + where + userMention' = userMentioned membership senderBlocked userReply mentions + senderBlocked = case chatDir of + CIGroupRcv m -> memberBlocked m + CIChannelRcv -> False + userReply = case quotedItem of + Just CIQuote {chatDir = CIQGroupSnd} -> True + _ -> False + deleteGroupChatItem :: DB.Connection -> User -> GroupInfo -> ChatItem 'CTGroup d -> IO () deleteGroupChatItem db User {userId} g@GroupInfo {groupId} ci = do let itemId = chatItemId' ci @@ -3319,6 +3335,17 @@ lookupChatItemByFileId db cxt user fileId = do SEChatItemNotFoundByFileId {} -> pure Nothing e -> throwError e +updateFileChatItem :: DB.Connection -> StoreCxt -> User -> Int64 -> IO () -> ExceptT StoreError IO (Maybe AChatItemUpdate) +updateFileChatItem db cxt user fileId update = do + prevAci_ <- lookupChatItemByFileId db cxt user fileId + liftIO update + aci_ <- lookupChatItemByFileId db cxt user fileId + case (prevAci_, aci_) of + (Nothing, Nothing) -> pure Nothing + (Just (AChatItem c' d' _ prevCi), Just (AChatItem c d chatInfo ci)) + | Just Refl <- testEquality c c', Just Refl <- testEquality d d' -> pure $ Just $ AChatItemUpdate c d chatInfo ci prevCi + _ -> throwError $ SEInternalError $ "file update changed chat item presence, chat type or direction, file " <> show fileId + getChatItemByGroupId :: DB.Connection -> StoreCxt -> User -> GroupId -> ExceptT StoreError IO AChatItem getChatItemByGroupId db cxt user@User {userId} groupId = do (chatRef, itemId) <- diff --git a/src/Simplex/Chat/Terminal/Output.hs b/src/Simplex/Chat/Terminal/Output.hs index c3a0a5a321..87bd032269 100644 --- a/src/Simplex/Chat/Terminal/Output.hs +++ b/src/Simplex/Chat/Terminal/Output.hs @@ -147,7 +147,7 @@ runTerminalOutput ct cc@ChatController {outputQ, showLiveItems, logFilePath} Cha (outputRH, r_) <- atomically $ readTBQueue outputQ forM_ r_ $ \case CEvtNewChatItems u (ci : _) -> when markRead $ markChatItemRead u ci -- At the moment of writing received items are created one at a time - CEvtChatItemUpdated u ci -> when markRead $ markChatItemRead u ci + CEvtChatItemUpdated u upd -> when markRead $ markChatItemRead u (updatedAChatItem upd) CEvtRemoteHostConnected {remoteHost = RemoteHostInfo {remoteHostId}} -> getRemoteUser remoteHostId CEvtRemoteHostStopped {remoteHostId_} -> mapM_ removeRemoteUser remoteHostId_ _ -> pure () @@ -185,7 +185,7 @@ chatEventNotification t@ChatTerminal {sendNotification} cc = \case _ -> pure () where text = msgText mc formattedText - CEvtChatItemUpdated u (AChatItem _ SMDRcv cInfo ci@ChatItem {chatDir, content = CIRcvMsgContent _}) -> + CEvtChatItemUpdated u (AChatItemUpdate _ SMDRcv cInfo ci@ChatItem {chatDir, content = CIRcvMsgContent _} _) -> whenCurrUser cc u $ when (chatDirNtf u cInfo chatDir $ isUserMention ci) $ setActiveChat t cInfo CEvtContactConnected u ct _ -> when (contactNtf u ct False) $ do whenCurrUser cc u $ setActiveContact t ct diff --git a/src/Simplex/Chat/View.hs b/src/Simplex/Chat/View.hs index 65dada0a93..e94dee6e9a 100644 --- a/src/Simplex/Chat/View.hs +++ b/src/Simplex/Chat/View.hs @@ -454,7 +454,7 @@ chatEventToView hu ChatConfig {logLevel, showReactions, showReceipts, testView} | testView && showReceipts -> ttyUser u [sShow (length chatItems) <> " message statuses updated"] | otherwise -> [] - CEvtChatItemUpdated u (AChatItem _ _ chat item) -> ttyUser u $ unmuted u chat item $ viewItemUpdate chat item liveItems ts tz + CEvtChatItemUpdated u (AChatItemUpdate _ _ chat item _) -> ttyUser u $ unmuted u chat item $ viewItemUpdate chat item liveItems ts tz CEvtChatItemNotChanged u ci -> ttyUser u $ viewItemNotChanged ci CEvtChatItemReaction u added (ACIReaction _ _ chat reaction) -> ttyUser u $ unmutedReaction u chat reaction $ viewItemReaction showReactions chat reaction added ts tz CEvtChatItemsDeleted u deletions byUser timed -> ttyUser u $ viewChatItemsDeleted (unmuted u) deletions byUser timed ts tz testView diff --git a/tests/ChatTests/Direct.hs b/tests/ChatTests/Direct.hs index 3ce8f97130..f47982e2e5 100644 --- a/tests/ChatTests/Direct.hs +++ b/tests/ChatTests/Direct.hs @@ -19,6 +19,7 @@ import Control.Concurrent.Async (concurrently_, poll, wait) import Control.Monad (forM_, void, (>=>)) import Data.Aeson (ToJSON) import qualified Data.Aeson as J +import qualified Data.Aeson.KeyMap as KM import qualified Data.ByteString.Char8 as B import qualified Data.ByteString.Lazy.Char8 as LB import Data.List (intercalate, isPrefixOf, stripPrefix) @@ -29,8 +30,8 @@ import GHC.Conc (ThreadStatus (..), threadStatus) import Simplex.Chat.AppSettings (defaultAppSettings) import qualified Simplex.Chat.AppSettings as AS import Simplex.Chat.Call -import Simplex.Chat.Controller (ChatConfig (..), ChatController (..), PresetServers (..)) -import Simplex.Chat.Messages (ChatItemId) +import Simplex.Chat.Controller (ChatConfig (..), ChatController (..), ChatEvent (CEvtChatItemUpdated), ChatHooks (..), PresetServers (..), defaultChatHooks) +import Simplex.Chat.Messages (AChatItemUpdate (..), CIMeta (CIMeta, itemText), ChatItem (ChatItem, meta), ChatItemId) import Simplex.Chat.Options import Simplex.Chat.Protocol (supportedChatVRange) import Simplex.Chat.Types (ContactId, VersionRangeChat, authErrDisableCount, sameVerificationCode, verificationCode, pattern VersionChat) @@ -38,7 +39,7 @@ import Simplex.Messaging.Agent.Env.SQLite import Simplex.Messaging.Agent.RetryInterval import qualified Simplex.Messaging.Agent.Store.DB as DB import Simplex.Messaging.Client (NetworkTimeout (..)) -import Control.Concurrent.STM (atomically, readTVarIO) +import Control.Concurrent.STM (atomically, modifyTVar', newTVarIO, readTVarIO) import qualified Simplex.Messaging.Crypto as C import Simplex.Messaging.Encoding.String (strEncode) import Simplex.Messaging.Server.Env.STM hiding (subscriptions) @@ -69,6 +70,7 @@ chatDirectTests = do it "delete conversation keeping contact" testDeleteConversationKeepContact it "direct message quoted replies" testDirectMessageQuotedReply it "direct message update" testDirectMessageUpdate + it "updated item event has the previous item" testDirectMessageUpdatePrevItem it "direct message edit history" testDirectMessageEditHistory it "direct message delete" testDirectMessageDelete it "direct message delete multiple" testDirectMessageDeleteMultiple @@ -107,6 +109,7 @@ chatDirectTests = do it "negotiate call" testNegotiateCall it "negotiate call between current and v1 clients" testNegotiateCallV1 it "mark expired call invitation missed on restore" testExpireCallInvitation + it "mark call invitation missed when the caller ends the call" testMissedCall describe "maintenance mode" $ do it "stop chat stops all threads, start chat restarts them" testStopStartChat #if !defined(dbPostgres) @@ -770,7 +773,7 @@ testDirectMessageEditHistory = alice ##> ("/_update item @2 " <> itemId 1 <> " text hey there") alice <# "@bob [edited] hey there" - bob <# "alice> [edited] hey there" + bob <# "alice> hey there" alice ##> "/item info @bob hey" alice <##. "sent at: " @@ -785,6 +788,46 @@ testDirectMessageEditHistory = bob <## "message history:" bob .<## ": hey there" +testDirectMessageUpdatePrevItem :: HasCallStack => TestParams -> IO () +testDirectMessageUpdatePrevItem ps = do + updates <- newTVarIO [] + encoded <- newTVarIO [] + events <- newTVarIO [] + let hook _ evt = do + recordItemEvent events evt + case evt of + Right e@CEvtChatItemUpdated {} -> atomically $ modifyTVar' encoded (<> [J.toJSON e]) + _ -> pure () + case J.decode . J.encode <$> evt of + Right (Just (CEvtChatItemUpdated _ (AChatItemUpdate _ _ _ ci prevCi))) -> atomically $ modifyTVar' updates (<> [(itemText' ci, itemText' prevCi)]) + _ -> pure () + pure evt + itemText' :: ChatItem c d -> T.Text + itemText' ChatItem {meta = CIMeta {itemText}} = itemText + withNewTestChatCfgOpts ps testCfg {chatHooks = defaultChatHooks {eventHook = Just hook}} testOpts {markRead = False} "alice" aliceProfile $ \alice -> + withNewTestChat ps "bob" bobProfile $ \bob -> do + connectUsers alice bob + eventsFixture "updates/direct-edit" events $ do + bob #> "@alice hello" + alice <# "bob> hello" + withCCTransaction bob (\db -> DB.query db "SELECT item_status FROM chat_items WHERE item_text = ?" (Only ("hello" :: String))) `shouldEventuallyReturn` [Only ("snd_rcvd ok complete" :: String)] + apiFixture "updates/update-response" bob [] FixtureRequests {frMarkdown = [], frUris = [], frCommands = ["/_update item @2 " <> itemId 1 <> " text hello there"]} + alice <# "bob> [edited] hello there" + bob #> "@alice how are you" + alice <# "bob> how are you" + bob ##> ("/_update item @2 " <> itemId 1 <> " text hello, alice") + bob <# "@alice [edited] hello, alice" + alice <# "bob> [edited] hello, alice" + alice #$> ("/_delete item @2 " <> itemId 1 <> " internal", id, "message deleted") + eventsFixture "updates/direct-recreated" events $ do + bob ##> ("/_update item @2 " <> itemId 1 <> " text hello again") + bob <# "@alice [edited] hello again" + alice <# "bob> hello again" + alice #$> ("/_get chat @2 count=1", chat, [(0, "hello again")]) + readTVarIO updates `shouldReturn` [("hello there", "hello"), ("hello, alice", "hello there")] + J.Object evt : _ <- readTVarIO encoded + KM.member "chatItemUpdate" evt `shouldBe` True + testDirectMessageDelete :: HasCallStack => TestParams -> IO () testDirectMessageDelete = testChat2 aliceProfile bobProfile $ @@ -819,7 +862,7 @@ testDirectMessageDelete = bob ##> ("/_update item @2 " <> itemId 2 <> " text hey alice") bob <# "@alice [edited] > hello 🙂" bob <## " hey alice" - alice <# "bob> [edited] hey alice" + alice <# "bob> hey alice" alice @@@ [("@bob", "hey alice")] alice #$> ("/_get chat @2 count=100", chat, chatFeatures <> [(0, "hey alice")]) @@ -1442,6 +1485,20 @@ testExpireCallInvitation ps = callRowCount bob `shouldReturn` 0 bob #$> ("/_get chat @2 count=100", chat, chatFeatures <> [(0, "incoming call: missed")]) +testMissedCall :: HasCallStack => TestParams -> IO () +testMissedCall ps = do + events <- newTVarIO [] + withNewTestChat ps "alice" aliceProfile $ \alice -> + withNewTestChatCfgOpts ps testCfg {chatHooks = defaultChatHooks {eventHook = Just $ \_ evt -> evt <$ recordItemEvent events evt}} testOpts {markRead = False} "bob" bobProfile $ \bob -> do + connectUsers alice bob + eventsFixture "updates/missed-call" events $ do + inviteToCall alice bob + alice ##> "/_call end @2" + alice <## "ok" + bob <## "call with alice ended" + (length <$> readTVarIO events) `shouldEventuallyReturn` 2 + bob #$> ("/_get chat @2 count=100", chat, chatFeatures <> [(0, "incoming call: missed")]) + testStopStartChat :: HasCallStack => TestParams -> IO () testStopStartChat ps = withNewTestChat ps "bob" bobProfile $ \bob -> diff --git a/tests/ChatTests/Files.hs b/tests/ChatTests/Files.hs index 50ca840e0b..c4f9284c3f 100644 --- a/tests/ChatTests/Files.hs +++ b/tests/ChatTests/Files.hs @@ -1,4 +1,5 @@ {-# LANGUAGE DuplicateRecordFields #-} +{-# LANGUAGE NamedFieldPuns #-} {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE PostfixOperators #-} {-# OPTIONS_GHC -fno-warn-ambiguous-fields #-} @@ -11,6 +12,7 @@ import ChatTests.Profiles (addTestBadge, futureDate, issueTestBadge, issueTestBa import ChatTests.Utils import Control.Concurrent (threadDelay) import Control.Concurrent.Async (concurrently_) +import Control.Concurrent.STM (atomically, check, modifyTVar', newTVarIO, readTVar, readTVarIO, writeTVar) import Control.Logger.Simple import Control.Monad.Except (runExceptT) import Control.Monad.Reader (runReaderT) @@ -22,13 +24,13 @@ import qualified Data.Text as T import Network.HTTP.Types.URI (urlEncode) import Data.Time.Clock (addUTCTime, getCurrentTime, nominalDay) import Simplex.Chat.Badges (BadgeProof, BadgeStatus (..), BadgeType (..), FileSizeLimits (..), ProofPresHeader (..), badgeProof, defaultFileSizeLimits) -import Simplex.Chat.Controller (ChatCommand (APIGetChat), ChatConfig (..), ChatPagination (CPLast), ChatResponse (CRApiChat, CRNewChatItems)) +import Simplex.Chat.Controller (ChatCommand (APIGetChat), ChatConfig (..), ChatEvent (CEvtChatItemUpdated, CEvtRcvFileDescrReady), ChatHooks (..), ChatPagination (CPLast), ChatResponse (CRApiChat, CRNewChatItems), defaultChatHooks) import Simplex.Chat.Core (sendChatCmdStr) import Simplex.Chat.Library.Commands (execChatCommand') import Simplex.Chat.Library.Internal (badgeProofStatus, roundedFDCount) import Simplex.Chat.Markdown (parseMaybeMarkdownList) -import Simplex.Chat.Messages (AChat (..), AChatItem (..), CChatItem (..), CIQuote (CIQuote, content, formattedText), Chat (..), ChatItem (..), ChatRef (..), ChatType (..)) -import Simplex.Chat.Messages.CIContent (ciMsgContent) +import Simplex.Chat.Messages (AChat (..), AChatItem (..), AChatItemUpdate (..), CChatItem (..), CIFile (..), CIQuote (CIQuote, content, formattedText), Chat (..), ChatItem (..), ChatRef (..), ChatType (..)) +import Simplex.Chat.Messages.CIContent (MsgDirectionI, ciMsgContent) import Simplex.Chat.Mobile.File import Simplex.Chat.Options (ChatOpts (..)) import Simplex.Chat.Protocol (MsgContent (MCImage, MCText)) @@ -39,6 +41,7 @@ import Simplex.Messaging.Crypto.File (CryptoFile (..), CryptoFileArgs (..)) import Simplex.Messaging.Encoding.String import System.Directory (copyFile, createDirectoryIfMissing, doesFileExist, getFileSize) import System.FilePath (()) +import System.Timeout (timeout) import Test.Hspec hiding (it) chatFileTests :: SpecWith TestParams @@ -71,6 +74,7 @@ chatFileTests = do it "receive file marked to receive on chat start" testXFTPMarkToReceive it "error receiving file" testXFTPRcvError it "cancel receiving file, repeat receive" testXFTPCancelRcvRepeat + it "receiving file from unknown relays resets it, the event has the previous item" testXFTPRcvRelaysNotApproved it "should accept file automatically with CLI option" testAutoAcceptFile it "should prohibit file transfers in groups based on preference" testProhibitFiles describe "file transfer over XFTP without chat items" $ do @@ -1278,6 +1282,36 @@ testXFTPCancelRcvRepeat = where cfg = testCfg {xftpDescrPartSize = 200} +testXFTPRcvRelaysNotApproved :: HasCallStack => TestParams -> IO () +testXFTPRcvRelaysNotApproved ps = do + descrReady <- newTVarIO False + updates <- newTVarIO [] + let hook _ evt = do + case evt of + Right CEvtRcvFileDescrReady {} -> atomically $ writeTVar descrReady True + Right (CEvtChatItemUpdated _ (AChatItemUpdate _ _ _ ci prevCi)) -> atomically $ modifyTVar' updates (<> [(fileStatus' ci, fileStatus' prevCi)]) + _ -> pure () + pure evt + fileStatus' :: MsgDirectionI d => ChatItem c d -> Maybe B.ByteString + fileStatus' ChatItem {file} = (\CIFile {fileStatus} -> strEncode fileStatus) <$> file + withNewTestChat ps "alice" aliceProfile $ \alice -> + withNewTestChatCfg ps testCfg {chatHooks = defaultChatHooks {eventHook = Just hook}} "bob" bobProfile $ \bob -> withXFTPServer ps $ do + connectUsers alice bob + bob #$> ("/xftp xftp://1234-w==@xftp1.example.im", id, "ok") + alice #> "/f @bob ./tests/fixtures/test.pdf" + alice <## "use /fc 1 to cancel sending" + bob <# "alice> sends file test.pdf (266.0 KiB / 272376 bytes)" + bob <## "use /fr 1 [/ | ] to receive it" + alice <## "completed uploading file 1 (test.pdf) for bob" + timeout 10000000 (atomically $ readTVar descrReady >>= check) `shouldReturn` Just () + bob ##> ("/fr 1 " <> tmpDir ps) + bob + <### [ "file 1 aborted, unknwon XFTP servers:", + StartsWith "ProtocolServer {scheme = SPXFTP, host = THDomainName \"localhost\" :| []", + WithTime "alice>" + ] + readTVarIO updates `shouldReturn` [(Just "rcv_invitation", Just "rcv_accepted")] + testAutoAcceptFile :: HasCallStack => TestParams -> IO () testAutoAcceptFile = testChatOpts2 opts aliceProfile bobProfile $ \alice bob -> withXFTPServer alice $ do diff --git a/tests/ChatTests/Groups.hs b/tests/ChatTests/Groups.hs index 48d6c28246..34a56e9d86 100644 --- a/tests/ChatTests/Groups.hs +++ b/tests/ChatTests/Groups.hs @@ -32,10 +32,10 @@ import Data.List (intercalate, isInfixOf, isSubsequenceOf, isSuffixOf) import qualified Data.Map.Strict as M import qualified Data.Text as T import Simplex.Chat.Badges (FileSizeLimits (..)) -import Simplex.Chat.Controller (ChatController (ChatController, smpAgent, subscriptionMode), ChatConfig (..), ChatEvent (CEvtDuplicateGroupMessage), ChatHooks (..), ChatLogLevel (..), defaultChatHooks, withAgent) +import Simplex.Chat.Controller (ChatController (ChatController, smpAgent, subscriptionMode), ChatConfig (..), ChatEvent (CEvtChatItemUpdated, CEvtDuplicateGroupMessage), ChatHooks (..), ChatLogLevel (..), defaultChatHooks, withAgent) import Simplex.Chat.Library.Internal (encodeConnInfo, getShortLinkConnReq, sendDirectMemberMessage, uniqueMsgMentions, updatedMentionNames) import Simplex.Chat.Markdown (parseMaybeMarkdownList) -import Simplex.Chat.Messages (CIMention (..), CIMentionMember (..), ChatItemId) +import Simplex.Chat.Messages (AChatItemUpdate (..), CIMention (..), CIMentionMember (..), ChatItem (ChatItem, mentions), ChatItemId, isUserMention) import Simplex.Chat.Messages.Batch (encodeBinaryBatch, encodeFwdElement) import Simplex.Chat.Messages.CIContent (publicGroupNoE2EText) import Simplex.Chat.Options @@ -256,6 +256,7 @@ chatGroupTests = do it "should send report to group owner, admins and moderators, but not other users" testGroupMemberReports describe "group member mentions" $ do it "should send and edit messages with member mentions" testMemberMention + it "should send updated item with mentions added and removed by edit" testMemberMentionEdited it "should forward and quote message updating mentioned member name" testForwardQuoteMention it "should send updated mentions in history" testGroupHistoryWithMentions describe "uniqueMsgMentions" testUniqueMsgMentions @@ -275,6 +276,7 @@ chatGroupTests = do it "should forward group deletion in support scope in review (x.grp.del)" testScopedSupportForwardGroupDeletion it "should send messages to admins and members" testSupportCLISendCommand it "should correctly maintain unread stats for support chats on reading chat items" testScopedSupportUnreadStatsOnRead + it "should correctly maintain unread stats for support chats on editing mentions" testScopedSupportUnreadStatsOnMentionEdit it "should correctly maintain unread stats for support chats on deleting chat items" testScopedSupportUnreadStatsOnDelete it "should correct member attention stat for support chat on opening it" testScopedSupportUnreadStatsCorrectOnOpen it "should not read support chat items when reading group without scope" testScopedSupportUnreadStatsGroupReadNoScope @@ -1438,7 +1440,7 @@ testGroupMessageEditHistory = alice ##> ("/_update item #1 " <> aliceItemId <> " text hey there") alice <# "#team [edited] hey there" - bob <# "#team alice> [edited] hey there" + bob <# "#team alice> hey there" alice ##> "/item info #team hey" alice <##. "sent at: " @@ -1506,7 +1508,7 @@ testGroupMessageDelete = bob <# "#team [edited] > alice hello!" bob <## " hi alice" concurrently_ - (alice <# "#team bob> [edited] hi alice") + (alice <# "#team bob> hi alice") ( do cath <# "#team bob> [edited] > alice hello!" cath <## " hi alice" @@ -8487,6 +8489,35 @@ testMemberMention = bob <# "#team cath> [edited] hello @alice @bob" ] +testMemberMentionEdited :: HasCallStack => TestParams -> IO () +testMemberMentionEdited ps = do + updates <- newTVarIO [] + events <- newTVarIO [] + let hook _ evt = do + recordItemEvent events evt + case evt of + Right (CEvtChatItemUpdated _ (AChatItemUpdate _ _ _ ci prevCi)) -> + atomically $ modifyTVar' updates (<> [(mentionOf prevCi, mentionOf ci)]) + _ -> pure () + pure evt + mentionOf :: ChatItem c d -> ([T.Text], Bool) + mentionOf ci@ChatItem {mentions} = (M.keys mentions, isUserMention ci) + withNewTestChatCfgOpts ps testCfg {chatHooks = defaultChatHooks {eventHook = Just hook}} testOpts {markRead = False} "alice" aliceProfile $ \alice -> + withNewTestChat ps "bob" bobProfile $ \bob -> do + createGroup2 "team" alice bob + alice ##> "/unmute mentions #team" + alice <## "ok" + eventsFixture "updates/group-mention" events $ do + bob #> "#team hello" + alice <# "#team bob> hello " + bob ##> "! #team hello @alice" + bob <# "#team [edited] hello @alice" + alice <# "#team bob> [edited] hello @alice" + bob ##> "! #team hello" + bob <# "#team [edited] hello" + alice <# "#team bob> [edited] hello " + readTVarIO updates `shouldReturn` [(([], False), (["alice"], True)), ((["alice"], True), ([], False))] + testForwardQuoteMention :: HasCallStack => TestParams -> IO () testForwardQuoteMention = testChat3 aliceProfile bobProfile cathProfile $ @@ -9341,6 +9372,31 @@ testScopedSupportUnreadStatsOnRead = { markRead = False } +testScopedSupportUnreadStatsOnMentionEdit :: HasCallStack => TestParams -> IO () +testScopedSupportUnreadStatsOnMentionEdit = + testChatOpts4 opts aliceProfile bobProfile cathProfile danProfile $ \alice bob cath dan -> do + createGroup4 "team" alice (bob, GRMember) (cath, GRMember) (dan, GRModerator) + + dan ##> "/_send #1(_support:3) text 1" + dan <# "#team (support: bob) 1" + alice <# "#team (support: bob) dan> 1" + bob <# "#team (support) dan> 1" + danItemId <- lastItemId dan + + dan ##> ("/_update item #1(_support:3) " <> danItemId <> " json {\"msgContent\": {\"type\": \"text\", \"text\": \"@alice 1\"}, \"mentions\": {\"alice\": 1}}") + dan <# "#team (support: bob) [edited] @alice 1" + alice <# "#team (support: bob) dan> [edited] @alice 1" + bob <# "#team (support) dan> [edited] @alice 1" + + alice ##> "/member support chats #team" + alice <## "members require attention: 1" + alice <## "bob (Bob) (id 2): unread: 1, require attention: 0, mentions: 1" + where + opts = + testOpts + { markRead = False + } + testScopedSupportUnreadStatsOnDelete :: HasCallStack => TestParams -> IO () testScopedSupportUnreadStatsOnDelete = testChatOpts2 opts aliceProfile bobProfile $ \alice bob -> do @@ -13554,8 +13610,8 @@ testChannelUpdateFallbackSendAsGroup ps = aliceMsgId <- lastItemId alice alice ##> ("/_update item #1 " <> aliceMsgId <> " text channel msg updated") alice <# "#team [edited] channel msg updated" - -- bob's item was locally deleted, fallback recreates it with [edited] marker - bob <# "#team> [edited] channel msg updated" + -- bob's item was locally deleted, fallback recreates it as a new item + bob <# "#team> channel msg updated" [cath, dan, eve] *<# "#team> [edited] channel msg updated" -- now test sendAsGroup=False case @@ -13574,7 +13630,7 @@ testChannelUpdateFallbackSendAsGroup ps = alice ##> ("/_update item #1 " <> aliceMsgId2 <> " text member msg updated") alice <# "#team [edited] member msg updated" -- bob's internally deleted item is re-created as from member (sendAsGroup=False) - bob <# "#team alice> [edited] member msg updated" + bob <# "#team alice> member msg updated" -- forwarded members see correct member attribution [cath, dan, eve] *<# "#team alice> [edited] member msg updated" @@ -14138,7 +14194,7 @@ testChannelSignedHistory ps = -- catch-up subscriber joins late: as-group edited content + signed member post (author unknown to dan, shown by id hash), deleted excluded memberJoinChannel "team" [relay] [alice] shortLink fullLink dan - dan <# "#team> [edited] history one edited (signed)" + dan <# "#team> history one edited (signed) [>>]" dan .<## "> from cath member (signed) [>>]" dan #$> ("/_get chat #1 count=100 search=history one edited", chat, [(0, "history one edited (signed)")]) dan #$> ("/_get chat #1 count=100 search=from cath member", chat, [(0, "from cath member (signed)")]) diff --git a/tests/ChatTests/Utils.hs b/tests/ChatTests/Utils.hs index 3f0b71b28a..3769f41edd 100644 --- a/tests/ChatTests/Utils.hs +++ b/tests/ChatTests/Utils.hs @@ -30,7 +30,7 @@ import Data.Maybe (fromMaybe) import Data.String import qualified Data.Text as T import Simplex.Chat.Badges (BadgeProof (..), BadgeStatus, LocalBadge (..), ProofPresHeader (..)) -import Simplex.Chat.Controller (ChatConfig (..), ChatController (..), ChatError, ChatEvent (CEvtNameMoved), storeCxt) +import Simplex.Chat.Controller (ChatConfig (..), ChatController (..), ChatError, ChatEvent (CEvtChatItemUpdated, CEvtNameMoved, CEvtNewChatItems), storeCxt) import Simplex.Chat.Library.Commands (maxProfileImageSize) import Simplex.Chat.Markdown (viewName) import Simplex.Chat.Mobile (chatParseMarkdown, chatParseUri, chatSendCmd, eitherToResult) @@ -1023,6 +1023,20 @@ nameMovedFixture fixture cc contacts groups = withCCUser cc $ \user -> do Right (contactIds, groupIds) -> writeFixture ("names/" <> fixture) $ stableJSON $ J.toJSON (eitherToResult Nothing (Right $ CEvtNameMoved user contactIds groupIds :: Either ChatError ChatEvent)) Left e -> error $ show e +recordItemEvent :: TVar [J.Value] -> Either ChatError ChatEvent -> IO () +recordItemEvent events evt = case evt of + Right CEvtNewChatItems {} -> record + Right CEvtChatItemUpdated {} -> record + _ -> pure () + where + record = atomically $ modifyTVar' events (<> [J.toJSON $ eitherToResult Nothing evt]) + +eventsFixture :: String -> TVar [J.Value] -> IO () -> IO () +eventsFixture fixture events steps = do + atomically $ writeTVar events [] + steps + readTVarIO events >>= writeFixture fixture . stableJSON . J.toJSON + writeFixture :: String -> J.Value -> IO () writeFixture fixture = testGenerate ("tests/fixtures/api/" <> fixture <> ".json") . prettyJSON where @@ -1041,7 +1055,7 @@ stableJSON = \case v -> v where stableField k v - | k `elem` ["createdAt", "updatedAt", "chatTs", "userMemberProfileSentAt"] = J.String "1970-01-01T00:00:00Z" - | k `elem` ["agentConnId", "xContactId", "connFullLink", "connShortLink", "contactLink", "groupLink", "viaGroupLinkUri", "simplexUri", "memberId", "memberPubKey", "publicGroupId", "businessId", "customerId"] = J.String $ JK.toText k + | k `elem` ["createdAt", "updatedAt", "chatTs", "userMemberProfileSentAt", "itemTs"] = J.String "1970-01-01T00:00:00Z" + | k `elem` ["agentConnId", "xContactId", "connFullLink", "connShortLink", "contactLink", "groupLink", "viaGroupLinkUri", "simplexUri", "memberId", "memberPubKey", "publicGroupId", "businessId", "customerId", "itemSharedMsgId"] = J.String $ JK.toText k | k == "groupRelays", J.Array a <- v = J.Array $ J.String "groupRelay" <$ a | otherwise = stableJSON v diff --git a/tests/fixtures/api/updates/direct-edit.json b/tests/fixtures/api/updates/direct-edit.json new file mode 100644 index 0000000000..78643731b6 --- /dev/null +++ b/tests/fixtures/api/updates/direct-edit.json @@ -0,0 +1,1240 @@ +[ + { + "result": { + "chatItems": [ + { + "chatInfo": { + "contact": { + "activeConn": { + "agentConnId": "agentConnId", + "authErrCounter": 0, + "connChatVersion": 22, + "connId": 1, + "connLevel": 0, + "connStatus": { + "type": "ready" + }, + "connType": "contact", + "contactConnInitiated": false, + "createdAt": "1970-01-01T00:00:00Z", + "entityId": 2, + "localAlias": "", + "peerChatVRange": { + "maxVersion": 22, + "minVersion": 9 + }, + "pqEncryption": true, + "pqRcvEnabled": true, + "pqSndEnabled": true, + "pqSupport": true, + "quotaErrCounter": 0, + "viaGroupLink": false + }, + "chatDeleted": false, + "chatSettings": { + "enableNtfs": "all", + "favorite": false + }, + "chatTags": [], + "chatTs": "1970-01-01T00:00:00Z", + "contactGrpInvSent": false, + "contactId": 2, + "contactStatus": "active", + "contactUsed": true, + "createdAt": "1970-01-01T00:00:00Z", + "localDisplayName": "bob", + "mergedPreferences": { + "calls": { + "contactPreference": { + "allow": "yes" + }, + "enabled": { + "forContact": true, + "forUser": true + }, + "userPreference": { + "preference": { + "allow": "yes" + }, + "type": "user" + } + }, + "commands": [], + "files": { + "contactPreference": { + "allow": "always" + }, + "enabled": { + "forContact": true, + "forUser": true + }, + "userPreference": { + "preference": { + "allow": "always" + }, + "type": "user" + } + }, + "fullDelete": { + "contactPreference": { + "allow": "no" + }, + "enabled": { + "forContact": false, + "forUser": false + }, + "userPreference": { + "preference": { + "allow": "no" + }, + "type": "user" + } + }, + "reactions": { + "contactPreference": { + "allow": "yes" + }, + "enabled": { + "forContact": true, + "forUser": true + }, + "userPreference": { + "preference": { + "allow": "yes" + }, + "type": "user" + } + }, + "sessions": { + "contactPreference": { + "allow": "no" + }, + "enabled": { + "forContact": false, + "forUser": false + }, + "userPreference": { + "preference": { + "allow": "no" + }, + "type": "user" + } + }, + "timedMessages": { + "contactPreference": { + "allow": "yes" + }, + "enabled": { + "forContact": true, + "forUser": true + }, + "userPreference": { + "preference": { + "allow": "yes" + }, + "type": "user" + } + }, + "voice": { + "contactPreference": { + "allow": "yes" + }, + "enabled": { + "forContact": true, + "forUser": true + }, + "userPreference": { + "preference": { + "allow": "yes" + }, + "type": "user" + } + } + }, + "profile": { + "displayName": "bob", + "fullName": "", + "image": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAKHGlDQ1BJQ0MgUHJvZmlsZQAASImFVgdUVNcWve9Nb7QZeu9NehtAem/Sq6gMQ28OQxWxgAQjEFFEREARNFQFg1KjiIhiIQgoYA9IEFBisCAq6OQNJNH4//r/zDpz9ttzz7n73ffWmg0A6QCDxYq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wPlUgYhHf1z37f7V9g9e8ITewiP88wfWIYET6HPg21nzjV2fybQVcxfrg2/onng/F50lD/ccAAAA4ZVhJZk1NACoAAAAIAAGHaQAEAAAAAQAAABoAAAAAAAKgAgAEAAAAAQAAABigAwAEAAAAAQAAABgAAAAAwf1XlwAAAaNJREFUSA3FlT1LA0EQQBN/gYUYRTksJZVgEbCR/D+7QMr8ABtttBBCsLGzsLG2sxaxED/ie4d77u0dyaE5HHjczn7MzO7M7nU6/yXz+bwLhzCCjTQO+rZhDH3opuNLdRYN4RHe4RIKJ7R34Ro+4AEGSw2mE1iUwT18gpI74WvkGlccu4XNdH0jnYU7cAUacidn37qR23cOxc4aGU0nYUAn7iSWEHkz46w0ocdQu1X6B/AMQZ5o7KfBqNOfwRH8JB7FajGhnmcpKvQe3MEbvILiDm5gPXaCHnZr4vvFGMoEKudKn8YvQIOOe+YzCPop7dwJ3zRfJ7GDuso4YJGRa0yZgg4tUaNXdGrbuZWKKxzYYEJc2xp9AUUjGt8KC2jvgYadF8+10vJyDnNLXwbdiWUZi0fUK01Eoc+AZhCLZVzK4Vq6sDUdz+0dEcbbTTIOJmAyTVhx/WmvrExbv2jtPhWLKodjCtefZiEeZeVZWWSndgwj6fVf3XON8Qwq15++uoqrfYVrow6dGBpCq79ME291jaB0/Q2CPncyht/99MNO/vr9AqW/CGi8sJqbAAAAAElFTkSuQmCC", + "localAlias": "", + "preferences": { + "calls": { + "allow": "yes" + }, + "commands": [], + "files": { + "allow": "always" + }, + "fullDelete": { + "allow": "no" + }, + "reactions": { + "allow": "yes" + }, + "sessions": { + "allow": "no" + }, + "timedMessages": { + "allow": "yes" + }, + "voice": { + "allow": "yes" + } + }, + "profileId": 2, + "shortDescr": "Bob" + }, + "updatedAt": "1970-01-01T00:00:00Z", + "userPreferences": {} + }, + "type": "direct" + }, + "chatItem": { + "chatDir": { + "type": "directRcv" + }, + "content": { + "msgContent": { + "text": "hello", + "type": "text" + }, + "type": "rcvMsgContent" + }, + "mentions": {}, + "meta": { + "createdAt": "1970-01-01T00:00:00Z", + "deletable": false, + "editable": false, + "hasLink": false, + "itemEdited": false, + "itemId": 8, + "itemSharedMsgId": "itemSharedMsgId", + "itemStatus": { + "type": "rcvNew" + }, + "itemText": "hello", + "itemTs": "1970-01-01T00:00:00Z", + "showGroupAsSender": false, + "updatedAt": "1970-01-01T00:00:00Z", + "userMention": false + }, + "reactions": [] + } + } + ], + "type": "newChatItems", + "user": { + "activeOrder": 1, + "activeUser": true, + "agentUserId": "1", + "autoAcceptGroupInvitations": false, + "autoAcceptMemberContacts": false, + "clientService": false, + "fullPreferences": { + "calls": { + "allow": "yes" + }, + "commands": [], + "files": { + "allow": "always" + }, + "fullDelete": { + "allow": "no" + }, + "reactions": { + "allow": "yes" + }, + "sessions": { + "allow": "no" + }, + "timedMessages": { + "allow": "yes" + }, + "voice": { + "allow": "yes" + } + }, + "localDisplayName": "alice", + "profile": { + "displayName": "alice", + "fullName": "", + "localAlias": "", + "preferences": { + "calls": { + "allow": "yes" + }, + "commands": [], + "files": { + "allow": "always" + }, + "fullDelete": { + "allow": "no" + }, + "reactions": { + "allow": "yes" + }, + "sessions": { + "allow": "no" + }, + "timedMessages": { + "allow": "yes" + }, + "voice": { + "allow": "yes" + } + }, + "profileId": 1, + "shortDescr": "Alice" + }, + "sendRcptsContacts": true, + "sendRcptsSmallGroups": true, + "showNtfs": true, + "userChatRelay": false, + "userContactId": 1, + "userId": 1 + } + } + }, + { + "result": { + "chatItemUpdate": { + "chatInfo": { + "contact": { + "activeConn": { + "agentConnId": "agentConnId", + "authErrCounter": 0, + "connChatVersion": 22, + "connId": 1, + "connLevel": 0, + "connStatus": { + "type": "ready" + }, + "connType": "contact", + "contactConnInitiated": false, + "createdAt": "1970-01-01T00:00:00Z", + "entityId": 2, + "localAlias": "", + "peerChatVRange": { + "maxVersion": 22, + "minVersion": 9 + }, + "pqEncryption": true, + "pqRcvEnabled": true, + "pqSndEnabled": true, + "pqSupport": true, + "quotaErrCounter": 0, + "viaGroupLink": false + }, + "chatDeleted": false, + "chatSettings": { + "enableNtfs": "all", + "favorite": false + }, + "chatTags": [], + "chatTs": "1970-01-01T00:00:00Z", + "contactGrpInvSent": false, + "contactId": 2, + "contactStatus": "active", + "contactUsed": true, + "createdAt": "1970-01-01T00:00:00Z", + "localDisplayName": "bob", + "mergedPreferences": { + "calls": { + "contactPreference": { + "allow": "yes" + }, + "enabled": { + "forContact": true, + "forUser": true + }, + "userPreference": { + "preference": { + "allow": "yes" + }, + "type": "user" + } + }, + "commands": [], + "files": { + "contactPreference": { + "allow": "always" + }, + "enabled": { + "forContact": true, + "forUser": true + }, + "userPreference": { + "preference": { + "allow": "always" + }, + "type": "user" + } + }, + "fullDelete": { + "contactPreference": { + "allow": "no" + }, + "enabled": { + "forContact": false, + "forUser": false + }, + "userPreference": { + "preference": { + "allow": "no" + }, + "type": "user" + } + }, + "reactions": { + "contactPreference": { + "allow": "yes" + }, + "enabled": { + "forContact": true, + "forUser": true + }, + "userPreference": { + "preference": { + "allow": "yes" + }, + "type": "user" + } + }, + "sessions": { + "contactPreference": { + "allow": "no" + }, + "enabled": { + "forContact": false, + "forUser": false + }, + "userPreference": { + "preference": { + "allow": "no" + }, + "type": "user" + } + }, + "timedMessages": { + "contactPreference": { + "allow": "yes" + }, + "enabled": { + "forContact": true, + "forUser": true + }, + "userPreference": { + "preference": { + "allow": "yes" + }, + "type": "user" + } + }, + "voice": { + "contactPreference": { + "allow": "yes" + }, + "enabled": { + "forContact": true, + "forUser": true + }, + "userPreference": { + "preference": { + "allow": "yes" + }, + "type": "user" + } + } + }, + "profile": { + "displayName": "bob", + "fullName": "", + "image": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAKHGlDQ1BJQ0MgUHJvZmlsZQAASImFVgdUVNcWve9Nb7QZeu9NehtAem/Sq6gMQ28OQxWxgAQjEFFEREARNFQFg1KjiIhiIQgoYA9IEFBisCAq6OQNJNH4//r/zDpz9ttz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jivtwJAQHLFgcNZ9uBwPlUgYhHf1z37f7V9g9e8ITewiP88wfWIYET6HPg21nzjV2fybQVcxfrg2/onng/F50lD/ccAAAA4ZVhJZk1NACoAAAAIAAGHaQAEAAAAAQAAABoAAAAAAAKgAgAEAAAAAQAAABigAwAEAAAAAQAAABgAAAAAwf1XlwAAAaNJREFUSA3FlT1LA0EQQBN/gYUYRTksJZVgEbCR/D+7QMr8ABtttBBCsLGzsLG2sxaxED/ie4d77u0dyaE5HHjczn7MzO7M7nU6/yXz+bwLhzCCjTQO+rZhDH3opuNLdRYN4RHe4RIKJ7R34Ro+4AEGSw2mE1iUwT18gpI74WvkGlccu4XNdH0jnYU7cAUacidn37qR23cOxc4aGU0nYUAn7iSWEHkz46w0ocdQu1X6B/AMQZ5o7KfBqNOfwRH8JB7FajGhnmcpKvQe3MEbvILiDm5gPXaCHnZr4vvFGMoEKudKn8YvQIOOe+YzCPop7dwJ3zRfJ7GDuso4YJGRa0yZgg4tUaNXdGrbuZWKKxzYYEJc2xp9AUUjGt8KC2jvgYadF8+10vJyDnNLXwbdiWUZi0fUK01Eoc+AZhCLZVzK4Vq6sDUdz+0dEcbbTTIOJmAyTVhx/WmvrExbv2jtPhWLKodjCtefZiEeZeVZWWSndgwj6fVf3XON8Qwq15++uoqrfYVrow6dGBpCq79ME291jaB0/Q2CPncyht/99MNO/vr9AqW/CGi8sJqbAAAAAElFTkSuQmCC", + "localAlias": "", + "preferences": { + "calls": { + "allow": "yes" + }, + "commands": [], + "files": { + "allow": "always" + }, + "fullDelete": { + "allow": "no" + }, + "reactions": { + "allow": "yes" + }, + "sessions": { + "allow": "no" + }, + "timedMessages": { + "allow": "yes" + }, + "voice": { + "allow": "yes" + } + }, + "profileId": 2, + "shortDescr": "Bob" + }, + "updatedAt": "1970-01-01T00:00:00Z", + "userPreferences": {} + }, + "type": "direct" + }, + "chatItem": { + "chatDir": { + "type": "directRcv" + }, + "content": { + "msgContent": { + "text": "hello there", + "type": "text" + }, + "type": "rcvMsgContent" + }, + "mentions": {}, + "meta": { + "createdAt": "1970-01-01T00:00:00Z", + "deletable": false, + "editable": false, + "hasLink": false, + "itemEdited": true, + "itemId": 8, + "itemSharedMsgId": "itemSharedMsgId", + "itemStatus": { + "type": "rcvNew" + }, + "itemText": "hello there", + "itemTs": "1970-01-01T00:00:00Z", + "showGroupAsSender": false, + "updatedAt": "1970-01-01T00:00:00Z", + "userMention": false + }, + "reactions": [] + }, + "prevChatItem": { + "chatDir": { + "type": "directRcv" + }, + "content": { + "msgContent": { + "text": "hello", + "type": "text" + }, + "type": "rcvMsgContent" + }, + "mentions": {}, + "meta": { + "createdAt": "1970-01-01T00:00:00Z", + "deletable": false, + "editable": false, + "hasLink": false, + "itemEdited": false, + "itemId": 8, + "itemSharedMsgId": "itemSharedMsgId", + "itemStatus": { + "type": "rcvNew" + }, + "itemText": "hello", + "itemTs": "1970-01-01T00:00:00Z", + "showGroupAsSender": false, + "updatedAt": "1970-01-01T00:00:00Z", + "userMention": false + }, + "reactions": [] + } + }, + "type": "chatItemUpdated", + "user": { + "activeOrder": 1, + "activeUser": true, + "agentUserId": "1", + "autoAcceptGroupInvitations": false, + "autoAcceptMemberContacts": false, + "clientService": false, + "fullPreferences": { + "calls": { + "allow": "yes" + }, + "commands": [], + "files": { + "allow": "always" + }, + "fullDelete": { + "allow": "no" + }, + "reactions": { + "allow": "yes" + }, + "sessions": { + "allow": "no" + }, + "timedMessages": { + "allow": "yes" + }, + "voice": { + "allow": "yes" + } + }, + "localDisplayName": "alice", + "profile": { + "displayName": "alice", + "fullName": "", + "localAlias": "", + "preferences": { + "calls": { + "allow": "yes" + }, + "commands": [], + "files": { + "allow": "always" + }, + "fullDelete": { + "allow": "no" + }, + "reactions": { + "allow": "yes" + }, + "sessions": { + "allow": "no" + }, + "timedMessages": { + "allow": "yes" + }, + "voice": { + "allow": "yes" + } + }, + "profileId": 1, + "shortDescr": "Alice" + }, + "sendRcptsContacts": true, + "sendRcptsSmallGroups": true, + "showNtfs": true, + "userChatRelay": false, + "userContactId": 1, + "userId": 1 + } + } + }, + { + "result": { + "chatItems": [ + { + "chatInfo": { + "contact": { + "activeConn": { + "agentConnId": "agentConnId", + "authErrCounter": 0, + "connChatVersion": 22, + "connId": 1, + "connLevel": 0, + "connStatus": { + "type": "ready" + }, + "connType": "contact", + "contactConnInitiated": false, + "createdAt": "1970-01-01T00:00:00Z", + "entityId": 2, + "localAlias": "", + "peerChatVRange": { + "maxVersion": 22, + "minVersion": 9 + }, + "pqEncryption": true, + "pqRcvEnabled": true, + "pqSndEnabled": true, + "pqSupport": true, + "quotaErrCounter": 0, + "viaGroupLink": false + }, + "chatDeleted": false, + "chatSettings": { + "enableNtfs": "all", + "favorite": false + }, + "chatTags": [], + "chatTs": "1970-01-01T00:00:00Z", + "contactGrpInvSent": false, + "contactId": 2, + "contactStatus": "active", + "contactUsed": true, + "createdAt": "1970-01-01T00:00:00Z", + "localDisplayName": "bob", + "mergedPreferences": { + "calls": { + "contactPreference": { + "allow": "yes" + }, + "enabled": { + "forContact": true, + "forUser": true + }, + "userPreference": { + "preference": { + "allow": "yes" + }, + "type": "user" + } + }, + "commands": [], + "files": { + "contactPreference": { + "allow": "always" + }, + "enabled": { + "forContact": true, + "forUser": true + }, + "userPreference": { + "preference": { + "allow": "always" + }, + "type": "user" + } + }, + "fullDelete": { + "contactPreference": { + "allow": "no" + }, + "enabled": { + "forContact": false, + "forUser": false + }, + "userPreference": { + "preference": { + "allow": "no" + }, + "type": "user" + } + }, + "reactions": { + "contactPreference": { + "allow": "yes" + }, + "enabled": { + "forContact": true, + "forUser": true + }, + "userPreference": { + "preference": { + "allow": "yes" + }, + "type": "user" + } + }, + "sessions": { + "contactPreference": { + "allow": "no" + }, + "enabled": { + "forContact": false, + "forUser": false + }, + "userPreference": { + "preference": { + "allow": "no" + }, + "type": "user" + } + }, + "timedMessages": { + "contactPreference": { + "allow": "yes" + }, + "enabled": { + "forContact": true, + "forUser": true + }, + "userPreference": { + "preference": { + "allow": "yes" + }, + "type": "user" + } + }, + "voice": { + "contactPreference": { + "allow": "yes" + }, + "enabled": { + "forContact": true, + "forUser": true + }, + "userPreference": { + "preference": { + "allow": "yes" + }, + "type": "user" + } + } + }, + "profile": { + "displayName": "bob", + "fullName": "", + "image": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAKHGlDQ1BJQ0MgUHJvZmlsZQAASImFVgdUVNcWve9Nb7QZeu9NehtAem/Sq6gMQ28OQxWxgAQjEFFEREARNFQFg1KjiIhiIQgoYA9IEFBisCAq6OQNJNH4//r/zDpz9ttzz7n73ffWmg0A6QCDxYqD+QCIT0hmezlYywQEBsngngEYCAIy0AC6DGYSy8rDwxUg8Xf9d7wbAxC33tHgzvrP3/9nCISFJzEBgIIRTGey2MkILkawT1oyi4tnEUxjI6IQvMLFkauYqxjQQtewwuoaHy8bBNMBwJMZDHYkAERbhJdJZUYic4hhCNZOCItOQDB3vjkzioFwxLsIXhcRl5IOAImrRzs+fivCk7QRrIL0shAcwNUW+tX8yH/tFfrPXgxG5D84Pi6F+dc9ck+HHJ7g641UMSQlQATQBHEgBaQDGcACbLAVYaIRJhx5Dv+9j77aZ4OsZIFtSEc0iARRIBnpt/9qlvfqpGSQBhjImnCEcUU+NtxnujZy4fbqVEiU/wuXdQyA9S0cDqfzC+e2F4DzyLkSB79wyi0A8KoBcL2GmcJOXePQ3C8MIAJeQAOiQArIAxXuWwMMgSmwBHbAGbgDHxAINgMmojceUZUGMkEWyAX54AA4DMpAJTgJ6sAZ0ALawQVwGVwDt8AQGAUPwQSYBi/AAngHliEIwkEUiAqJQtKQIqQO6UJ0yByyg1whLygQCoEioQQoBcqE9kD5UBFUBlVB9dBPUCd0GboBDUP3oUloDnoNfYRRMBmmwZKwEqwF02Er2AX2gTfBkXAinAHnwPvhUrgaPg23wZfhW/AoPAG/gBdRAEVCCaFkURooOsoG5Y4KQkWg2KidqDxUCaoa1YTqQvWj7qAmUPOoD2gsmoq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i8sJqbAAAAAElFTkSuQmCC", + "localAlias": "", + "preferences": { + "calls": { + "allow": "yes" + }, + "commands": [], + "files": { + "allow": "always" + }, + "fullDelete": { + "allow": "no" + }, + "reactions": { + "allow": "yes" + }, + "sessions": { + "allow": "no" + }, + "timedMessages": { + "allow": "yes" + }, + "voice": { + "allow": "yes" + } + }, + "profileId": 2, + "shortDescr": "Bob" + }, + "updatedAt": "1970-01-01T00:00:00Z", + "userPreferences": {} + }, + "type": "direct" + }, + "chatItem": { + "chatDir": { + "type": "directRcv" + }, + "content": { + "msgContent": { + "text": "how are you", + "type": "text" + }, + "type": "rcvMsgContent" + }, + "mentions": {}, + "meta": { + "createdAt": "1970-01-01T00:00:00Z", + "deletable": false, + "editable": false, + "hasLink": false, + "itemEdited": false, + "itemId": 9, + "itemSharedMsgId": "itemSharedMsgId", + "itemStatus": { + "type": "rcvNew" + }, + "itemText": "how are you", + "itemTs": "1970-01-01T00:00:00Z", + "showGroupAsSender": false, + "updatedAt": "1970-01-01T00:00:00Z", + "userMention": false + }, + "reactions": [] + } + } + ], + "type": "newChatItems", + "user": { + "activeOrder": 1, + "activeUser": true, + "agentUserId": "1", + "autoAcceptGroupInvitations": false, + "autoAcceptMemberContacts": false, + "clientService": false, + "fullPreferences": { + "calls": { + "allow": "yes" + }, + "commands": [], + "files": { + "allow": "always" + }, + "fullDelete": { + "allow": "no" + }, + "reactions": { + "allow": "yes" + }, + "sessions": { + "allow": "no" + }, + "timedMessages": { + "allow": "yes" + }, + "voice": { + "allow": "yes" + } + }, + "localDisplayName": "alice", + "profile": { + "displayName": "alice", + "fullName": "", + "localAlias": "", + "preferences": { + "calls": { + "allow": "yes" + }, + "commands": [], + "files": { + "allow": "always" + }, + "fullDelete": { + "allow": "no" + }, + "reactions": { + "allow": "yes" + }, + "sessions": { + "allow": "no" + }, + "timedMessages": { + "allow": "yes" + }, + "voice": { + "allow": "yes" + } + }, + "profileId": 1, + "shortDescr": "Alice" + }, + "sendRcptsContacts": true, + "sendRcptsSmallGroups": true, + "showNtfs": true, + "userChatRelay": false, + "userContactId": 1, + "userId": 1 + } + } + }, + { + "result": { + "chatItemUpdate": { + "chatInfo": { + "contact": { + "activeConn": { + "agentConnId": "agentConnId", + "authErrCounter": 0, + "connChatVersion": 22, + "connId": 1, + "connLevel": 0, + "connStatus": { + "type": "ready" + }, + "connType": "contact", + "contactConnInitiated": false, + "createdAt": "1970-01-01T00:00:00Z", + "entityId": 2, + "localAlias": "", + "peerChatVRange": { + "maxVersion": 22, + "minVersion": 9 + }, + "pqEncryption": true, + "pqRcvEnabled": true, + "pqSndEnabled": true, + "pqSupport": true, + "quotaErrCounter": 0, + "viaGroupLink": false + }, + "chatDeleted": false, + "chatSettings": { + "enableNtfs": "all", + "favorite": false + }, + "chatTags": [], + "chatTs": "1970-01-01T00:00:00Z", + "contactGrpInvSent": false, + "contactId": 2, + "contactStatus": "active", + "contactUsed": true, + "createdAt": "1970-01-01T00:00:00Z", + "localDisplayName": "bob", + "mergedPreferences": { + "calls": { + "contactPreference": { + "allow": "yes" + }, + "enabled": { + "forContact": true, + "forUser": true + }, + "userPreference": { + "preference": { + "allow": "yes" + }, + "type": "user" + } + }, + "commands": [], + "files": { + "contactPreference": { + "allow": "always" + }, + "enabled": { + "forContact": true, + "forUser": true + }, + "userPreference": { + "preference": { + "allow": "always" + }, + "type": "user" + } + }, + "fullDelete": { + "contactPreference": { + "allow": "no" + }, + "enabled": { + "forContact": false, + "forUser": false + }, + "userPreference": { + "preference": { + "allow": "no" + }, + "type": "user" + } + }, + "reactions": { + "contactPreference": { + "allow": "yes" + }, + "enabled": { + "forContact": true, + "forUser": true + }, + "userPreference": { + "preference": { + "allow": "yes" + }, + "type": "user" + } + }, + "sessions": { + "contactPreference": { + "allow": "no" + }, + "enabled": { + "forContact": false, + "forUser": false + }, + "userPreference": { + "preference": { + "allow": "no" + }, + "type": "user" + } + }, + "timedMessages": { + "contactPreference": { + "allow": "yes" + }, + "enabled": { + "forContact": true, + "forUser": true + }, + "userPreference": { + "preference": { + "allow": "yes" + }, + "type": "user" + } + }, + "voice": { + "contactPreference": { + "allow": "yes" + }, + "enabled": { + "forContact": true, + "forUser": true + }, + "userPreference": { + "preference": { + "allow": "yes" + }, + "type": "user" + } + } + }, + "profile": { + "displayName": "bob", + "fullName": "", + "image": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAKHGlDQ1BJQ0MgUHJvZmlsZQAASImFVgdUVNcWve9Nb7QZeu9NehtAem/Sq6gMQ28OQxWxgAQjEFFEREARNFQFg1KjiIhiIQgoYA9IEFBisCAq6OQNJNH4//r/zDpz9ttzz7n73ffWmg0A6QCDxYqD+QCIT0hmezlYywQEBsngngEYCAIy0AC6DGYSy8rDwxUg8Xf9d7wbAxC33tHgzvrP3/9nCISFJzEBgIIRTGey2MkILkawT1oyi4tnEUxjI6IQvMLFkauYqxjQQtewwuoaHy8bBNMBwJMZDHYkAERbhJdJZUYic4hhCNZOCItOQDB3vjkzioFwxLsIXhcRl5IOAImrRzs+fivCk7QRrIL0shAcwNUW+tX8yH/tFfrPXgxG5D84Pi6F+dc9ck+HHJ7g641UMSQlQATQBHEgBaQDGcACbLAVYaIRJhx5Dv+9j77aZ4OsZIFtSEc0iARRIBnpt/9qlvfqpGSQBhjImnCEcUU+NtxnujZy4fbqVEiU/wuXdQyA9S0cDqfzC+e2F4DzyLkSB79wyi0A8KoBcL2GmcJOXePQ3C8MIAJeQAOiQArIAxXuWwMMgSmwBHbAGbgDHxAINgMmojceUZUGMkEWyAX54AA4DMpAJTgJ6sAZ0ALawQVwGVwDt8AQGAUPwQSYBi/AAngHliEIwkEUiAqJQtKQIqQO6UJ0yByyg1whLygQCoEioQQoBcqE9kD5UBFUBlVB9dBPUCd0GboBDUP3oUloDnoNfYRRMBmmwZKwEqwF02Er2AX2gTfBkXAinAHnwPvhUrgaPg23wZfhW/AoPAG/gBdRAEVCCaFkURooOsoG5Y4KQkWg2KidqDxUCaoa1YT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CPncyht/99MNO/vr9AqW/CGi8sJqbAAAAAElFTkSuQmCC", + "localAlias": "", + "preferences": { + "calls": { + "allow": "yes" + }, + "commands": [], + "files": { + "allow": "always" + }, + "fullDelete": { + "allow": "no" + }, + "reactions": { + "allow": "yes" + }, + "sessions": { + "allow": "no" + }, + "timedMessages": { + "allow": "yes" + }, + "voice": { + "allow": "yes" + } + }, + "profileId": 2, + "shortDescr": "Bob" + }, + "updatedAt": "1970-01-01T00:00:00Z", + "userPreferences": {} + }, + "type": "direct" + }, + "chatItem": { + "chatDir": { + "type": "directRcv" + }, + "content": { + "msgContent": { + "text": "hello, alice", + "type": "text" + }, + "type": "rcvMsgContent" + }, + "mentions": {}, + "meta": { + "createdAt": "1970-01-01T00:00:00Z", + "deletable": false, + "editable": false, + "hasLink": false, + "itemEdited": true, + "itemId": 8, + "itemSharedMsgId": "itemSharedMsgId", + "itemStatus": { + "type": "rcvNew" + }, + "itemText": "hello, alice", + "itemTs": "1970-01-01T00:00:00Z", + "showGroupAsSender": false, + "updatedAt": "1970-01-01T00:00:00Z", + "userMention": false + }, + "reactions": [] + }, + "prevChatItem": { + "chatDir": { + "type": "directRcv" + }, + "content": { + "msgContent": { + "text": "hello there", + "type": "text" + }, + "type": "rcvMsgContent" + }, + "mentions": {}, + "meta": { + "createdAt": "1970-01-01T00:00:00Z", + "deletable": false, + "editable": false, + "hasLink": false, + "itemEdited": true, + "itemId": 8, + "itemSharedMsgId": "itemSharedMsgId", + "itemStatus": { + "type": "rcvNew" + }, + "itemText": "hello there", + "itemTs": "1970-01-01T00:00:00Z", + "showGroupAsSender": false, + "updatedAt": "1970-01-01T00:00:00Z", + "userMention": false + }, + "reactions": [] + } + }, + "type": "chatItemUpdated", + "user": { + "activeOrder": 1, + "activeUser": true, + "agentUserId": "1", + "autoAcceptGroupInvitations": false, + "autoAcceptMemberContacts": false, + "clientService": false, + "fullPreferences": { + "calls": { + "allow": "yes" + }, + "commands": [], + "files": { + "allow": "always" + }, + "fullDelete": { + "allow": "no" + }, + "reactions": { + "allow": "yes" + }, + "sessions": { + "allow": "no" + }, + "timedMessages": { + "allow": "yes" + }, + "voice": { + "allow": "yes" + } + }, + "localDisplayName": "alice", + "profile": { + "displayName": "alice", + "fullName": "", + "localAlias": "", + "preferences": { + "calls": { + "allow": "yes" + }, + "commands": [], + "files": { + "allow": "always" + }, + "fullDelete": { + "allow": "no" + }, + "reactions": { + "allow": "yes" + }, + "sessions": { + "allow": "no" + }, + "timedMessages": { + "allow": "yes" + }, + "voice": { + "allow": "yes" + } + }, + "profileId": 1, + "shortDescr": "Alice" + }, + "sendRcptsContacts": true, + "sendRcptsSmallGroups": true, + "showNtfs": true, + "userChatRelay": false, + "userContactId": 1, + "userId": 1 + } + } + } +] diff --git a/tests/fixtures/api/updates/direct-recreated.json b/tests/fixtures/api/updates/direct-recreated.json new file mode 100644 index 0000000000..bfa97a526b --- /dev/null +++ b/tests/fixtures/api/updates/direct-recreated.json @@ -0,0 +1,297 @@ +[ + { + "result": { + "chatItems": [ + { + "chatInfo": { + "contact": { + "activeConn": { + "agentConnId": "agentConnId", + "authErrCounter": 0, + "connChatVersion": 22, + "connId": 1, + "connLevel": 0, + "connStatus": { + "type": "ready" + }, + "connType": "contact", + "contactConnInitiated": false, + "createdAt": "1970-01-01T00:00:00Z", + "entityId": 2, + "localAlias": "", + "peerChatVRange": { + "maxVersion": 22, + "minVersion": 9 + }, + "pqEncryption": true, + "pqRcvEnabled": true, + "pqSndEnabled": true, + "pqSupport": true, + "quotaErrCounter": 0, + "viaGroupLink": false + }, + "chatDeleted": false, + "chatSettings": { + "enableNtfs": "all", + "favorite": false + }, + "chatTags": [], + "chatTs": "1970-01-01T00:00:00Z", + "contactGrpInvSent": false, + "contactId": 2, + "contactStatus": "active", + "contactUsed": true, + "createdAt": "1970-01-01T00:00:00Z", + "localDisplayName": "bob", + "mergedPreferences": { + "calls": { + "contactPreference": { + "allow": "yes" + }, + "enabled": { + "forContact": true, + "forUser": true + }, + "userPreference": { + "preference": { + "allow": "yes" + }, + "type": "user" + } + }, + "commands": [], + "files": { + "contactPreference": { + "allow": "always" + }, + "enabled": { + "forContact": true, + "forUser": true + }, + "userPreference": { + "preference": { + "allow": "always" + }, + "type": "user" + } + }, + "fullDelete": { + "contactPreference": { + "allow": "no" + }, + "enabled": { + "forContact": false, + "forUser": false + }, + "userPreference": { + "preference": { + "allow": "no" + }, + "type": "user" + } + }, + "reactions": { + "contactPreference": { + "allow": "yes" + }, + "enabled": { + "forContact": true, + "forUser": true + }, + "userPreference": { + "preference": { + "allow": "yes" + }, + "type": "user" + } + }, + "sessions": { + "contactPreference": { + "allow": "no" + }, + "enabled": { + "forContact": false, + "forUser": false + }, + "userPreference": { + "preference": { + "allow": "no" + }, + "type": "user" + } + }, + "timedMessages": { + "contactPreference": { + "allow": "yes" + }, + "enabled": { + "forContact": true, + "forUser": true + }, + "userPreference": { + "preference": { + "allow": "yes" + }, + "type": "user" + } + }, + "voice": { + "contactPreference": { + "allow": "yes" + }, + "enabled": { + "forContact": true, + "forUser": true + }, + "userPreference": { + "preference": { + "allow": "yes" + }, + "type": "user" + } + } + }, + "profile": { + "displayName": "bob", + "fullName": "", + "image": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAKHGlDQ1BJQ0MgUHJvZmlsZQAASImFVgdUVNcWve9Nb7QZeu9NehtAem/Sq6gMQ28OQxWxgAQjEFFEREARNFQFg1KjiIhiIQgoYA9IEFBisCAq6OQNJNH4//r/zDpz9ttzz7n73ffWmg0A6QCDxYqD+QCIT0hmezlYywQEBsngngEYCAIy0AC6DGYSy8rDwxUg8Xf9d7wbAxC33tHgzvrP3/9nCISFJzEBgIIRTGey2MkILkawT1oyi4tnEUxjI6IQvMLFkauYqxjQQtewwuoaHy8bBNMBwJMZDHYkAERbhJdJZUYic4hhCNZOCItOQDB3vjkzioFwxLsIXhcRl5IOAImrRzs+fivCk7QRrIL0shAcwNUW+tX8yH/tFfrPXgxG5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4d77u0dyaE5HHjczn7MzO7M7nU6/yXz+bwLhzCCjTQO+rZhDH3opuNLdRYN4RHe4RIKJ7R34Ro+4AEGSw2mE1iUwT18gpI74WvkGlccu4XNdH0jnYU7cAUacidn37qR23cOxc4aGU0nYUAn7iSWEHkz46w0ocdQu1X6B/AMQZ5o7KfBqNOfwRH8JB7FajGhnmcpKvQe3MEbvILiDm5gPXaCHnZr4vvFGMoEKudKn8YvQIOOe+YzCPop7dwJ3zRfJ7GDuso4YJGRa0yZgg4tUaNXdGrbuZWKKxzYYEJc2xp9AUUjGt8KC2jvgYadF8+10vJyDnNLXwbdiWUZi0fUK01Eoc+AZhCLZVzK4Vq6sDUdz+0dEcbbTTIOJmAyTVhx/WmvrExbv2jtPhWLKodjCtefZiEeZeVZWWSndgwj6fVf3XON8Qwq15++uoqrfYVrow6dGBpCq79ME291jaB0/Q2CPncyht/99MNO/vr9AqW/CGi8sJqbAAAAAElFTkSuQmCC", + "localAlias": "", + "preferences": { + "calls": { + "allow": "yes" + }, + "commands": [], + "files": { + "allow": "always" + }, + "fullDelete": { + "allow": "no" + }, + "reactions": { + "allow": "yes" + }, + "sessions": { + "allow": "no" + }, + "timedMessages": { + "allow": "yes" + }, + "voice": { + "allow": "yes" + } + }, + "profileId": 2, + "shortDescr": "Bob" + }, + "updatedAt": "1970-01-01T00:00:00Z", + "userPreferences": {} + }, + "type": "direct" + }, + "chatItem": { + "chatDir": { + "type": "directRcv" + }, + "content": { + "msgContent": { + "text": "hello again", + "type": "text" + }, + "type": "rcvMsgContent" + }, + "mentions": {}, + "meta": { + "createdAt": "1970-01-01T00:00:00Z", + "deletable": false, + "editable": false, + "hasLink": false, + "itemEdited": true, + "itemId": 10, + "itemSharedMsgId": "itemSharedMsgId", + "itemStatus": { + "type": "rcvNew" + }, + "itemText": "hello again", + "itemTs": "1970-01-01T00:00:00Z", + "showGroupAsSender": false, + "updatedAt": "1970-01-01T00:00:00Z", + "userMention": false + }, + "reactions": [] + } + } + ], + "type": "newChatItems", + "user": { + "activeOrder": 1, + "activeUser": true, + "agentUserId": "1", + "autoAcceptGroupInvitations": false, + "autoAcceptMemberContacts": false, + "clientService": false, + "fullPreferences": { + "calls": { + "allow": "yes" + }, + "commands": [], + "files": { + "allow": "always" + }, + "fullDelete": { + "allow": "no" + }, + "reactions": { + "allow": "yes" + }, + "sessions": { + "allow": "no" + }, + "timedMessages": { + "allow": "yes" + }, + "voice": { + "allow": "yes" + } + }, + "localDisplayName": "alice", + "profile": { + "displayName": "alice", + "fullName": "", + "localAlias": "", + "preferences": { + "calls": { + "allow": "yes" + }, + "commands": [], + "files": { + "allow": "always" + }, + "fullDelete": { + "allow": "no" + }, + "reactions": { + "allow": "yes" + }, + "sessions": { + "allow": "no" + }, + "timedMessages": { + "allow": "yes" + }, + "voice": { + "allow": "yes" + } + }, + "profileId": 1, + "shortDescr": "Alice" + }, + "sendRcptsContacts": true, + "sendRcptsSmallGroups": true, + "showNtfs": true, + "userChatRelay": false, + "userContactId": 1, + "userId": 1 + } + } + } +] diff --git a/tests/fixtures/api/updates/group-mention.json b/tests/fixtures/api/updates/group-mention.json new file mode 100644 index 0000000000..aedd90beb0 --- /dev/null +++ b/tests/fixtures/api/updates/group-mention.json @@ -0,0 +1,1154 @@ +[ + { + "result": { + "chatItems": [ + { + "chatInfo": { + "groupInfo": { + "chatSettings": { + "enableNtfs": "mentions", + "favorite": false + }, + "chatTags": [], + "chatTs": "1970-01-01T00:00:00Z", + "createdAt": "1970-01-01T00:00:00Z", + "fullGroupPreferences": { + "commands": [], + "comments": { + "enable": "off" + }, + "directMessages": { + "enable": "on" + }, + "files": { + "enable": "on" + }, + "fullDelete": { + "enable": "off" + }, + "history": { + "enable": "on" + }, + "reactions": { + "enable": "on" + }, + "reports": { + "enable": "on" + }, + "sessions": { + "enable": "off" + }, + "signMessages": { + "enable": "off" + }, + "simplexLinks": { + "enable": "on" + }, + "support": { + "enable": "on" + }, + "timedMessages": { + "enable": "off", + "ttl": 86400 + }, + "voice": { + "enable": "on" + } + }, + "groupId": 1, + "groupProfile": { + "displayName": "team", + "fullName": "", + "groupPreferences": { + "directMessages": { + "enable": "on" + }, + "history": { + "enable": "on" + } + } + }, + "groupSummary": { + "currentMembers": 2 + }, + "localAlias": "", + "localDisplayName": "team", + "membersRequireAttention": 0, + "membership": { + "blockedByAdmin": false, + "createdAt": "1970-01-01T00:00:00Z", + "groupId": 1, + "groupMemberId": 1, + "indexInGroup": 0, + "invitedBy": { + "type": "user" + }, + "localDisplayName": "alice", + "memberCategory": "user", + "memberChatVRange": { + "maxVersion": 22, + "minVersion": 9 + }, + "memberContactId": 1, + "memberContactProfileId": 1, + "memberId": "memberId", + "memberProfile": { + "displayName": "alice", + "fullName": "", + "localAlias": "", + "preferences": { + "calls": { + "allow": "yes" + }, + "commands": [], + "files": { + "allow": "always" + }, + "fullDelete": { + "allow": "no" + }, + "reactions": { + "allow": "yes" + }, + "sessions": { + "allow": "no" + }, + "timedMessages": { + "allow": "yes" + }, + "voice": { + "allow": "yes" + } + }, + "profileId": 1, + "shortDescr": "Alice" + }, + "memberPubKey": "memberPubKey", + "memberRole": "owner", + "memberSettings": { + "showMessages": true + }, + "memberStatus": "creator", + "updatedAt": "1970-01-01T00:00:00Z" + }, + "updatedAt": "1970-01-01T00:00:00Z", + "useRelays": false, + "userMemberProfileSentAt": "1970-01-01T00:00:00Z" + }, + "type": "group" + }, + "chatItem": { + "chatDir": { + "groupMember": { + "activeConn": { + "agentConnId": "agentConnId", + "authErrCounter": 0, + "connChatVersion": 22, + "connId": 2, + "connLevel": 0, + "connStatus": { + "type": "ready" + }, + "connType": "member", + "contactConnInitiated": false, + "createdAt": "1970-01-01T00:00:00Z", + "entityId": 2, + "localAlias": "", + "peerChatVRange": { + "maxVersion": 22, + "minVersion": 9 + }, + "pqEncryption": false, + "pqSupport": false, + "quotaErrCounter": 0, + "viaGroupLink": false + }, + "blockedByAdmin": false, + "createdAt": "1970-01-01T00:00:00Z", + "groupId": 1, + "groupMemberId": 2, + "indexInGroup": 1, + "invitedBy": { + "type": "user" + }, + "invitedByGroupMemberId": 1, + "localDisplayName": "bob", + "memberCategory": "invitee", + "memberChatVRange": { + "maxVersion": 22, + "minVersion": 9 + }, + "memberContactId": 2, + "memberContactProfileId": 2, + "memberId": "memberId", + "memberProfile": { + "displayName": "bob", + "fullName": "", + "image": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAKHGlDQ1BJQ0MgUHJvZmlsZQAASImFVgdUVNcWve9Nb7QZeu9NehtAem/Sq6gMQ28OQxWxgAQjEFFEREARNFQFg1KjiIhiIQgoYA9IEFBisCAq6OQNJNH4//r/zDpz9ttzz7n73ffWmg0A6QCDxYqD+QCIT0hmezlYywQEBsngngEYCAIy0AC6DGYSy8rDwxUg8Xf9d7wbAxC33tHgzvrP3/9nCISFJzEBgIIRTGey2MkILkawT1oyi4tnEUxjI6IQvMLFkauYqxjQQtewwuoaHy8bBNMBwJMZDHYkAERbhJdJZUYic4hhCNZOCItOQDB3vjkzioFwxLsIXhcRl5IOAImrRzs+fivCk7QRrIL0shAcwNUW+tX8yH/tFfrPXgxG5D84Pi6F+dc9ck+HHJ7g641UMSQlQATQBHEgBaQDGcACbLAVYaIRJhx5Dv+9j77aZ4OsZIFtSEc0iARRIBnpt/9qlvfqpGSQBhjImnCEcUU+NtxnujZy4fbqVEiU/wuXdQyA9S0cDqfzC+e2F4DzyLkSB79wyi0A8KoBcL2GmcJOXePQ3C8MIAJeQAOiQArIAxXuWwMMgSmwBHbAGbgDHxAINgMmojceUZUGMkEWyAX54AA4DMpAJTgJ6sAZ0ALawQVwGVwDt8AQGAUPwQSYBi/AAngHliEIwkEUiAqJQtKQIqQO6UJ0yByyg1whLygQCoEioQQoBcqE9kD5UBFUBlVB9dBPUCd0GboBDUP3oUloDnoNfYRRMBmmwZKwEqwF02Er2AX2gTfBkXAinAHnwPvhUrgaPg23wZfhW/AoPAG/gBdRAEVCCaFkURooOsoG5Y4K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dGBpCq79ME291jaB0/Q2CPncyht/99MNO/vr9AqW/CGi8sJqbAAAAAElFTkSuQmCC", + "localAlias": "", + "preferences": { + "calls": { + "allow": "yes" + }, + "commands": [], + "files": { + "allow": "always" + }, + "fullDelete": { + "allow": "no" + }, + "reactions": { + "allow": "yes" + }, + "sessions": { + "allow": "no" + }, + "timedMessages": { + "allow": "yes" + }, + "voice": { + "allow": "yes" + } + }, + "profileId": 2, + "shortDescr": "Bob" + }, + "memberPubKey": "memberPubKey", + "memberRole": "admin", + "memberSettings": { + "showMessages": true + }, + "memberStatus": "connected", + "updatedAt": "1970-01-01T00:00:00Z" + }, + "type": "groupRcv" + }, + "content": { + "msgContent": { + "text": "hello", + "type": "text" + }, + "type": "rcvMsgContent" + }, + "mentions": {}, + "meta": { + "createdAt": "1970-01-01T00:00:00Z", + "deletable": false, + "editable": false, + "hasLink": false, + "itemEdited": false, + "itemId": 22, + "itemSharedMsgId": "itemSharedMsgId", + "itemStatus": { + "type": "rcvNew" + }, + "itemText": "hello", + "itemTs": "1970-01-01T00:00:00Z", + "showGroupAsSender": false, + "updatedAt": "1970-01-01T00:00:00Z", + "userMention": false + }, + "reactions": [] + } + } + ], + "type": "newChatItems", + "user": { + "activeOrder": 1, + "activeUser": true, + "agentUserId": "1", + "autoAcceptGroupInvitations": false, + "autoAcceptMemberContacts": false, + "clientService": false, + "fullPreferences": { + "calls": { + "allow": "yes" + }, + "commands": [], + "files": { + "allow": "always" + }, + "fullDelete": { + "allow": "no" + }, + "reactions": { + "allow": "yes" + }, + "sessions": { + "allow": "no" + }, + "timedMessages": { + "allow": "yes" + }, + "voice": { + "allow": "yes" + } + }, + "localDisplayName": "alice", + "profile": { + "displayName": "alice", + "fullName": "", + "localAlias": "", + "preferences": { + "calls": { + "allow": "yes" + }, + "commands": [], + "files": { + "allow": "always" + }, + "fullDelete": { + "allow": "no" + }, + "reactions": { + "allow": "yes" + }, + "sessions": { + "allow": "no" + }, + "timedMessages": { + "allow": "yes" + }, + "voice": { + "allow": "yes" + } + }, + "profileId": 1, + "shortDescr": "Alice" + }, + "sendRcptsContacts": true, + "sendRcptsSmallGroups": true, + "showNtfs": true, + "userChatRelay": false, + "userContactId": 1, + "userId": 1 + } + } + }, + { + "result": { + "chatItemUpdate": { + "chatInfo": { + "groupInfo": { + "chatSettings": { + "enableNtfs": "mentions", + "favorite": false + }, + "chatTags": [], + "chatTs": "1970-01-01T00:00:00Z", + "createdAt": "1970-01-01T00:00:00Z", + "fullGroupPreferences": { + "commands": [], + "comments": { + "enable": "off" + }, + "directMessages": { + "enable": "on" + }, + "files": { + "enable": "on" + }, + "fullDelete": { + "enable": "off" + }, + "history": { + "enable": "on" + }, + "reactions": { + "enable": "on" + }, + "reports": { + "enable": "on" + }, + "sessions": { + "enable": "off" + }, + "signMessages": { + "enable": "off" + }, + "simplexLinks": { + "enable": "on" + }, + "support": { + "enable": "on" + }, + "timedMessages": { + "enable": "off", + "ttl": 86400 + }, + "voice": { + "enable": "on" + } + }, + "groupId": 1, + "groupProfile": { + "displayName": "team", + "fullName": "", + "groupPreferences": { + "directMessages": { + "enable": "on" + }, + "history": { + "enable": "on" + } + } + }, + "groupSummary": { + "currentMembers": 2 + }, + "localAlias": "", + "localDisplayName": "team", + "membersRequireAttention": 0, + "membership": { + "blockedByAdmin": false, + "createdAt": "1970-01-01T00:00:00Z", + "groupId": 1, + "groupMemberId": 1, + "indexInGroup": 0, + "invitedBy": { + "type": "user" + }, + "localDisplayName": "alice", + "memberCategory": "user", + "memberChatVRange": { + "maxVersion": 22, + "minVersion": 9 + }, + "memberContactId": 1, + "memberContactProfileId": 1, + "memberId": "memberId", + "memberProfile": { + "displayName": "alice", + "fullName": "", + "localAlias": "", + "preferences": { + "calls": { + "allow": "yes" + }, + "commands": [], + "files": { + "allow": "always" + }, + "fullDelete": { + "allow": "no" + }, + "reactions": { + "allow": "yes" + }, + "sessions": { + "allow": "no" + }, + "timedMessages": { + "allow": "yes" + }, + "voice": { + "allow": "yes" + } + }, + "profileId": 1, + "shortDescr": "Alice" + }, + "memberPubKey": "memberPubKey", + "memberRole": "owner", + "memberSettings": { + "showMessages": true + }, + "memberStatus": "creator", + "updatedAt": "1970-01-01T00:00:00Z" + }, + "updatedAt": "1970-01-01T00:00:00Z", + "useRelays": false, + "userMemberProfileSentAt": "1970-01-01T00:00:00Z" + }, + "type": "group" + }, + "chatItem": { + "chatDir": { + "groupMember": { + "blockedByAdmin": false, + "createdAt": "1970-01-01T00:00:00Z", + "groupId": 1, + "groupMemberId": 2, + "indexInGroup": 1, + "invitedBy": { + "type": "user" + }, + "invitedByGroupMemberId": 1, + "localDisplayName": "bob", + "memberCategory": "invitee", + "memberChatVRange": { + "maxVersion": 22, + "minVersion": 9 + }, + "memberContactId": 2, + "memberContactProfileId": 2, + "memberId": "memberId", + "memberProfile": { + "displayName": "bob", + "fullName": "", + "image": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAKHGlDQ1BJQ0MgUHJvZmlsZQAASImFVgdUVNcWve9Nb7QZeu9NehtAem/Sq6gMQ28OQxWxgAQjEFFEREARNFQFg1KjiIhiIQgoYA9IEFBisCAq6OQNJNH4//r/zDpz9ttzz7n73ffWmg0A6QCDxYqD+QCIT0hmezlYywQEBsngngEYCAIy0AC6DGYSy8rDwxUg8Xf9d7wbAxC33tHgzvrP3/9nCISFJzEBgIIRTGey2MkILkawT1oyi4tnEUxjI6IQvMLFkauYqxjQQtewwuoaHy8bBNMBwJMZDHYkAERbhJdJZUYic4hhCNZOCItOQDB3vjkzioFwxLsIXhcRl5IOAImrRzs+fivCk7QRrIL0shAcwNUW+tX8yH/tFfrPXgxG5D84Pi6F+dc9ck+HHJ7g641UMSQlQATQBHEgBaQDGcACbLAVYaIRJhx5Dv+9j77aZ4OsZIFtSEc0iARRIBnpt/9qlvfqpGSQBhjImnCEcUU+NtxnujZy4fbqVEiU/wuXdQyA9S0cDqfzC+e2F4DzyLkSB79wyi0A8KoBcL2GmcJ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fBqNOfwRH8JB7FajGhnmcpKvQe3MEbvILiDm5gPXaCHnZr4vvFGMoEKudKn8YvQIOOe+YzCPop7dwJ3zRfJ7GDuso4YJGRa0yZgg4tUaNXdGrbuZWKKxzYYEJc2xp9AUUjGt8KC2jvgYadF8+10vJyDnNLXwbdiWUZi0fUK01Eoc+AZhCLZVzK4Vq6sDUdz+0dEcbbTTIOJmAyTVhx/WmvrExbv2jtPhWLKodjCtefZiEeZeVZWWSndgwj6fVf3XON8Qwq15++uoqrfYVrow6dGBpCq79ME291jaB0/Q2CPncyht/99MNO/vr9AqW/CGi8sJqbAAAAAElFTkSuQmCC", + "localAlias": "", + "preferences": { + "calls": { + "allow": "yes" + }, + "commands": [], + "files": { + "allow": "always" + }, + "fullDelete": { + "allow": "no" + }, + "reactions": { + "allow": "yes" + }, + "sessions": { + "allow": "no" + }, + "timedMessages": { + "allow": "yes" + }, + "voice": { + "allow": "yes" + } + }, + "profileId": 2, + "shortDescr": "Bob" + }, + "memberPubKey": "memberPubKey", + "memberRole": "admin", + "memberSettings": { + "showMessages": true + }, + "memberStatus": "connected", + "updatedAt": "1970-01-01T00:00:00Z" + }, + "type": "groupRcv" + }, + "content": { + "msgContent": { + "text": "hello @alice", + "type": "text" + }, + "type": "rcvMsgContent" + }, + "formattedText": [ + { + "text": "hello " + }, + { + "format": { + "memberName": "alice", + "type": "mention" + }, + "text": "@alice" + } + ], + "mentions": { + "alice": { + "memberId": "memberId", + "memberRef": { + "displayName": "alice", + "groupMemberId": 1, + "localAlias": "", + "memberRole": "owner" + } + } + }, + "meta": { + "createdAt": "1970-01-01T00:00:00Z", + "deletable": false, + "editable": false, + "hasLink": false, + "itemEdited": true, + "itemId": 22, + "itemSharedMsgId": "itemSharedMsgId", + "itemStatus": { + "type": "rcvNew" + }, + "itemText": "hello @alice", + "itemTs": "1970-01-01T00:00:00Z", + "showGroupAsSender": false, + "updatedAt": "1970-01-01T00:00:00Z", + "userMention": true + }, + "reactions": [] + }, + "prevChatItem": { + "chatDir": { + "groupMember": { + "blockedByAdmin": false, + "createdAt": "1970-01-01T00:00:00Z", + "groupId": 1, + "groupMemberId": 2, + "indexInGroup": 1, + "invitedBy": { + "type": "user" + }, + "invitedByGroupMemberId": 1, + "localDisplayName": "bob", + "memberCategory": "invitee", + "memberChatVRange": { + "maxVersion": 22, + "minVersion": 9 + }, + "memberContactId": 2, + "memberContactProfileId": 2, + "memberId": "memberId", + "memberProfile": { + "displayName": "bob", + "fullName": "", + "image": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAKHGlDQ1BJQ0MgUHJvZmlsZQAASImFVgdUVNcWve9Nb7QZeu9NehtAem/Sq6gMQ28OQxWxgAQjEFFEREARNFQFg1KjiIhiIQgoYA9IEFBisCAq6OQNJNH4//r/zDpz9ttzz7n73ffWmg0A6QCDxYqD+QCIT0hmezlYywQEBsngngEYCAIy0AC6DGYSy8rDwxUg8Xf9d7wbAxC33tHgzvrP3/9nCISFJzEBgIIRTGey2MkILkawT1oyi4tnEUxjI6IQvMLFkauYqxjQQtewwuoaHy8bBNMBwJMZDHYkAERbhJdJZUYic4hhCNZOCItOQDB3vjkzioFwxLsIXhcRl5IOAImrRzs+fivCk7QRrIL0shAcwNUW+tX8yH/tFfrPXgxG5D84Pi6F+dc9ck+HHJ7g641UMSQlQATQBHEgBaQDGcACbLAVYaIRJhx5Dv+9j77aZ4OsZIFtSEc0iARRIBnpt/9qlvfqpGSQBhjImnCEcUU+NtxnujZy4fbqVEiU/wuXdQyA9S0cDqfzC+e2F4DzyLkSB79wyi0A8KoBcL2GmcJOXePQ3C8MIAJeQAOiQArIAxXuWwMMgSmwBHbAGbgDHxAINgMmojceUZUGMkEWyAX54AA4DMpAJTgJ6sAZ0ALawQVwGVwDt8AQGAUPwQSYBi/AAngHliEIwkEUiAqJQtKQIqQO6UJ0yByyg1whLygQCoEioQQoBcqE9kD5UBFUBlVB9dBPUCd0GboBDUP3oUloDnoNfYRRMBmmw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TIOJmAyTVhx/WmvrExbv2jtPhWLKodjCtefZiEeZeVZWWSndgwj6fVf3XON8Qwq15++uoqrfYVrow6dGBpCq79ME291jaB0/Q2CPncyht/99MNO/vr9AqW/CGi8sJqbAAAAAElFTkSuQmCC", + "localAlias": "", + "preferences": { + "calls": { + "allow": "yes" + }, + "commands": [], + "files": { + "allow": "always" + }, + "fullDelete": { + "allow": "no" + }, + "reactions": { + "allow": "yes" + }, + "sessions": { + "allow": "no" + }, + "timedMessages": { + "allow": "yes" + }, + "voice": { + "allow": "yes" + } + }, + "profileId": 2, + "shortDescr": "Bob" + }, + "memberPubKey": "memberPubKey", + "memberRole": "admin", + "memberSettings": { + "showMessages": true + }, + "memberStatus": "connected", + "updatedAt": "1970-01-01T00:00:00Z" + }, + "type": "groupRcv" + }, + "content": { + "msgContent": { + "text": "hello", + "type": "text" + }, + "type": "rcvMsgContent" + }, + "mentions": {}, + "meta": { + "createdAt": "1970-01-01T00:00:00Z", + "deletable": false, + "editable": false, + "hasLink": false, + "itemEdited": false, + "itemId": 22, + "itemSharedMsgId": "itemSharedMsgId", + "itemStatus": { + "type": "rcvNew" + }, + "itemText": "hello", + "itemTs": "1970-01-01T00:00:00Z", + "showGroupAsSender": false, + "updatedAt": "1970-01-01T00:00:00Z", + "userMention": false + }, + "reactions": [] + } + }, + "type": "chatItemUpdated", + "user": { + "activeOrder": 1, + "activeUser": true, + "agentUserId": "1", + "autoAcceptGroupInvitations": false, + "autoAcceptMemberContacts": false, + "clientService": false, + "fullPreferences": { + "calls": { + "allow": "yes" + }, + "commands": [], + "files": { + "allow": "always" + }, + "fullDelete": { + "allow": "no" + }, + "reactions": { + "allow": "yes" + }, + "sessions": { + "allow": "no" + }, + "timedMessages": { + "allow": "yes" + }, + "voice": { + "allow": "yes" + } + }, + "localDisplayName": "alice", + "profile": { + "displayName": "alice", + "fullName": "", + "localAlias": "", + "preferences": { + "calls": { + "allow": "yes" + }, + "commands": [], + "files": { + "allow": "always" + }, + "fullDelete": { + "allow": "no" + }, + "reactions": { + "allow": "yes" + }, + "sessions": { + "allow": "no" + }, + "timedMessages": { + "allow": "yes" + }, + "voice": { + "allow": "yes" + } + }, + "profileId": 1, + "shortDescr": "Alice" + }, + "sendRcptsContacts": true, + "sendRcptsSmallGroups": true, + "showNtfs": true, + "userChatRelay": false, + "userContactId": 1, + "userId": 1 + } + } + }, + { + "result": { + "chatItemUpdate": { + "chatInfo": { + "groupInfo": { + "chatSettings": { + "enableNtfs": "mentions", + "favorite": false + }, + "chatTags": [], + "chatTs": "1970-01-01T00:00:00Z", + "createdAt": "1970-01-01T00:00:00Z", + "fullGroupPreferences": { + "commands": [], + "comments": { + "enable": "off" + }, + "directMessages": { + "enable": "on" + }, + "files": { + "enable": "on" + }, + "fullDelete": { + "enable": "off" + }, + "history": { + "enable": "on" + }, + "reactions": { + "enable": "on" + }, + "reports": { + "enable": "on" + }, + "sessions": { + "enable": "off" + }, + "signMessages": { + "enable": "off" + }, + "simplexLinks": { + "enable": "on" + }, + "support": { + "enable": "on" + }, + "timedMessages": { + "enable": "off", + "ttl": 86400 + }, + "voice": { + "enable": "on" + } + }, + "groupId": 1, + "groupProfile": { + "displayName": "team", + "fullName": "", + "groupPreferences": { + "directMessages": { + "enable": "on" + }, + "history": { + "enable": "on" + } + } + }, + "groupSummary": { + "currentMembers": 2 + }, + "localAlias": "", + "localDisplayName": "team", + "membersRequireAttention": 0, + "membership": { + "blockedByAdmin": false, + "createdAt": "1970-01-01T00:00:00Z", + "groupId": 1, + "groupMemberId": 1, + "indexInGroup": 0, + "invitedBy": { + "type": "user" + }, + "localDisplayName": "alice", + "memberCategory": "user", + "memberChatVRange": { + "maxVersion": 22, + "minVersion": 9 + }, + "memberContactId": 1, + "memberContactProfileId": 1, + "memberId": "memberId", + "memberProfile": { + "displayName": "alice", + "fullName": "", + "localAlias": "", + "preferences": { + "calls": { + "allow": "yes" + }, + "commands": [], + "files": { + "allow": "always" + }, + "fullDelete": { + "allow": "no" + }, + "reactions": { + "allow": "yes" + }, + "sessions": { + "allow": "no" + }, + "timedMessages": { + "allow": "yes" + }, + "voice": { + "allow": "yes" + } + }, + "profileId": 1, + "shortDescr": "Alice" + }, + "memberPubKey": "memberPubKey", + "memberRole": "owner", + "memberSettings": { + "showMessages": true + }, + "memberStatus": "creator", + "updatedAt": "1970-01-01T00:00:00Z" + }, + "updatedAt": "1970-01-01T00:00:00Z", + "useRelays": false, + "userMemberProfileSentAt": "1970-01-01T00:00:00Z" + }, + "type": "group" + }, + "chatItem": { + "chatDir": { + "groupMember": { + "blockedByAdmin": false, + "createdAt": "1970-01-01T00:00:00Z", + "groupId": 1, + "groupMemberId": 2, + "indexInGroup": 1, + "invitedBy": { + "type": "user" + }, + "invitedByGroupMemberId": 1, + "localDisplayName": "bob", + "memberCategory": "invitee", + "memberChatVRange": { + "maxVersion": 22, + "minVersion": 9 + }, + "memberContactId": 2, + "memberContactProfileId": 2, + "memberId": "memberId", + "memberProfile": { + "displayName": "bob", + "fullName": "", + "image": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAKHGlDQ1BJQ0MgUHJvZmlsZQAASImFVgdUVNcWve9Nb7QZeu9NehtAem/Sq6gMQ28OQxWxgAQjEFFEREARNFQFg1KjiIhiIQgoYA9IEFBisCAq6OQNJNH4//r/zDpz9ttzz7n73ffWmg0A6QCDxYqD+QCIT0hmezlYywQEBsngngEYCAIy0AC6DGYSy8rDwxUg8Xf9d7wbAxC33tHgzvrP3/9nCISFJzEBgIIRTGey2MkILkawT1oyi4tnEUxjI6IQvMLFkauYqxjQQtewwuoaHy8bBNMBwJMZDHYkAERbhJdJZUYic4hhCNZOCItOQDB3vjkzioFwxLsIXhcRl5IOAImrRzs+fivCk7QRrIL0shAcwNUW+tX8yH/tFfrPXgxG5D84Pi6F+dc9ck+HHJ7g641UMSQlQATQBHEgBaQDGcACbLAVYaIRJhx5Dv+9j77aZ4OsZIFtSEc0iARRIBnpt/9qlvfqpGSQ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WvkGlccu4XNdH0jnYU7cAUacidn37qR23cOxc4aGU0nYUAn7iSWEHkz46w0ocdQu1X6B/AMQZ5o7KfBqNOfwRH8JB7FajGhnmcpKvQe3MEbvILiDm5gPXaCHnZr4vvFGMoEKudKn8YvQIOOe+YzCPop7dwJ3zRfJ7GDuso4YJGRa0yZgg4tUaNXdGrbuZWKKxzYYEJc2xp9AUUjGt8KC2jvgYadF8+10vJyDnNLXwbdiWUZi0fUK01Eoc+AZhCLZVzK4Vq6sDUdz+0dEcbbTTIOJmAyTVhx/WmvrExbv2jtPhWLKodjCtefZiEeZeVZWWSndgwj6fVf3XON8Qwq15++uoqrfYVrow6dGBpCq79ME291jaB0/Q2CPncyht/99MNO/vr9AqW/CGi8sJqbAAAAAElFTkSuQmCC", + "localAlias": "", + "preferences": { + "calls": { + "allow": "yes" + }, + "commands": [], + "files": { + "allow": "always" + }, + "fullDelete": { + "allow": "no" + }, + "reactions": { + "allow": "yes" + }, + "sessions": { + "allow": "no" + }, + "timedMessages": { + "allow": "yes" + }, + "voice": { + "allow": "yes" + } + }, + "profileId": 2, + "shortDescr": "Bob" + }, + "memberPubKey": "memberPubKey", + "memberRole": "admin", + "memberSettings": { + "showMessages": true + }, + "memberStatus": "connected", + "updatedAt": "1970-01-01T00:00:00Z" + }, + "type": "groupRcv" + }, + "content": { + "msgContent": { + "text": "hello", + "type": "text" + }, + "type": "rcvMsgContent" + }, + "mentions": {}, + "meta": { + "createdAt": "1970-01-01T00:00:00Z", + "deletable": false, + "editable": false, + "hasLink": false, + "itemEdited": true, + "itemId": 22, + "itemSharedMsgId": "itemSharedMsgId", + "itemStatus": { + "type": "rcvNew" + }, + "itemText": "hello", + "itemTs": "1970-01-01T00:00:00Z", + "showGroupAsSender": false, + "updatedAt": "1970-01-01T00:00:00Z", + "userMention": false + }, + "reactions": [] + }, + "prevChatItem": { + "chatDir": { + "groupMember": { + "blockedByAdmin": false, + "createdAt": "1970-01-01T00:00:00Z", + "groupId": 1, + "groupMemberId": 2, + "indexInGroup": 1, + "invitedBy": { + "type": "user" + }, + "invitedByGroupMemberId": 1, + "localDisplayName": "bob", + "memberCategory": "invitee", + "memberChatVRange": { + "maxVersion": 22, + "minVersion": 9 + }, + "memberContactId": 2, + "memberContactProfileId": 2, + "memberId": "memberId", + "memberProfile": { + "displayName": "bob", + "fullName": "", + "image": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAKHGlDQ1BJQ0MgUHJvZmlsZQAASImFVgdUVNcWve9Nb7QZeu9NehtAem/Sq6gMQ28OQxWxgAQjEFFEREARNFQFg1KjiIhiIQgoYA9IEFBisCAq6OQNJNH4//r/zDpz9ttzz7n73ffWmg0A6QCDxYqD+QCIT0hmezlYywQEBsngngEYCAIy0AC6DGYSy8rDwxUg8Xf9d7wbAxC33tHgzvrP3/9nCISFJzEBgIIRTGey2MkILkawT1oyi4tnEUxjI6IQvMLFkauYqxjQQtewwuoaHy8bBNMBwJMZDHYkAERbhJdJZUYic4hhCNZOCItOQDB3vjkzioFwxLsIXhcRl5IOAImrRzs+fivCk7QRrIL0shAcwNUW+tX8yH/tFfrPXgxG5D84Pi6F+dc9ck+HHJ7g641UMSQlQATQBHEgBaQDGcACbLAVYaIRJhx5Dv+9j77aZ4OsZIFtSEc0iARRIBnpt/9qlvfqpGSQBhjImnCEcUU+NtxnujZy4fbqVEiU/wuXdQyA9S0cDqfzC+e2F4DzyLkSB79wyi0A8KoBcL2GmcJOXePQ3C8MIAJeQAOiQArIAxXuWwMMgSmwBHbAGbgDHxAINgMmojceUZUGMkEWyAX54AA4DMpAJTgJ6sAZ0ALawQVwGVwDt8AQGAUPwQSYBi/AAngHliEIwkEUiAqJQtKQIqQO6UJ0yByyg1whLygQCoEioQQoBcqE9kD5UBFUBlVB9dBPUCd0GboBDUP3oUloDnoNfYRRMBmmwZKwEqwF02Er2AX2gTfBkXAinAHnwPvhUrgaPg23wZfhW/AoPAG/gBdRAEVCCaFkURooOsoG5Y4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6dGBpCq79ME291jaB0/Q2CPncyht/99MNO/vr9AqW/CGi8sJqbAAAAAElFTkSuQmCC", + "localAlias": "", + "preferences": { + "calls": { + "allow": "yes" + }, + "commands": [], + "files": { + "allow": "always" + }, + "fullDelete": { + "allow": "no" + }, + "reactions": { + "allow": "yes" + }, + "sessions": { + "allow": "no" + }, + "timedMessages": { + "allow": "yes" + }, + "voice": { + "allow": "yes" + } + }, + "profileId": 2, + "shortDescr": "Bob" + }, + "memberPubKey": "memberPubKey", + "memberRole": "admin", + "memberSettings": { + "showMessages": true + }, + "memberStatus": "connected", + "updatedAt": "1970-01-01T00:00:00Z" + }, + "type": "groupRcv" + }, + "content": { + "msgContent": { + "text": "hello @alice", + "type": "text" + }, + "type": "rcvMsgContent" + }, + "formattedText": [ + { + "text": "hello " + }, + { + "format": { + "memberName": "alice", + "type": "mention" + }, + "text": "@alice" + } + ], + "mentions": { + "alice": { + "memberId": "memberId", + "memberRef": { + "displayName": "alice", + "groupMemberId": 1, + "localAlias": "", + "memberRole": "owner" + } + } + }, + "meta": { + "createdAt": "1970-01-01T00:00:00Z", + "deletable": false, + "editable": false, + "hasLink": false, + "itemEdited": true, + "itemId": 22, + "itemSharedMsgId": "itemSharedMsgId", + "itemStatus": { + "type": "rcvNew" + }, + "itemText": "hello @alice", + "itemTs": "1970-01-01T00:00:00Z", + "showGroupAsSender": false, + "updatedAt": "1970-01-01T00:00:00Z", + "userMention": true + }, + "reactions": [] + } + }, + "type": "chatItemUpdated", + "user": { + "activeOrder": 1, + "activeUser": true, + "agentUserId": "1", + "autoAcceptGroupInvitations": false, + "autoAcceptMemberContacts": false, + "clientService": false, + "fullPreferences": { + "calls": { + "allow": "yes" + }, + "commands": [], + "files": { + "allow": "always" + }, + "fullDelete": { + "allow": "no" + }, + "reactions": { + "allow": "yes" + }, + "sessions": { + "allow": "no" + }, + "timedMessages": { + "allow": "yes" + }, + "voice": { + "allow": "yes" + } + }, + "localDisplayName": "alice", + "profile": { + "displayName": "alice", + "fullName": "", + "localAlias": "", + "preferences": { + "calls": { + "allow": "yes" + }, + "commands": [], + "files": { + "allow": "always" + }, + "fullDelete": { + "allow": "no" + }, + "reactions": { + "allow": "yes" + }, + "sessions": { + "allow": "no" + }, + "timedMessages": { + "allow": "yes" + }, + "voice": { + "allow": "yes" + } + }, + "profileId": 1, + "shortDescr": "Alice" + }, + "sendRcptsContacts": true, + "sendRcptsSmallGroups": true, + "showNtfs": true, + "userChatRelay": false, + "userContactId": 1, + "userId": 1 + } + } + } +] diff --git a/tests/fixtures/api/updates/missed-call.json b/tests/fixtures/api/updates/missed-call.json new file mode 100644 index 0000000000..8448260897 --- /dev/null +++ b/tests/fixtures/api/updates/missed-call.json @@ -0,0 +1,615 @@ +[ + { + "result": { + "chatItems": [ + { + "chatInfo": { + "contact": { + "activeConn": { + "agentConnId": "agentConnId", + "authErrCounter": 0, + "connChatVersion": 22, + "connId": 1, + "connLevel": 0, + "connStatus": { + "type": "ready" + }, + "connType": "contact", + "contactConnInitiated": false, + "createdAt": "1970-01-01T00:00:00Z", + "entityId": 2, + "localAlias": "", + "peerChatVRange": { + "maxVersion": 22, + "minVersion": 9 + }, + "pqEncryption": true, + "pqRcvEnabled": true, + "pqSndEnabled": true, + "pqSupport": true, + "quotaErrCounter": 0, + "viaGroupLink": false + }, + "chatDeleted": false, + "chatSettings": { + "enableNtfs": "all", + "favorite": false + }, + "chatTags": [], + "chatTs": "1970-01-01T00:00:00Z", + "contactGrpInvSent": false, + "contactId": 2, + "contactStatus": "active", + "contactUsed": true, + "createdAt": "1970-01-01T00:00:00Z", + "localDisplayName": "alice", + "mergedPreferences": { + "calls": { + "contactPreference": { + "allow": "yes" + }, + "enabled": { + "forContact": true, + "forUser": true + }, + "userPreference": { + "preference": { + "allow": "yes" + }, + "type": "user" + } + }, + "commands": [], + "files": { + "contactPreference": { + "allow": "always" + }, + "enabled": { + "forContact": true, + "forUser": true + }, + "userPreference": { + "preference": { + "allow": "always" + }, + "type": "user" + } + }, + "fullDelete": { + "contactPreference": { + "allow": "no" + }, + "enabled": { + "forContact": false, + "forUser": false + }, + "userPreference": { + "preference": { + "allow": "no" + }, + "type": "user" + } + }, + "reactions": { + "contactPreference": { + "allow": "yes" + }, + "enabled": { + "forContact": true, + "forUser": true + }, + "userPreference": { + "preference": { + "allow": "yes" + }, + "type": "user" + } + }, + "sessions": { + "contactPreference": { + "allow": "no" + }, + "enabled": { + "forContact": false, + "forUser": false + }, + "userPreference": { + "preference": { + "allow": "no" + }, + "type": "user" + } + }, + "timedMessages": { + "contactPreference": { + "allow": "yes" + }, + "enabled": { + "forContact": true, + "forUser": true + }, + "userPreference": { + "preference": { + "allow": "yes" + }, + "type": "user" + } + }, + "voice": { + "contactPreference": { + "allow": "yes" + }, + "enabled": { + "forContact": true, + "forUser": true + }, + "userPreference": { + "preference": { + "allow": "yes" + }, + "type": "user" + } + } + }, + "profile": { + "displayName": "alice", + "fullName": "", + "localAlias": "", + "preferences": { + "calls": { + "allow": "yes" + }, + "commands": [], + "files": { + "allow": "always" + }, + "fullDelete": { + "allow": "no" + }, + "reactions": { + "allow": "yes" + }, + "sessions": { + "allow": "no" + }, + "timedMessages": { + "allow": "yes" + }, + "voice": { + "allow": "yes" + } + }, + "profileId": 2, + "shortDescr": "Alice" + }, + "updatedAt": "1970-01-01T00:00:00Z", + "userPreferences": {} + }, + "type": "direct" + }, + "chatItem": { + "chatDir": { + "type": "directRcv" + }, + "content": { + "duration": 0, + "status": "pending", + "type": "rcvCall" + }, + "mentions": {}, + "meta": { + "createdAt": "1970-01-01T00:00:00Z", + "deletable": false, + "editable": false, + "hasLink": false, + "itemEdited": false, + "itemId": 8, + "itemSharedMsgId": "itemSharedMsgId", + "itemStatus": { + "type": "rcvNew" + }, + "itemText": "incoming call: calling...", + "itemTs": "1970-01-01T00:00:00Z", + "showGroupAsSender": false, + "updatedAt": "1970-01-01T00:00:00Z", + "userMention": false + }, + "reactions": [] + } + } + ], + "type": "newChatItems", + "user": { + "activeOrder": 1, + "activeUser": true, + "agentUserId": "1", + "autoAcceptGroupInvitations": false, + "autoAcceptMemberContacts": false, + "clientService": false, + "fullPreferences": { + "calls": { + "allow": "yes" + }, + "commands": [], + "files": { + "allow": "always" + }, + "fullDelete": { + "allow": "no" + }, + "reactions": { + "allow": "yes" + }, + "sessions": { + "allow": "no" + }, + "timedMessages": { + "allow": "yes" + }, + "voice": { + "allow": "yes" + } + }, + "localDisplayName": "bob", + "profile": { + "displayName": "bob", + "fullName": "", + "image": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAKHGlDQ1BJQ0MgUHJvZmlsZQAASImFVgdUVNcWve9Nb7QZeu9NehtAem/Sq6gMQ28OQxWxgAQjEFFEREARNFQFg1KjiIhiIQgoYA9IEFBisCAq6OQNJNH4//r/zDpz9ttzz7n73ffWmg0A6QCDxYqD+QCIT0hmezlYywQEBsngngEYCAIy0AC6DGYSy8rDwxUg8Xf9d7wbAxC33tHgzvrP3/9nCISFJzEBgIIRTGey2MkILkawT1oyi4tnEUxjI6IQvMLFkauYqxjQQtewwuoaHy8bBNMBwJMZDHYkAERbhJdJZUYic4hhCNZOCItOQDB3vjkzioFwxLsIXhcRl5IOAImrRzs+fivCk7QRrIL0shAcwNUW+tX8yH/tFfrPXgxG5D84Pi6F+dc9ck+HHJ7g641UMSQlQATQBHEgBaQDGcACbLAVYaIRJhx5Dv+9j77aZ4OsZIFtSEc0iARRIBnpt/9qlvfqpGSQBhjImnCEcUU+NtxnujZy4fbqVEiU/wuXdQyA9S0cDqfzC+e2F4DzyLkSB79wyi0A8KoBcL2GmcJOXePQ3C8MIAJeQAOiQArIAxXuWwMMgSmwBHbAGbgDHxAINgMmojceUZUGMkEWyAX54AA4DMpAJTgJ6sAZ0ALawQVwGVwDt8AQGAUPwQSYBi/AAngHliEIwkEUiAqJQtKQIqQO6UJ0yByyg1whLygQCoEioQQoBcqE9kD5UBFUBlVB9dBPUCd0GboBDUP3oUloDnoNfYRRMB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bbTTIOJmAyTVhx/WmvrExbv2jtPhWLKodjCtefZiEeZeVZWWSndgwj6fVf3XON8Qwq15++uoqrfYVrow6dGBpCq79ME291jaB0/Q2CPncyht/99MNO/vr9AqW/CGi8sJqbAAAAAElFTkSuQmCC", + "localAlias": "", + "preferences": { + "calls": { + "allow": "yes" + }, + "commands": [], + "files": { + "allow": "always" + }, + "fullDelete": { + "allow": "no" + }, + "reactions": { + "allow": "yes" + }, + "sessions": { + "allow": "no" + }, + "timedMessages": { + "allow": "yes" + }, + "voice": { + "allow": "yes" + } + }, + "profileId": 1, + "shortDescr": "Bob" + }, + "sendRcptsContacts": true, + "sendRcptsSmallGroups": true, + "showNtfs": true, + "userChatRelay": false, + "userContactId": 1, + "userId": 1 + } + } + }, + { + "result": { + "chatItemUpdate": { + "chatInfo": { + "contact": { + "activeConn": { + "agentConnId": "agentConnId", + "authErrCounter": 0, + "connChatVersion": 22, + "connId": 1, + "connLevel": 0, + "connStatus": { + "type": "ready" + }, + "connType": "contact", + "contactConnInitiated": false, + "createdAt": "1970-01-01T00:00:00Z", + "entityId": 2, + "localAlias": "", + "peerChatVRange": { + "maxVersion": 22, + "minVersion": 9 + }, + "pqEncryption": true, + "pqRcvEnabled": true, + "pqSndEnabled": true, + "pqSupport": true, + "quotaErrCounter": 0, + "viaGroupLink": false + }, + "chatDeleted": false, + "chatSettings": { + "enableNtfs": "all", + "favorite": false + }, + "chatTags": [], + "chatTs": "1970-01-01T00:00:00Z", + "contactGrpInvSent": false, + "contactId": 2, + "contactStatus": "active", + "contactUsed": true, + "createdAt": "1970-01-01T00:00:00Z", + "localDisplayName": "alice", + "mergedPreferences": { + "calls": { + "contactPreference": { + "allow": "yes" + }, + "enabled": { + "forContact": true, + "forUser": true + }, + "userPreference": { + "preference": { + "allow": "yes" + }, + "type": "user" + } + }, + "commands": [], + "files": { + "contactPreference": { + "allow": "always" + }, + "enabled": { + "forContact": true, + "forUser": true + }, + "userPreference": { + "preference": { + "allow": "always" + }, + "type": "user" + } + }, + "fullDelete": { + "contactPreference": { + "allow": "no" + }, + "enabled": { + "forContact": false, + "forUser": false + }, + "userPreference": { + "preference": { + "allow": "no" + }, + "type": "user" + } + }, + "reactions": { + "contactPreference": { + "allow": "yes" + }, + "enabled": { + "forContact": true, + "forUser": true + }, + "userPreference": { + "preference": { + "allow": "yes" + }, + "type": "user" + } + }, + "sessions": { + "contactPreference": { + "allow": "no" + }, + "enabled": { + "forContact": false, + "forUser": false + }, + "userPreference": { + "preference": { + "allow": "no" + }, + "type": "user" + } + }, + "timedMessages": { + "contactPreference": { + "allow": "yes" + }, + "enabled": { + "forContact": true, + "forUser": true + }, + "userPreference": { + "preference": { + "allow": "yes" + }, + "type": "user" + } + }, + "voice": { + "contactPreference": { + "allow": "yes" + }, + "enabled": { + "forContact": true, + "forUser": true + }, + "userPreference": { + "preference": { + "allow": "yes" + }, + "type": "user" + } + } + }, + "profile": { + "displayName": "alice", + "fullName": "", + "localAlias": "", + "preferences": { + "calls": { + "allow": "yes" + }, + "commands": [], + "files": { + "allow": "always" + }, + "fullDelete": { + "allow": "no" + }, + "reactions": { + "allow": "yes" + }, + "sessions": { + "allow": "no" + }, + "timedMessages": { + "allow": "yes" + }, + "voice": { + "allow": "yes" + } + }, + "profileId": 2, + "shortDescr": "Alice" + }, + "updatedAt": "1970-01-01T00:00:00Z", + "userPreferences": {} + }, + "type": "direct" + }, + "chatItem": { + "chatDir": { + "type": "directRcv" + }, + "content": { + "duration": 0, + "status": "missed", + "type": "rcvCall" + }, + "mentions": {}, + "meta": { + "createdAt": "1970-01-01T00:00:00Z", + "deletable": false, + "editable": false, + "hasLink": false, + "itemEdited": false, + "itemId": 8, + "itemSharedMsgId": "itemSharedMsgId", + "itemStatus": { + "type": "rcvNew" + }, + "itemText": "incoming call: missed", + "itemTs": "1970-01-01T00:00:00Z", + "showGroupAsSender": false, + "updatedAt": "1970-01-01T00:00:00Z", + "userMention": false + }, + "reactions": [] + }, + "prevChatItem": { + "chatDir": { + "type": "directRcv" + }, + "content": { + "duration": 0, + "status": "pending", + "type": "rcvCall" + }, + "mentions": {}, + "meta": { + "createdAt": "1970-01-01T00:00:00Z", + "deletable": false, + "editable": false, + "hasLink": false, + "itemEdited": false, + "itemId": 8, + "itemSharedMsgId": "itemSharedMsgId", + "itemStatus": { + "type": "rcvNew" + }, + "itemText": "incoming call: calling...", + "itemTs": "1970-01-01T00:00:00Z", + "showGroupAsSender": false, + "updatedAt": "1970-01-01T00:00:00Z", + "userMention": false + }, + "reactions": [] + } + }, + "type": "chatItemUpdated", + "user": { + "activeOrder": 1, + "activeUser": true, + "agentUserId": "1", + "autoAcceptGroupInvitations": false, + "autoAcceptMemberContacts": false, + "clientService": false, + "fullPreferences": { + "calls": { + "allow": "yes" + }, + "commands": [], + "files": { + "allow": "always" + }, + "fullDelete": { + "allow": "no" + }, + "reactions": { + "allow": "yes" + }, + "sessions": { + "allow": "no" + }, + "timedMessages": { + "allow": "yes" + }, + "voice": { + "allow": "yes" + } + }, + "localDisplayName": "bob", + "profile": { + "displayName": "bob", + "fullName": "", + "image": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAKHGlDQ1BJQ0MgUHJvZmlsZQAASImFVgdUVNcWve9Nb7QZeu9NehtAem/Sq6gMQ28OQxWxgAQjEFFEREARNFQFg1KjiIhiIQgoYA9IEFBisCAq6OQNJNH4//r/zDpz9ttzz7n73ffWmg0A6QCDxYqD+QCIT0hmezlYywQEBsngngEYCAIy0AC6DGYSy8rDwxUg8Xf9d7wbAxC33tHgzvrP3/9nCISFJzEBgIIRTGey2MkILkawT1oyi4tnEUxjI6IQvMLFkauYqxjQQtewwuoaHy8bBNMBwJMZDHYkAERbhJdJZUYic4hhCNZOCItOQDB3vjkzioFwxLsIXhcRl5IOAImrRzs+fivCk7QRrIL0shAcwNUW+tX8yH/tFfrPXgxG5D84Pi6F+dc9ck+HHJ7g641UMSQlQATQBHEgBaQDGcACbLAVYaIRJhx5Dv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N4RHe4RIKJ7R34Ro+4AEGSw2mE1iUwT18gpI74WvkGlccu4XNdH0jnYU7cAUacidn37qR23cOxc4aGU0nYUAn7iSWEHkz46w0ocdQu1X6B/AMQZ5o7KfBqNOfwRH8JB7FajGhnmcpKvQe3MEbvILiDm5gPXaCHnZr4vvFGMoEKudKn8YvQIOOe+YzCPop7dwJ3zRfJ7GDuso4YJGRa0yZgg4tUaNXdGrbuZWKKxzYYEJc2xp9AUUjGt8KC2jvgYadF8+10vJyDnNLXwbdiWUZi0fUK01Eoc+AZhCLZVzK4Vq6sDUdz+0dEcbbTTIOJmAyTVhx/WmvrExbv2jtPhWLKodjCtefZiEeZeVZWWSndgwj6fVf3XON8Qwq15++uoqrfYVrow6dGBpCq79ME291jaB0/Q2CPncyht/99MNO/vr9AqW/CGi8sJqbAAAAAElFTkSuQmCC", + "localAlias": "", + "preferences": { + "calls": { + "allow": "yes" + }, + "commands": [], + "files": { + "allow": "always" + }, + "fullDelete": { + "allow": "no" + }, + "reactions": { + "allow": "yes" + }, + "sessions": { + "allow": "no" + }, + "timedMessages": { + "allow": "yes" + }, + "voice": { + "allow": "yes" + } + }, + "profileId": 1, + "shortDescr": "Bob" + }, + "sendRcptsContacts": true, + "sendRcptsSmallGroups": true, + "showNtfs": true, + "userChatRelay": false, + "userContactId": 1, + "userId": 1 + } + } + } +] diff --git a/tests/fixtures/api/updates/update-response.json b/tests/fixtures/api/updates/update-response.json new file mode 100644 index 0000000000..a1d49aef38 --- /dev/null +++ b/tests/fixtures/api/updates/update-response.json @@ -0,0 +1,302 @@ +{ + "commands": { + "/_update item @2 8 text hello there": { + "result": { + "chatItem": { + "chatInfo": { + "contact": { + "activeConn": { + "agentConnId": "agentConnId", + "authErrCounter": 0, + "connChatVersion": 22, + "connId": 1, + "connLevel": 0, + "connStatus": { + "type": "ready" + }, + "connType": "contact", + "contactConnInitiated": false, + "createdAt": "1970-01-01T00:00:00Z", + "entityId": 2, + "localAlias": "", + "peerChatVRange": { + "maxVersion": 22, + "minVersion": 9 + }, + "pqEncryption": true, + "pqRcvEnabled": true, + "pqSndEnabled": true, + "pqSupport": true, + "quotaErrCounter": 0, + "viaGroupLink": false + }, + "chatDeleted": false, + "chatSettings": { + "enableNtfs": "all", + "favorite": false + }, + "chatTags": [], + "chatTs": "1970-01-01T00:00:00Z", + "contactGrpInvSent": false, + "contactId": 2, + "contactStatus": "active", + "contactUsed": true, + "createdAt": "1970-01-01T00:00:00Z", + "localDisplayName": "alice", + "mergedPreferences": { + "calls": { + "contactPreference": { + "allow": "yes" + }, + "enabled": { + "forContact": true, + "forUser": true + }, + "userPreference": { + "preference": { + "allow": "yes" + }, + "type": "user" + } + }, + "commands": [], + "files": { + "contactPreference": { + "allow": "always" + }, + "enabled": { + "forContact": true, + "forUser": true + }, + "userPreference": { + "preference": { + "allow": "always" + }, + "type": "user" + } + }, + "fullDelete": { + "contactPreference": { + "allow": "no" + }, + "enabled": { + "forContact": false, + "forUser": false + }, + "userPreference": { + "preference": { + "allow": "no" + }, + "type": "user" + } + }, + "reactions": { + "contactPreference": { + "allow": "yes" + }, + "enabled": { + "forContact": true, + "forUser": true + }, + "userPreference": { + "preference": { + "allow": "yes" + }, + "type": "user" + } + }, + "sessions": { + "contactPreference": { + "allow": "no" + }, + "enabled": { + "forContact": false, + "forUser": false + }, + "userPreference": { + "preference": { + "allow": "no" + }, + "type": "user" + } + }, + "timedMessages": { + "contactPreference": { + "allow": "yes" + }, + "enabled": { + "forContact": true, + "forUser": true + }, + "userPreference": { + "preference": { + "allow": "yes" + }, + "type": "user" + } + }, + "voice": { + "contactPreference": { + "allow": "yes" + }, + "enabled": { + "forContact": true, + "forUser": true + }, + "userPreference": { + "preference": { + "allow": "yes" + }, + "type": "user" + } + } + }, + "profile": { + "displayName": "alice", + "fullName": "", + "localAlias": "", + "preferences": { + "calls": { + "allow": "yes" + }, + "commands": [], + "files": { + "allow": "always" + }, + "fullDelete": { + "allow": "no" + }, + "reactions": { + "allow": "yes" + }, + "sessions": { + "allow": "no" + }, + "timedMessages": { + "allow": "yes" + }, + "voice": { + "allow": "yes" + } + }, + "profileId": 2, + "shortDescr": "Alice" + }, + "updatedAt": "1970-01-01T00:00:00Z", + "userPreferences": {} + }, + "type": "direct" + }, + "chatItem": { + "chatDir": { + "type": "directSnd" + }, + "content": { + "msgContent": { + "text": "hello there", + "type": "text" + }, + "type": "sndMsgContent" + }, + "mentions": {}, + "meta": { + "createdAt": "1970-01-01T00:00:00Z", + "deletable": true, + "editable": true, + "hasLink": false, + "itemEdited": true, + "itemId": 8, + "itemSharedMsgId": "itemSharedMsgId", + "itemStatus": { + "msgRcptStatus": "ok", + "sndProgress": "complete", + "type": "sndRcvd" + }, + "itemText": "hello there", + "itemTs": "1970-01-01T00:00:00Z", + "sentViaProxy": false, + "showGroupAsSender": false, + "updatedAt": "1970-01-01T00:00:00Z", + "userMention": false + }, + "reactions": [] + } + }, + "type": "chatItemUpdated", + "user": { + "activeOrder": 1, + "activeUser": true, + "agentUserId": "1", + "autoAcceptGroupInvitations": false, + "autoAcceptMemberContacts": false, + "clientService": false, + "fullPreferences": { + "calls": { + "allow": "yes" + }, + "commands": [], + "files": { + "allow": "always" + }, + "fullDelete": { + "allow": "no" + }, + "reactions": { + "allow": "yes" + }, + "sessions": { + "allow": "no" + }, + "timedMessages": { + "allow": "yes" + }, + "voice": { + "allow": "yes" + } + }, + "localDisplayName": "bob", + "profile": { + "displayName": "bob", + "fullName": "", + "image": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAKHGlDQ1BJQ0MgUHJvZmlsZQAASImFVgdUVNcWve9Nb7QZeu9NehtAem/Sq6gMQ28OQxWxgAQjEFFEREARNFQFg1KjiIhiIQgoYA9IEFBisCAq6OQNJNH4//r/zDpz9ttzz7n73ffWmg0A6QCDxYqD+QCIT0hmezlYywQEBsngngEYCAIy0AC6DGYSy8rDwxUg8Xf9d7wbAxC33tHgzvrP3/9nCISFJzEBgIIRTGey2Mk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AIAAGHaQAEAAAAAQAAABoAAAAAAAKgAgAEAAAAAQAAABigAwAEAAAAAQAAABgAAAAAwf1XlwAAAaNJREFUSA3FlT1LA0EQQBN/gYUYRTksJZVgEbCR/D+7QMr8ABtttBBCsLGzsLG2sxaxED/ie4d77u0dyaE5HHjczn7MzO7M7nU6/yXz+bwLhzCCjTQO+rZhDH3opuNLdRYN4RHe4RIKJ7R34Ro+4AEGSw2mE1iUwT18gpI74WvkGlccu4XNdH0jnYU7cAUacidn37qR23cOxc4aGU0nYUAn7iSWEHkz46w0ocdQu1X6B/AMQZ5o7KfBqNOfwRH8JB7FajGhnmcpKvQe3MEbvILiDm5gPXaCHnZr4vvFGMoEKudKn8YvQIOOe+YzCPop7dwJ3zRfJ7GDuso4YJGRa0yZgg4tUaNXdGrbuZWKKxzYYEJc2xp9AUUjGt8KC2jvgYadF8+10vJyDnNLXwbdiWUZi0fUK01Eoc+AZhCLZVzK4Vq6sDUdz+0dEcbbTTIOJmAyTVhx/WmvrExbv2jtPhWLKodjCtefZiEeZeVZWWSndgwj6fVf3XON8Qwq15++uoqrfYVrow6dGBpCq79ME291jaB0/Q2CPncyht/99MNO/vr9AqW/CGi8sJqbAAAAAElFTkSuQmCC", + "localAlias": "", + "preferences": { + "calls": { + "allow": "yes" + }, + "commands": [], + "files": { + "allow": "always" + }, + "fullDelete": { + "allow": "no" + }, + "reactions": { + "allow": "yes" + }, + "sessions": { + "allow": "no" + }, + "timedMessages": { + "allow": "yes" + }, + "voice": { + "allow": "yes" + } + }, + "profileId": 1, + "shortDescr": "Bob" + }, + "sendRcptsContacts": true, + "sendRcptsSmallGroups": true, + "showNtfs": true, + "userChatRelay": false, + "userContactId": 1, + "userId": 1 + } + } + } + }, + "markdown": {}, + "uris": {} +}