From 73761e6e0bddd77805700ada8bcd76fc6eed8d8d Mon Sep 17 00:00:00 2001 From: "Evgeny @ SimpleX Chat" <259188159+evgeny-simplex@users.noreply.github.com> Date: Mon, 16 Nov 2026 23:36:37 +0000 Subject: [PATCH 1/3] core, ui: test app views on the core's recorded responses (#8234) * core, ui: plan name alert tests against core fixtures * core: write name lookup responses to app fixtures in name tests * android, desktop: name alerts tested against core fixtures * core, ios: plan Swift fixtures and iOS unit tests of name alerts * core: write name lookup responses in the Swift form to iOS fixtures * ios: name alerts tested against core fixtures * core: write both app fixtures of a name test in one run * ui: add name lookup responses written by the core tests as fixtures * core: keep the fixture writer of name tests to the forms it receives * desktop: run name alert tests in the US locale * ios: one switch for the title and effect of name alert actions * docs: name alert tests in the app specs, CI guide and plan * docs: known gaps of the name alert tests in the plan * ui: restore the name alert code and the iOS project of master * core: record name lookup responses and name parses for app tests * android, desktop: test name alerts of planAndConnect on recorded responses * ci: run the app tests for a change of the name fixtures * core: name lookup responses and name parses recorded by the core tests * docs: plan of app views tested on core responses * ios: test name alerts of planAndConnect on recorded responses * ci: iOS unit tests in the iOS job, the app launched on stub migrations * android, desktop: core hooks below the externals, in the specs * ios: name alert tests compile with the converter at file scope * ui: the moved name test expects the alert to open a chat with the new address * core, ui: app test fixtures under tests/fixtures/api * core: record the responses of the name lookup flows that the apps test * core: record URI parses, and normalize the random values of fixtures * android, desktop: URI parse hook and event processing for tests * ios: URI parse hook for tests * desktop: full failure messages of tests * core: domain errors view compiles with GHC 8.10.7 * core: normalize parses and profile send times in fixtures * core: record the parses of the chat list search * core: recorded responses of the name flows and the contact address * android, desktop: test name alerts, buttons, search and name view * ios: test name alerts, buttons, search and the moved event * docs: plan, specs and CI guide of the app tests --- .github/workflows/build.yml | 24 + .../Views/Chat/ChatItem/CILinkView.swift | 2 +- .../Chat/ComposeMessage/ComposeView.swift | 2 +- apps/ios/Shared/Views/TerminalView.swift | 2 +- .../SimpleX Unit Tests/NameAlertsTests.swift | 364 ++++++++++ apps/ios/SimpleX.xcodeproj/project.pbxproj | 116 ++++ .../xcschemes/SimpleX Unit Tests.xcscheme | 68 ++ apps/ios/SimpleXChat/API.swift | 9 +- apps/ios/spec/api.md | 2 + apps/multiplatform/common/build.gradle.kts | 5 + .../chat/simplex/common/model/SimpleXAPI.kt | 2 +- .../chat/simplex/common/platform/Core.kt | 9 +- .../kotlin/chat/simplex/app/NameAlertsTest.kt | 344 ++++++++++ apps/multiplatform/spec/api.md | 2 +- apps/multiplatform/spec/architecture.md | 6 +- plans/2026-11-16-name-alert-fixtures.md | 125 ++++ scripts/ci/README.md | 7 +- scripts/ci/ios-stub-libs.sh | 2 +- scripts/ci/packages_release.py | 4 +- scripts/ci/test_packages_release.py | 3 + src/Simplex/Chat/View.hs | 10 +- tests/ChatTests/Names.hs | 22 + tests/ChatTests/Profiles.hs | 1 + tests/ChatTests/Utils.hs | 62 +- tests/NameResolver.hs | 10 +- .../api/connect/contact-via-address.json | 264 ++++++++ tests/fixtures/api/names/error-available.json | 48 ++ .../api/names/error-not-registered.json | 36 + .../fixtures/api/names/event-name-moved.json | 82 +++ .../api/names/plan-channel-no-relays.json | 185 ++++++ .../api/names/plan-known-available.json | 330 +++++++++ .../api/names/plan-known-expired.json | 321 +++++++++ .../fixtures/api/names/plan-known-moved.json | 355 ++++++++++ .../api/names/plan-known-reserved.json | 334 ++++++++++ tests/fixtures/api/names/plan-known.json | 313 +++++++++ .../api/names/plan-moved-business.json | 306 +++++++++ .../fixtures/api/names/plan-moved-known.json | 306 +++++++++ tests/fixtures/api/names/plan-other-kind.json | 627 ++++++++++++++++++ .../api/names/plan-own-available.json | 139 ++++ .../fixtures/api/names/plan-own-channel.json | 275 ++++++++ .../fixtures/api/names/plan-own-expired.json | 137 ++++ tests/fixtures/api/names/search-team.json | 560 ++++++++++++++++ 42 files changed, 5787 insertions(+), 34 deletions(-) create mode 100644 apps/ios/SimpleX Unit Tests/NameAlertsTests.swift create mode 100644 apps/ios/SimpleX.xcodeproj/xcshareddata/xcschemes/SimpleX Unit Tests.xcscheme create mode 100644 apps/multiplatform/common/src/desktopTest/kotlin/chat/simplex/app/NameAlertsTest.kt create mode 100644 plans/2026-11-16-name-alert-fixtures.md create mode 100644 tests/fixtures/api/connect/contact-via-address.json create mode 100644 tests/fixtures/api/names/error-available.json create mode 100644 tests/fixtures/api/names/error-not-registered.json create mode 100644 tests/fixtures/api/names/event-name-moved.json create mode 100644 tests/fixtures/api/names/plan-channel-no-relays.json create mode 100644 tests/fixtures/api/names/plan-known-available.json create mode 100644 tests/fixtures/api/names/plan-known-expired.json create mode 100644 tests/fixtures/api/names/plan-known-moved.json create mode 100644 tests/fixtures/api/names/plan-known-reserved.json create mode 100644 tests/fixtures/api/names/plan-known.json create mode 100644 tests/fixtures/api/names/plan-moved-business.json create mode 100644 tests/fixtures/api/names/plan-moved-known.json create mode 100644 tests/fixtures/api/names/plan-other-kind.json create mode 100644 tests/fixtures/api/names/plan-own-available.json create mode 100644 tests/fixtures/api/names/plan-own-channel.json create mode 100644 tests/fixtures/api/names/plan-own-expired.json create mode 100644 tests/fixtures/api/names/search-team.json diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 28d7aa7747..808d7891e6 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -20,6 +20,7 @@ on: - "apps/simplex-directory-service/**" - "apps/multiplatform/**" - "apps/ios/**" + - "tests/fixtures/api/**" - "tests/**" - "bots/src/**" - "simplex-chat.cabal" @@ -1396,6 +1397,29 @@ jobs: ARCHS=arm64 \ CODE_SIGNING_ALLOWED=NO + - name: Run iOS unit tests + timeout-minutes: 30 + shell: bash + run: | + runtime=com.apple.CoreSimulator.SimRuntime.iOS-$(xcrun --sdk iphonesimulator --show-sdk-version | tr . -) + device=$(xcrun simctl list runtimes --json | python3 -c 'import json, sys; r = next(r for r in json.load(sys.stdin)["runtimes"] if r["identifier"] == sys.argv[1]); print(next(t["identifier"] for t in r["supportedDeviceTypes"] if t["productFamily"] == "iPhone"))' "$runtime") + udid=$(xcrun simctl create unit-tests "$device" "$runtime") + xcodebuild test \ + -project apps/ios/SimpleX.xcodeproj \ + -scheme "SimpleX Unit Tests" \ + -configuration Debug \ + -destination "id=$udid" \ + -onlyUsePackageVersionsFromResolvedFile \ + -skipPackagePluginValidation \ + -skipMacroValidation \ + -testLanguage en \ + -testRegion US \ + ARCHS=arm64 \ + CODE_SIGN_STYLE=Manual \ + CODE_SIGN_IDENTITY=- \ + DEVELOPMENT_TEAM= \ + PROVISIONING_PROFILE_SPECIFIER= + # ========================= # Windows Build # ========================= diff --git a/apps/ios/Shared/Views/Chat/ChatItem/CILinkView.swift b/apps/ios/Shared/Views/Chat/ChatItem/CILinkView.swift index 42259361b7..3cc399d1ad 100644 --- a/apps/ios/Shared/Views/Chat/ChatItem/CILinkView.swift +++ b/apps/ios/Shared/Views/Chat/ChatItem/CILinkView.swift @@ -121,7 +121,7 @@ func displayedUri(_ uri: String) -> String { } func sanitizeUri(_ s: String) -> (url: (uri: URL, sanitizedUri: URL?)?, error: String?) { - let parsed = parseSanitizeUri(s, safe: false) + let parsed = parseSanitizeUri(s, false) return if let uri = URL(string: s), let uriInfo = parsed?.uriInfo { (url: (uri: uri, sanitizedUri: uriInfo.sanitized.flatMap { URL(string: $0) }), error: nil) } else { diff --git a/apps/ios/Shared/Views/Chat/ComposeMessage/ComposeView.swift b/apps/ios/Shared/Views/Chat/ComposeMessage/ComposeView.swift index ae8f3d7bf9..8b08c675d7 100644 --- a/apps/ios/Shared/Views/Chat/ComposeMessage/ComposeView.swift +++ b/apps/ios/Shared/Views/Chat/ComposeMessage/ComposeView.swift @@ -2016,7 +2016,7 @@ struct ComposeView: View { func sanitizeMessage( _ text: String, _ parsedMsg: [FormattedText], - sanitize: (String) -> String? = { parseSanitizeUri($0, safe: true)?.uriInfo?.sanitized } + sanitize: (String) -> String? = { parseSanitizeUri($0, true)?.uriInfo?.sanitized } ) -> (message: String, parsedMsg: [FormattedText], sanitizedPos: Int?) { var updatedMsg = "" var copied = text.startIndex diff --git a/apps/ios/Shared/Views/TerminalView.swift b/apps/ios/Shared/Views/TerminalView.swift index 32209e97fa..ade25d47d8 100644 --- a/apps/ios/Shared/Views/TerminalView.swift +++ b/apps/ios/Shared/Views/TerminalView.swift @@ -167,7 +167,7 @@ struct TerminalView: View { func sendTerminalCmd(_ cmd: String) async { let start: Date = .now await withCheckedContinuation { (cont: CheckedContinuation) in - let d = sendSimpleXCmdStr(cmd, retryNum: 0) + let d = sendSimpleXCmdStr(cmd, nil, 0) Task { guard let d else { await TerminalItems.shared.addCommand(start, ChatCommand.string(cmd), APIResult.error(.invalidJSON(json: nil))) diff --git a/apps/ios/SimpleX Unit Tests/NameAlertsTests.swift b/apps/ios/SimpleX Unit Tests/NameAlertsTests.swift new file mode 100644 index 0000000000..2073797bfc --- /dev/null +++ b/apps/ios/SimpleX Unit Tests/NameAlertsTests.swift @@ -0,0 +1,364 @@ +import XCTest +import SwiftUI +import UIKit +@testable import SimpleX +@testable import SimpleXChat + +final class NameAlertsTests: XCTestCase { + private let sendCmd = sendSimpleXCmdStr + private let parseMarkdown = parseSimpleXMarkdownText + private let parseUri = parseSanitizeUri + private let lock = NSLock() + private var unrecorded: [String] = [] + private var shownLocalChats: [String] = [] + + @MainActor + override func setUp() async throws { + NSTimeZone.default = try XCTUnwrap(TimeZone(identifier: "UTC")) + ChatModel.shared.currentUser = User.sampleData + try await dismissPresented() + } + + @MainActor + override func tearDown() async throws { + try await dismissPresented() + for chat in ChatModel.shared.chats { ChatModel.shared.removeChat(chat.id) } + ChatModel.shared.chatId = nil + ChatModel.shared.appOpenUrl = nil + ChatModel.shared.currentUser = nil + sendSimpleXCmdStr = sendCmd + parseSimpleXMarkdownText = parseMarkdown + parseSanitizeUri = parseUri + XCTAssertEqual(requests(), [], "requests without recorded responses") + } + + @MainActor + func testKnownNameExpired() async throws { + try recorded("names/plan-known-expired") + connect("@alice.simplex") + try await assertTexts(["Name expired", "alice.simplex expired on January 1, 2026. Its owner can renew it until January 1, 2099.", "Open chat", "Ok"]) + XCTAssertEqual(shownLocalChats, ["@2"]) + try await press("Open chat") + try await waitFor { ChatModel.shared.chatId == "@2" } + try await assertRequested { $0.hasPrefix("/_get chat @2 ") } + } + + @MainActor + func testOwnNameExpired() async throws { + try recorded("names/plan-own-expired") + connect("@alice.simplex") + try await assertTexts(["Your name has expired", "Your name alice.simplex expired on January 1, 2026. Renew it before January 1, 2099.", "Renew", "Ok"]) + XCTAssertEqual(shownLocalChats, []) + try await press("Renew") + try await assertTexts(["Open link?", "https://simplex.domains/#testing", "Cancel", "Open"]) + } + + @MainActor + func testKnownNameAvailable() async throws { + try recorded("names/plan-known-available") + connect("@alice.simplex") + try await assertTexts(["Name no longer registered", "alice.simplex is available for registration for $20 for 2 years.", "Register", "Open chat", "Ok"]) + XCTAssertEqual(shownLocalChats, ["@2"]) + try await press("Register") + try await assertTexts(["Open link?", "https://simplex.domains/#testing", "Cancel", "Open"]) + } + + @MainActor + func testOwnNameAvailable() async throws { + try recorded("names/plan-own-available") + connect("@alice.simplex") + try await assertTexts(["Your name has expired", "Your name alice.simplex is no longer registered. It is available for registration for $20 for 2 years.", "Re-register", "Ok"]) + try await press("Re-register") + try await assertTexts(["Open link?", "https://simplex.domains/#testing", "Cancel", "Open"]) + } + + @MainActor + func testKnownNameReserved() async throws { + try recorded("names/plan-known-reserved") + connect("@alice.simplex") + try await assertTexts(["Name not registered", "alice.simplex is reserved for community. Please contact SimpleX Chat if you are interested in using it.", "Connect to SimpleX team", "Open chat", "Ok"]) + XCTAssertEqual(shownLocalChats, ["@2"]) + try await press("Connect to SimpleX team") + try await waitFor { ChatModel.shared.appOpenUrl == simplexTeamURL } + } + + @MainActor + func testKnownNameMoved() async throws { + try recorded("names/plan-known-moved") + connect("@alice.simplex") + try await assertTexts(["cath", "@alice.simplex", "Open new chat", "Cancel"]) + XCTAssertEqual(shownLocalChats, ["@2"]) + } + + @MainActor + func testNameAvailable() async throws { + try recorded("names/error-available") + connect("@nobody.simplex") + try await assertTexts(["Name not registered", "nobody.simplex is available for registration for $20 for 2 years.", "Register", "Ok"]) + } + + @MainActor + func testNameNotRegistered() async throws { + try recorded("names/error-not-registered") + connect("acme.simplex") + try await assertTexts(["Name not registered", "This SimpleX name is not registered. Please check the name.", "Ok"]) + } + + @MainActor + func testKnownName() async throws { + try recorded("names/plan-known") + connect("@alice.simplex") + try await assertTexts(["alice", "@alice.simplex", "Open chat", "Cancel"]) + XCTAssertEqual(shownLocalChats, ["@2"]) + } + + @MainActor + func testNameMovedToKnownContact() async throws { + try recorded("names/plan-moved-known") + connect("@alice.simplex") + try await assertTexts(["cath", "@alice.simplex", "Open chat", "Cancel"]) + XCTAssertEqual(shownLocalChats, ["@3"]) + } + + @MainActor + func testNameMovedToKnownBusiness() async throws { + try recorded("names/plan-moved-business") + connect("@alice.simplex") + try await assertTexts(["cath", "@alice.simplex", "Open chat", "Cancel"]) + XCTAssertEqual(shownLocalChats, ["#1"]) + } + + @MainActor + func testNameOfOtherKindOffered() async throws { + try recorded("names/plan-other-kind") + connect("team.simplex") + try await assertTexts(["team", "#team", "1 subscribers", "You are a subscriber", "Open channel", "Connect to @team.simplex", "Cancel"]) + XCTAssertEqual(shownLocalChats, ["#1"]) + try await press("Connect to @team.simplex") + try await assertTexts(["alisa", "@team.simplex", "Open new chat", "Cancel"]) + XCTAssertNotNil(ChatModel.shared.getChat("@2")) + } + + @MainActor + func testChannelWithoutRelays() async throws { + try recorded("names/plan-channel-no-relays") + connect("team.simplex") + try await assertTexts(["team", "Channel has no active relays. Please try to join later.", "Connect to @team.simplex", "OK"]) + XCTAssertEqual(shownLocalChats, []) + try await press("Connect to @team.simplex") + try await assertTexts(["Unconfirmed name", "The SimpleX name team.simplex is registered, but not added to profile. Please add it to your address or channel profile, if you are the owner.", "Ok"]) + } + + @MainActor + func testOwnChannel() async throws { + try recorded("names/plan-own-channel") + connect("#team.simplex") + try await assertTexts(["Your channel", "This is your link for channel team (#team)!", "Open channel", "Cancel"]) + XCTAssertEqual(shownLocalChats, ["#1"]) + } + + @MainActor + func testContactViaAddress() async throws { + try recorded("connect/contact-via-address") + connect("CONTACT_LINK") + try await assertTexts(["alice", "Open chat", "Cancel"]) + XCTAssertEqual(shownLocalChats, ["@3"]) + } + + @MainActor + func testNameMovedEvent() async throws { + var contact = Contact.sampleData + contact.contactId = 2 + ChatModel.shared.addChat(Chat(chatInfo: .direct(contact: contact), chatItems: [])) + ChatModel.shared.addChat(Chat(chatInfo: .group(groupInfo: GroupInfo.sampleData, groupChatScope: nil), chatItems: [])) + let event: APIResult = decodeAPIResult(try JSONSerialization.data(withJSONObject: singleFieldJSON(try fixtureJSON("names/event-name-moved")))) + guard case let .result(ev) = event else { return XCTFail("event not decoded: \(event.responseType)") } + await processReceivedMsg(ev) + guard case let .direct(movedContact)? = ChatModel.shared.getContactChat(2)?.chatInfo, + case let .group(movedGroup, _)? = ChatModel.shared.getGroupChat(1)?.chatInfo else { return XCTFail("chats removed") } + XCTAssertEqual(movedContact.profile.contactDomainVerified, .moved) + XCTAssertEqual(movedGroup.groupDomainVerified, .moved) + } + + @MainActor + func testChatListSearchShowsChatsOfName() async throws { + try recorded("names/search-team") + let state = SearchState() + let window = UIWindow(windowScene: try XCTUnwrap(UIApplication.shared.connectedScenes.compactMap { $0 as? UIWindowScene }.first)) + window.rootViewController = UIHostingController(rootView: SearchHost(state: state)) + window.isHidden = false + defer { window.isHidden = true } + try await Task.sleep(nanoseconds: 100_000_000) + state.searchText = "team.simplex" + try await waitFor { state.filtered == ["@2", "#1"] } + XCTAssertEqual(Set(ChatModel.shared.chats.map(\.id)), ["@2", "#1"]) + } + + private func recorded(_ fixture: String) throws { + let responses = try XCTUnwrap(try fixtureJSON(fixture) as? [String: [String: Any]]) + let commands = responses["commands"] ?? [:] + let markdown = responses["markdown"] ?? [:] + let uris = responses["uris"] ?? [:] + sendSimpleXCmdStr = { [unowned self] cmd, _, _ in + guard let response = commands[cmd] else { self.unrecordedRequest(cmd); return nil } + return try? JSONSerialization.data(withJSONObject: singleFieldJSON(response)) + } + parseSimpleXMarkdownText = { [unowned self] str in + guard let parsed = markdown[str] else { self.unrecordedRequest("markdown \(str)"); return nil } + return try? jsonDecoder.decode(ParsedMarkdown.self, from: JSONSerialization.data(withJSONObject: singleFieldJSON(parsed))) + } + parseSanitizeUri = { [unowned self] str, safe in + guard !safe, let parsed = uris[str] else { self.unrecordedRequest("uri \(str)"); return nil } + return try? jsonDecoder.decode(ParsedUri.self, from: JSONSerialization.data(withJSONObject: singleFieldJSON(parsed))) + } + } + + 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) } + } + + private func requests() -> [String] { + locked { unrecorded } + } + + private func locked(_ f: () -> T) -> T { + lock.lock() + defer { lock.unlock() } + return f() + } + + @MainActor + private func connect(_ name: String) { + planAndConnect(name, theme: CurrentColors.toAppTheme(), dismiss: false, showLocalChats: { [unowned self] chats in self.shownLocalChats += chats.map(\.id) }) + } + + @MainActor + private func assertRequested(_ expected: (String) -> Bool, file: StaticString = #filePath, line: UInt = #line) async throws { + try? await waitFor { !self.requests().isEmpty } + let shown = requests() + XCTAssertEqual(shown.count, 1, "\(shown)", file: file, line: line) + XCTAssertTrue(shown.allSatisfy(expected), "\(shown)", file: file, line: line) + locked { unrecorded.removeAll() } + } + + @MainActor + private func assertTexts(_ texts: [String], file: StaticString = #filePath, line: UInt = #line) async throws { + try? await waitFor { self.shownTexts().sorted() == texts.sorted() } + let shown = shownTexts() + XCTAssertEqual(shown.sorted(), texts.sorted(), "\(shown)", file: file, line: line) + } + + @MainActor + private func press(_ title: String, file: StaticString = #filePath, line: UInt = #line) async throws { + let shown = try XCTUnwrap(presented(), file: file, line: line) + if let alert = shown as? UIAlertController { + let action = try XCTUnwrap(alert.actions.first { $0.title == title }, file: file, line: line) + let handler = unsafeBitCast(action.value(forKey: "handler") as AnyObject, to: (@convention(block) (UIAlertAction) -> Void).self) + await dismiss(alert) + handler(action) + } else { + let button = try XCTUnwrap(buttons(shown.view).first { $0.title(for: .normal) == title }, file: file, line: line) + button.sendActions(for: .touchUpInside) + } + } + + @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 } + } + + @MainActor + private func dismissPresented() async throws { + for _ in 0..<600 { + guard let shown = getTopViewController(), shown.presentingViewController != nil else { return } + if shown.isBeingPresented || shown.isBeingDismissed { + try await Task.sleep(nanoseconds: 50_000_000) + } else { + await dismiss(shown) + } + } + } + + @MainActor + private func dismiss(_ shown: UIViewController) async { + await withCheckedContinuation { done in shown.dismiss(animated: false) { done.resume() } } + } + + @MainActor + private func shownTexts() -> [String] { + guard let shown = presented() else { return [] } + return if let alert = shown as? UIAlertController { + [alert.title, alert.message].compactMap { $0 } + alert.actions.compactMap(\.title) + } else { + viewTexts(shown.view) + } + } + + private func viewTexts(_ view: UIView) -> [String] { + if let label = view as? UILabel { + [label.text].compactMap { $0 } + } else if let button = view as? UIButton { + [button.title(for: .normal)].compactMap { $0 } + } else { + view.subviews.flatMap(viewTexts) + } + } + + private func buttons(_ view: UIView) -> [UIButton] { + if let button = view as? UIButton { [button] } else { view.subviews.flatMap(buttons) } + } +} + +private final class SearchState: ObservableObject { + @Published var searchMode = false + @Published var searchText = "" + @Published var showingLink = false + @Published var filtered: Set = [] + @Published var parentSheet: SomeSheet? = nil +} + +private struct SearchHost: View { + @ObservedObject var state: SearchState + @FocusState private var focused: Bool + + var body: some View { + ChatListSearchBar( + searchMode: $state.searchMode, + searchFocussed: $focused, + searchText: $state.searchText, + searchShowingSimplexLink: $state.showingLink, + searchChatFilteredBySimplexLink: $state.filtered, + parentSheet: $state.parentSheet + ) + .environmentObject(ChatModel.shared) + .environmentObject(ChatTagsModel.shared) + .environmentObject(CurrentColors.toAppTheme()) + } +} + +private 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 } + fields["type"] = nil + return ["_owsf": true, tag: fields] + } else if let array = value as? [Any] { + return array.map(singleFieldJSON) + } else { + return value + } +} diff --git a/apps/ios/SimpleX.xcodeproj/project.pbxproj b/apps/ios/SimpleX.xcodeproj/project.pbxproj index 9d50aaeb8e..0e209cbc73 100644 --- a/apps/ios/SimpleX.xcodeproj/project.pbxproj +++ b/apps/ios/SimpleX.xcodeproj/project.pbxproj @@ -270,6 +270,7 @@ E5AEC0AB2F91A6EB00270665 /* CIChatLinkHeader.swift in Sources */ = {isa = PBXBuildFile; fileRef = E5AEC0AA2F91A6EA00270665 /* CIChatLinkHeader.swift */; }; 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 */; }; 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 */; }; @@ -293,6 +294,13 @@ remoteGlobalIDString = 5CA059C9279559F40002BEB4; remoteInfo = "SimpleX (iOS)"; }; + 4E57A1E7000000000000000D /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 5CA059BE279559F40002BEB4 /* Project object */; + proxyType = 1; + remoteGlobalIDString = 5CA059C9279559F40002BEB4; + remoteInfo = "SimpleX (iOS)"; + }; 5CA059D8279559F40002BEB4 /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = 5CA059BE279559F40002BEB4 /* Project object */; @@ -673,6 +681,8 @@ E5AEC0B12F9C000100270665 /* TerminalItemView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TerminalItemView.swift; sourceTree = ""; }; 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 = ""; }; + 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 = ""; }; E5C0BBEA2F82B45500EA7527 /* SharedAssets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = SharedAssets.xcassets; sourceTree = ""; }; @@ -770,6 +780,13 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + 4E57A1E7000000000000000C /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; 5CDCAD422818589900503DA2 /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; @@ -958,6 +975,7 @@ CEE723A82C3BD3D70009AE93 /* SimpleX SE */, 5CA059DA279559F40002BEB4 /* Tests iOS */, E5AEC0C42F9C000100270665 /* SimpleX Snapshots */, + 4E57A1E70000000000000009 /* SimpleX Unit Tests */, 5CE2BA692845308900EC33A6 /* SimpleXChat */, 5CA059CB279559F40002BEB4 /* Products */, 5C764E7A279C71D4000C6508 /* Frameworks */, @@ -988,6 +1006,7 @@ 5CA059CA279559F40002BEB4 /* SimpleX.app */, 5CA059D7279559F40002BEB4 /* Tests iOS.xctest */, E5AEC0C32F9C000100270665 /* SimpleX Snapshots.xctest */, + 4E57A1E70000000000000007 /* SimpleX Unit Tests.xctest */, 5CDCAD452818589900503DA2 /* SimpleX NSE.appex */, 5CE2BA682845308900EC33A6 /* SimpleXChat.framework */, CEE723A72C3BD3D70009AE93 /* SimpleX SE.appex */, @@ -1012,6 +1031,14 @@ path = "SimpleX Snapshots"; sourceTree = ""; }; + 4E57A1E70000000000000009 /* SimpleX Unit Tests */ = { + isa = PBXGroup; + children = ( + 4E57A1E70000000000000005 /* NameAlertsTests.swift */, + ); + path = "SimpleX Unit Tests"; + sourceTree = ""; + }; 5CA8D01B2AD9B076001FD661 /* RemoteAccess */ = { isa = PBXGroup; children = ( @@ -1411,6 +1438,24 @@ productReference = E5AEC0C32F9C000100270665 /* SimpleX Snapshots.xctest */; productType = "com.apple.product-type.bundle.unit-test"; }; + 4E57A1E7000000000000000A /* SimpleX Unit Tests */ = { + isa = PBXNativeTarget; + buildConfigurationList = 4E57A1E7000000000000000F /* Build configuration list for PBXNativeTarget "SimpleX Unit Tests" */; + buildPhases = ( + 4E57A1E7000000000000000B /* Sources */, + 4E57A1E7000000000000000C /* Frameworks */, + 4E57A1E70000000000000012 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + 4E57A1E7000000000000000E /* PBXTargetDependency */, + ); + name = "SimpleX Unit Tests"; + productName = "SimpleX Unit Tests"; + productReference = 4E57A1E70000000000000007 /* SimpleX Unit Tests.xctest */; + productType = "com.apple.product-type.bundle.unit-test"; + }; 5CDCAD442818589900503DA2 /* SimpleX NSE */ = { isa = PBXNativeTarget; buildConfigurationList = 5CDCAD502818589900503DA2 /* Build configuration list for PBXNativeTarget "SimpleX NSE" */; @@ -1502,6 +1547,10 @@ CreatedOnToolsVersion = 26.0; TestTargetID = 5CA059C9279559F40002BEB4; }; + 4E57A1E7000000000000000A = { + CreatedOnToolsVersion = 26.0; + TestTargetID = 5CA059C9279559F40002BEB4; + }; }; }; buildConfigurationList = 5CA059C1279559F40002BEB4 /* Build configuration list for PBXProject "SimpleX" */; @@ -1545,6 +1594,7 @@ 5CA059C9279559F40002BEB4 /* SimpleX (iOS) */, 5CA059D6279559F40002BEB4 /* Tests iOS */, E5AEC0C82F9C000100270665 /* SimpleX Snapshots */, + 4E57A1E7000000000000000A /* SimpleX Unit Tests */, 5CDCAD442818589900503DA2 /* SimpleX NSE */, CEE723A62C3BD3D70009AE93 /* SimpleX SE */, 5CE2BA672845308900EC33A6 /* SimpleXChat */, @@ -1580,6 +1630,13 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + 4E57A1E70000000000000012 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; 5CDCAD432818589900503DA2 /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; @@ -1860,6 +1917,14 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + 4E57A1E7000000000000000B /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 4E57A1E70000000000000006 /* NameAlertsTests.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; 5CDCAD412818589900503DA2 /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; @@ -1918,6 +1983,11 @@ target = 5CA059C9279559F40002BEB4 /* SimpleX (iOS) */; targetProxy = E5AEC0C92F9C000100270665 /* PBXContainerItemProxy */; }; + 4E57A1E7000000000000000E /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 5CA059C9279559F40002BEB4 /* SimpleX (iOS) */; + targetProxy = 4E57A1E7000000000000000D /* PBXContainerItemProxy */; + }; 5CA059D9279559F40002BEB4 /* PBXTargetDependency */ = { isa = PBXTargetDependency; target = 5CA059C9279559F40002BEB4 /* SimpleX (iOS) */; @@ -2394,6 +2464,43 @@ }; name = Release; }; + 4E57A1E70000000000000010 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + BUNDLE_LOADER = "$(TEST_HOST)"; + CODE_SIGN_STYLE = Automatic; + DEVELOPMENT_TEAM = 5NN7GUYB6T; + GENERATE_INFOPLIST_FILE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 15.0; + PRODUCT_BUNDLE_IDENTIFIER = "chat.simplex.app.unit-tests"; + PRODUCT_NAME = "$(TARGET_NAME)"; + SDKROOT = iphoneos; + SWIFT_EMIT_LOC_STRINGS = NO; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = 1; + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/SimpleX.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/SimpleX"; + }; + name = Debug; + }; + 4E57A1E70000000000000011 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + BUNDLE_LOADER = "$(TEST_HOST)"; + CODE_SIGN_STYLE = Automatic; + DEVELOPMENT_TEAM = 5NN7GUYB6T; + GENERATE_INFOPLIST_FILE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 15.0; + PRODUCT_BUNDLE_IDENTIFIER = "chat.simplex.app.unit-tests"; + PRODUCT_NAME = "$(TARGET_NAME)"; + SDKROOT = iphoneos; + SWIFT_EMIT_LOC_STRINGS = NO; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = 1; + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/SimpleX.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/SimpleX"; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; 5CDCAD4E2818589900503DA2 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { @@ -2682,6 +2789,15 @@ defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; + 4E57A1E7000000000000000F /* Build configuration list for PBXNativeTarget "SimpleX Unit Tests" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 4E57A1E70000000000000010 /* Debug */, + 4E57A1E70000000000000011 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; 5CDCAD502818589900503DA2 /* Build configuration list for PBXNativeTarget "SimpleX NSE" */ = { isa = XCConfigurationList; buildConfigurations = ( diff --git a/apps/ios/SimpleX.xcodeproj/xcshareddata/xcschemes/SimpleX Unit Tests.xcscheme b/apps/ios/SimpleX.xcodeproj/xcshareddata/xcschemes/SimpleX Unit Tests.xcscheme new file mode 100644 index 0000000000..2ba3a6d3cb --- /dev/null +++ b/apps/ios/SimpleX.xcodeproj/xcshareddata/xcschemes/SimpleX Unit Tests.xcscheme @@ -0,0 +1,68 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/apps/ios/SimpleXChat/API.swift b/apps/ios/SimpleXChat/API.swift index 04e5973085..31e24d5d9a 100644 --- a/apps/ios/SimpleXChat/API.swift +++ b/apps/ios/SimpleXChat/API.swift @@ -118,15 +118,14 @@ public func resetChatCtrl() { // Spec: spec/api.md#sendSimpleXCmd @inline(__always) public func sendSimpleXCmd(_ cmd: ChatCmdProtocol, _ ctrl: chat_ctrl? = nil, retryNum: Int32 = 0) -> APIResult { - if let d = sendSimpleXCmdStr(cmd.cmdString, ctrl, retryNum: retryNum) { + if let d = sendSimpleXCmdStr(cmd.cmdString, ctrl, retryNum) { decodeAPIResult(d) } else { APIResult.error(.invalidJSON(json: nil)) } } -@inline(__always) -public func sendSimpleXCmdStr(_ cmd: String, _ ctrl: chat_ctrl? = nil, retryNum: Int32) -> Data? { +public var sendSimpleXCmdStr: (String, chat_ctrl?, Int32) -> Data? = { cmd, ctrl, retryNum in var c = cmd.cString(using: .utf8)! return if let cjson = chat_send_cmd_retry(ctrl ?? getChatCtrl(), &c, retryNum) { dataFromCString(cjson) @@ -152,7 +151,7 @@ public func parseSimpleXMarkdown(_ s: String) -> [FormattedText]? { parseSimpleXMarkdownText(s)?.formattedText } -public func parseSimpleXMarkdownText(_ s: String) -> ParsedMarkdown? { +public var parseSimpleXMarkdownText: (String) -> ParsedMarkdown? = { s in var c = s.cString(using: .utf8)! if let cjson = chat_parse_markdown(&c) { if let d = dataFromCString(cjson) { @@ -204,7 +203,7 @@ struct ParsedServerAddress: Decodable { var parseError: String } -public func parseSanitizeUri(_ s: String, safe: Bool) -> ParsedUri? { +public var parseSanitizeUri: (String, Bool) -> ParsedUri? = { s, safe in var c = s.cString(using: .utf8)! if let cjson = chat_parse_uri(&c, safe ? 1 : 0) { if let d = dataFromCString(cjson) { diff --git a/apps/ios/spec/api.md b/apps/ios/spec/api.md index cefc76dd19..da6cd07932 100644 --- a/apps/ios/spec/api.md +++ b/apps/ios/spec/api.md @@ -550,6 +550,8 @@ public func sendSimpleXCmd( // API.swift L115 ) -> APIResult ``` +`sendSimpleXCmd` calls [`sendSimpleXCmdStr`](../SimpleXChat/API.swift#L128), a `var` holding the call of `chat_send_cmd_retry`; [`parseSimpleXMarkdownText`](../SimpleXChat/API.swift#L154) is a `var` holding the call of `chat_parse_markdown`, and [`parseSanitizeUri`](../SimpleXChat/API.swift#L206) a `var` holding the call of `chat_parse_uri`. Tests replace them with responses recorded by the core tests. + ### Event Receiver ```swift diff --git a/apps/multiplatform/common/build.gradle.kts b/apps/multiplatform/common/build.gradle.kts index 0ed62884ba..ab5c22aca7 100644 --- a/apps/multiplatform/common/build.gradle.kts +++ b/apps/multiplatform/common/build.gradle.kts @@ -149,6 +149,7 @@ kotlin { val desktopTest by getting { dependencies { implementation(compose.desktop.currentOs) + implementation("org.jetbrains.compose.ui:ui-test:${rootProject.extra["compose.version"] as String}") } } } @@ -165,6 +166,10 @@ android { lint.targetSdk = 36 } +tasks.withType().configureEach { + testLogging.exceptionFormat = org.gradle.api.tasks.testing.logging.TestExceptionFormat.FULL +} + multiplatformResources { resourcesPackage.set("chat.simplex.res") resourcesSourceSets { 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 99a443ac77..8a7c9fe2a0 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 @@ -2961,7 +2961,7 @@ object ChatController { } // Spec: spec/api.md#processReceivedMsg - private suspend fun processReceivedMsg(msg: API) { + internal suspend fun processReceivedMsg(msg: API) { lastMsgReceivedTimestamp = System.currentTimeMillis() val rhId = msg.rhId fun active(user: UserLike): Boolean = activeUser(rhId, user) diff --git a/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/platform/Core.kt b/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/platform/Core.kt index f34c15af93..5fd25b0cb1 100644 --- a/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/platform/Core.kt +++ b/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/platform/Core.kt @@ -24,13 +24,13 @@ typealias ChatCtrl = Long // Spec: spec/architecture.md#chatMigrateInit external fun chatMigrateInit(dbPath: String, dbKey: String, confirm: String): Array external fun chatCloseStore(ctrl: ChatCtrl): String -external fun chatSendCmdRetry(ctrl: ChatCtrl, msg: String, retryNum: Int): String +@JvmName("chatSendCmdRetry") external fun nativeChatSendCmdRetry(ctrl: ChatCtrl, msg: String, retryNum: Int): String external fun chatSendRemoteCmdRetry(ctrl: ChatCtrl, rhId: Int, msg: String, retryNum: Int): String external fun chatRecvMsg(ctrl: ChatCtrl): String external fun chatRecvMsgWait(ctrl: ChatCtrl, timeout: Int): String -external fun chatParseMarkdown(str: String): String +@JvmName("chatParseMarkdown") external fun nativeChatParseMarkdown(str: String): String external fun chatParseServer(str: String): String -external fun chatParseUri(str: String, safe: Int): String +@JvmName("chatParseUri") external fun nativeChatParseUri(str: String, safe: Int): String external fun chatPasswordHash(pwd: String, salt: String): String external fun chatValidName(name: String): String external fun chatParseBadgeCode(code: String): String @@ -45,6 +45,9 @@ external fun chatResizeImageFileUri(path: String, maxSize: Int): String external fun chatResizeImageFile(path: String, maxSize: Int, png: Int): String external fun chatResizeImageFdUri(fd: Int, maxSize: Int): String external fun chatResizeImageFd(fd: Int, maxSize: Int, png: Int): String +var chatSendCmdRetry: (ChatCtrl, String, Int) -> String = ::nativeChatSendCmdRetry +var chatParseMarkdown: (String) -> String = ::nativeChatParseMarkdown +var chatParseUri: (String, Int) -> String = ::nativeChatParseUri // the code in core's canonical form (prefix and 20 characters, no separators), or null when core rejects it. // The check character is verified by core via FFI, not re-implemented here, so the two cannot disagree. 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 new file mode 100644 index 0000000000..7b450e54ba --- /dev/null +++ b/apps/multiplatform/common/src/desktopTest/kotlin/chat/simplex/app/NameAlertsTest.kt @@ -0,0 +1,344 @@ +package chat.simplex.app + +import androidx.compose.runtime.CompositionLocalProvider +import androidx.compose.runtime.mutableStateOf +import androidx.compose.ui.platform.ClipboardManager +import androidx.compose.ui.platform.LocalClipboardManager +import androidx.compose.ui.semantics.SemanticsProperties +import androidx.compose.ui.test.ComposeUiTest +import androidx.compose.ui.test.ExperimentalTestApi +import androidx.compose.ui.test.SemanticsMatcher +import androidx.compose.ui.test.hasSetTextAction +import androidx.compose.ui.test.onAllNodesWithText +import androidx.compose.ui.test.onNodeWithText +import androidx.compose.ui.test.performClick +import androidx.compose.ui.test.performTextInput +import androidx.compose.ui.test.runComposeUiTest +import androidx.compose.ui.text.AnnotatedString +import androidx.compose.ui.text.input.TextFieldValue +import chat.simplex.common.model.* +import chat.simplex.common.platform.chatParseMarkdown +import chat.simplex.common.platform.chatParseUri +import chat.simplex.common.platform.chatSendCmdRetry +import chat.simplex.common.simplexWindowState +import chat.simplex.common.views.chat.SimplexNameView +import chat.simplex.common.views.chatlist.ChatListView +import chat.simplex.common.views.chatlist.ConnectByNameRow +import chat.simplex.common.views.helpers.AlertManager +import chat.simplex.common.views.helpers.AnimatedViewState +import chat.simplex.common.views.helpers.LocalAppBarHandler +import chat.simplex.common.views.helpers.rememberAppBarHandler +import chat.simplex.common.views.newchat.planAndConnect +import kotlinx.coroutines.Dispatchers +import kotlinx.coroutines.flow.MutableStateFlow +import kotlinx.coroutines.runBlocking +import kotlinx.coroutines.withContext +import kotlinx.serialization.json.Json +import kotlinx.serialization.json.jsonObject +import java.io.File +import java.util.Locale +import java.util.TimeZone +import kotlin.test.* + +@OptIn(ExperimentalTestApi::class) +class NameAlertsTest { + private val sendCmd = chatSendCmdRetry + private val parseMarkdown = chatParseMarkdown + private val parseUri = chatParseUri + private val locale = Locale.getDefault() + private val timeZone = TimeZone.getDefault() + private val unrecorded = mutableListOf() + private val shownLocalChats = mutableListOf() + + @BeforeTest + fun setUp() { + Locale.setDefault(Locale.US) + TimeZone.setDefault(TimeZone.getTimeZone("UTC")) + ChatModel.currentUser.value = User.sampleData + } + + @AfterTest + fun tearDown() { + AlertManager.shared.hideAllAlerts() + AlertManager.privacySensitive.hideAllAlerts() + ChatModel.chatsContext.chats.value.clear() + ChatModel.chatId.value = null + ChatModel.chatRunning.value = null + ChatModel.appOpenUrlConnecting.value = false + ChatModel.currentUser.value = null + simplexWindowState.toasts.clear() + chatSendCmdRetry = sendCmd + chatParseMarkdown = parseMarkdown + chatParseUri = parseUri + TimeZone.setDefault(timeZone) + Locale.setDefault(locale) + assertEquals(listOf(), unrecorded.toList(), "requests without recorded responses") + } + + @Test + fun knownNameExpired() = recordedAlerts("names/plan-known-expired") { + connect("@alice.simplex") + assertTexts("Name expired", "alice.simplex expired on January 1, 2026. Its owner can renew it until January 1, 2099.", "Open chat", "OK") + assertLocalChats("@2") + press("Open chat") + assertRequested("/_get chat @2 initial=100") + } + + @Test + fun ownNameExpired() = recordedAlerts("names/plan-own-expired") { + connect("@alice.simplex") + assertTexts("Your name has expired", "Your name alice.simplex expired on January 1, 2026. Renew it before January 1, 2099.", "Renew", "OK") + assertLocalChats() + press("Renew") + assertTexts("Open web link?", "https://simplex.domains/#testing", "Cancel", "Open") + } + + @Test + fun knownNameAvailable() = recordedAlerts("names/plan-known-available") { + connect("@alice.simplex") + assertTexts("Name no longer registered", "alice.simplex is available for registration for \$20 for 2 years.", "Register", "Open chat", "OK") + assertLocalChats("@2") + press("Register") + assertTexts("Open web link?", "https://simplex.domains/#testing", "Cancel", "Open") + } + + @Test + fun ownNameAvailable() = recordedAlerts("names/plan-own-available") { + connect("@alice.simplex") + assertTexts("Your name has expired", "Your name alice.simplex is no longer registered. It is available for registration for \$20 for 2 years.", "Re-register", "OK") + press("Re-register") + assertTexts("Open web link?", "https://simplex.domains/#testing", "Cancel", "Open") + } + + @Test + fun knownNameReserved() = recordedAlerts("names/plan-known-reserved") { + connect("@alice.simplex") + assertTexts("Name not registered", "alice.simplex is reserved for community. Please contact SimpleX Chat if you are interested in using it.", "Connect to SimpleX team", "Open chat", "OK") + assertLocalChats("@2") + press("Connect to SimpleX team") + assertRequested("/_connect plan 1 simplex:/a#lrdvu2d8A1GumSmoKb2krQmtKhWXq-tyGpHuM7aMwsw?h=smp6.simplex.im") + } + + @Test + fun knownNameMoved() = recordedAlerts("names/plan-known-moved") { + connect("@alice.simplex") + assertTexts("cath", "@alice.simplex", "Open new chat", "Cancel") + assertLocalChats("@2") + } + + @Test + fun nameAvailable() = recordedAlerts("names/error-available") { + connect("@nobody.simplex") + assertTexts("Name not registered", "nobody.simplex is available for registration for \$20 for 2 years.", "Register", "OK") + } + + @Test + fun nameNotRegistered() = recordedAlerts("names/error-not-registered") { + connect("acme.simplex") + assertTexts("Name not registered", "This SimpleX name is not registered. Please check the name.", "OK") + } + + @Test + fun knownName() = recordedAlerts("names/plan-known") { + connect("@alice.simplex") + assertTexts("alice", "@alice.simplex", "Open chat", "Cancel") + assertLocalChats("@2") + } + + @Test + fun nameMovedToKnownContact() = recordedAlerts("names/plan-moved-known") { + connect("@alice.simplex") + assertTexts("cath", "@alice.simplex", "Open chat", "Cancel") + assertLocalChats("@3") + } + + @Test + fun nameMovedToKnownBusiness() = recordedAlerts("names/plan-moved-business") { + connect("@alice.simplex") + assertTexts("cath", "@alice.simplex", "Open chat", "Cancel") + assertLocalChats("#1") + } + + @Test + fun nameOfOtherKindOffered() = recordedAlerts("names/plan-other-kind") { + connect("team.simplex") + assertTexts("team", "#team", "1 subscriber", "You are a subscriber", "Open channel", "Connect to @team.simplex", "Cancel") + assertLocalChats("#1") + press("Connect to @team.simplex") + assertTexts("alisa", "@team.simplex", "Open new chat", "Cancel") + assertTrue(chatIds().contains("@2")) + } + + @Test + fun channelWithoutRelays() = recordedAlerts("names/plan-channel-no-relays") { + connect("team.simplex") + assertTexts("team", "Channel has no active relays. Please try to join later.", "Connect to @team.simplex", "OK") + assertLocalChats() + press("Connect to @team.simplex") + assertTexts("Unconfirmed name", "The SimpleX name team.simplex is registered, but not added to profile. Please add it to your address or channel profile, if you are the owner.", "OK") + } + + @Test + fun ownChannel() = recordedAlerts("names/plan-own-channel") { + connect("#team.simplex") + assertTexts("Your channel", "This is your link for channel team (#team)!", "Open channel", "Cancel") + assertLocalChats("#1") + } + + @Test + fun contactViaAddress() = recordedAlerts("connect/contact-via-address") { + connect("CONTACT_LINK") + assertTexts("alice", "Open chat", "Cancel") + assertLocalChats("@3") + } + + @Test + fun connectByNameRowShowsLocalChats() = recorded("names/plan-known") { + setContent { + ConnectByNameRow("@alice.simplex", mutableStateOf(TextFieldValue("alice")), mutableStateOf("@alice.simplex"), close = null, showLocalChats = { chats -> shownLocalChats += chats.map { it.id } }) + AlertManager.shared.showInView() + AlertManager.privacySensitive.showInView() + } + press("Connect to @alice.simplex") + assertTexts("Connect to @alice.simplex", "alice", "@alice.simplex", "Open chat", "Cancel") + assertLocalChats("@2") + } + + @Test + fun nameMovedEvent() = recorded("names/event-name-moved") { + runBlocking { + withContext(Dispatchers.Main) { + ChatModel.chatsContext.updateChat(null, ChatInfo.Direct(Contact.sampleData.copy(contactId = 2))) + ChatModel.chatsContext.updateChat(null, ChatInfo.Group(GroupInfo.sampleData, groupChatScope = null)) + } + ChatController.processReceivedMsg(json.decodeFromString(fixtureText("names/event-name-moved"))) + } + assertEquals(DomainVerification.Moved, (chatInfo("@2") as ChatInfo.Direct).contact.profile.contactDomainVerified) + assertEquals(DomainVerification.Moved, (chatInfo("#1") as ChatInfo.Group).groupInfo.groupDomainVerified) + } + + @Test + fun chatListSearchShowsChatsOfName() = recorded("names/search-team") { + ChatModel.chatRunning.value = true + setContent { + CompositionLocalProvider(LocalAppBarHandler provides rememberAppBarHandler()) { + ChatListView(ChatModel, MutableStateFlow(AnimatedViewState.GONE), {}, false) + } + } + val names = listOf("alice", "team") + val shownBefore = names.associateWith { onAllNodesWithText(it).fetchSemanticsNodes().size } + onNode(hasSetTextAction()).performTextInput("team.simplex") + waitUntil(timeoutMillis = 5_000) { names.all { onAllNodesWithText(it).fetchSemanticsNodes().size > shownBefore.getValue(it) } } + assertEquals(setOf("@2", "#1"), chatIds().toSet()) + } + + @Test + fun verifiedNameIsCopied() = simplexName(DomainVerification.Verified) { verifications, copied -> + onNodeWithText(SIMPLEX_NAME).performClick() + waitForIdle() + assertEquals(listOf(SIMPLEX_NAME), copied) + assertEquals(listOf("Copied to clipboard"), simplexWindowState.toasts.map { it.first }) + assertEquals(0, verifications()) + } + + @Test + fun failedNameIsVerifiedAgain() = simplexName(DomainVerification.Failed) { verifications, _ -> + onNodeWithText(SIMPLEX_NAME).performClick() + waitUntil(timeoutMillis = 5_000) { verifications() == 1 } + } + + @Test + fun movedNameIsVerifiedAgain() = simplexName(DomainVerification.Moved) { verifications, _ -> + onNodeWithText(SIMPLEX_NAME).performClick() + waitUntil(timeoutMillis = 5_000) { verifications() == 1 } + } + + @Test + fun uncheckedNameOffersVerification() = simplexName(null) { verifications, _ -> + onNodeWithText("Verify name").performClick() + waitUntil(timeoutMillis = 5_000) { verifications() == 1 } + } + + private fun recordedAlerts(fixture: String, test: ComposeUiTest.() -> Unit) = recorded(fixture) { + setContent { + AlertManager.shared.showInView() + AlertManager.privacySensitive.showInView() + } + test() + } + + private fun recorded(fixture: String, test: ComposeUiTest.() -> Unit) = runComposeUiTest { + val responses = Json.parseToJsonElement(fixtureText(fixture)).jsonObject + val commands = responses["commands"]?.jsonObject + val markdown = responses["markdown"]?.jsonObject + val uris = responses["uris"]?.jsonObject + chatSendCmdRetry = { _, cmd, _ -> commands?.get(cmd)?.toString() ?: unrecordedRequest(cmd) } + chatParseMarkdown = { str -> markdown?.get(str)?.toString() ?: unrecordedRequest("markdown $str") } + chatParseUri = { str, safe -> uris?.get(str)?.takeIf { safe == 0 }?.toString() ?: unrecordedRequest("uri $str") } + test() + } + + private fun simplexName(verified: DomainVerification?, test: ComposeUiTest.(verifications: () -> Int, copied: List) -> Unit) = runComposeUiTest { + var verifications = 0 + val copied = mutableListOf() + val clipboard = object : ClipboardManager { + override fun setText(annotatedString: AnnotatedString) { copied += annotatedString.text } + override fun getText(): AnnotatedString? = null + } + setContent { + CompositionLocalProvider(LocalClipboardManager provides clipboard) { + SimplexNameView(SIMPLEX_NAME, verified) { verifications++; null } + } + } + test({ verifications }, copied) + } + + private fun unrecordedRequest(request: String): String { + synchronized(unrecorded) { unrecorded += request } + return "{}" + } + + private fun ComposeUiTest.connect(name: String) { + runBlocking { planAndConnect(rhId = null, name, close = null, showLocalChats = { chats -> shownLocalChats += chats.map { it.id } }) } + waitForIdle() + } + + private fun ComposeUiTest.press(text: String) { + onNodeWithText(text).performClick() + waitForIdle() + } + + private fun ComposeUiTest.assertTexts(vararg texts: String) { + runCatching { waitUntil(timeoutMillis = 5_000) { shownTexts() == texts.toList() } } + assertEquals(texts.toList(), shownTexts()) + } + + private fun ComposeUiTest.assertRequested(request: String) { + runCatching { waitUntil(timeoutMillis = 5_000) { synchronized(unrecorded) { unrecorded.isNotEmpty() } } } + synchronized(unrecorded) { + assertEquals(listOf(request), unrecorded.toList()) + unrecorded.clear() + } + waitUntil(timeoutMillis = 5_000) { AlertManager.shared.hasAlertsShown() } + } + + private fun ComposeUiTest.shownTexts(): List = + onAllNodes(SemanticsMatcher.keyIsDefined(SemanticsProperties.Text), useUnmergedTree = true) + .fetchSemanticsNodes() + .flatMap { node -> node.config[SemanticsProperties.Text].map { it.text } } + + private fun assertLocalChats(vararg ids: String) { + assertEquals(ids.toList(), shownLocalChats.toList()) + assertTrue(chatIds().containsAll(ids.toList())) + } + + private fun chatIds(): List = ChatModel.chatsContext.chats.value.map { it.id } + + 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" + } +} diff --git a/apps/multiplatform/spec/api.md b/apps/multiplatform/spec/api.md index ec7cedb715..66cb927bba 100644 --- a/apps/multiplatform/spec/api.md +++ b/apps/multiplatform/spec/api.md @@ -53,7 +53,7 @@ Kotlin suspend fun api*() ```kotlin external fun chatMigrateInit(dbPath: String, dbKey: String, confirm: String): Array external fun chatCloseStore(ctrl: ChatCtrl): String -external fun chatSendCmdRetry(ctrl: ChatCtrl, msg: String, retryNum: Int): String +@JvmName("chatSendCmdRetry") external fun nativeChatSendCmdRetry(ctrl: ChatCtrl, msg: String, retryNum: Int): String external fun chatSendRemoteCmdRetry(ctrl: ChatCtrl, rhId: Int, msg: String, retryNum: Int): String external fun chatRecvMsg(ctrl: ChatCtrl): String external fun chatRecvMsgWait(ctrl: ChatCtrl, timeout: Int): String diff --git a/apps/multiplatform/spec/architecture.md b/apps/multiplatform/spec/architecture.md index e0d74bba22..5eb7004550 100644 --- a/apps/multiplatform/spec/architecture.md +++ b/apps/multiplatform/spec/architecture.md @@ -130,13 +130,13 @@ All JNI declarations reside in [`Core.kt`](../common/src/commonMain/kotlin/chat/ | 2 | [`pipeStdOutToSocket()`](../common/src/commonMain/kotlin/chat/simplex/common/platform/Core.kt#L20) | `external fun pipeStdOutToSocket(socketName: String): Int` | 20 | Redirect Haskell stdout to Android local socket for logging | | 3 | [`chatMigrateInit()`](../common/src/commonMain/kotlin/chat/simplex/common/platform/Core.kt#L25) | `external fun chatMigrateInit(dbPath: String, dbKey: String, confirm: String): Array` | 25 | Initialize database with migration; returns `[jsonResult, chatCtrl]` | | 4 | [`chatCloseStore()`](../common/src/commonMain/kotlin/chat/simplex/common/platform/Core.kt#L26) | `external fun chatCloseStore(ctrl: ChatCtrl): String` | 26 | Close database store | -| 5 | [`chatSendCmdRetry()`](../common/src/commonMain/kotlin/chat/simplex/common/platform/Core.kt#L27) | `external fun chatSendCmdRetry(ctrl: ChatCtrl, msg: String, retryNum: Int): String` | 27 | Send command to core with retry count | +| 5 | [`chatSendCmdRetry()`](../common/src/commonMain/kotlin/chat/simplex/common/platform/Core.kt#L27) | `@JvmName("chatSendCmdRetry") external fun nativeChatSendCmdRetry(ctrl: ChatCtrl, msg: String, retryNum: Int): String`, called through [`var chatSendCmdRetry`](../common/src/commonMain/kotlin/chat/simplex/common/platform/Core.kt#L48), which tests replace | 27 | Send command to core with retry count | | 6 | [`chatSendRemoteCmdRetry()`](../common/src/commonMain/kotlin/chat/simplex/common/platform/Core.kt#L28) | `external fun chatSendRemoteCmdRetry(ctrl: ChatCtrl, rhId: Int, msg: String, retryNum: Int): String` | 28 | Send command to remote host | | 7 | [`chatRecvMsg()`](../common/src/commonMain/kotlin/chat/simplex/common/platform/Core.kt#L29) | `external fun chatRecvMsg(ctrl: ChatCtrl): String` | 29 | Receive message (non-blocking) | | 8 | [`chatRecvMsgWait()`](../common/src/commonMain/kotlin/chat/simplex/common/platform/Core.kt#L30) | `external fun chatRecvMsgWait(ctrl: ChatCtrl, timeout: Int): String` | 30 | Receive message with timeout (blocking up to `timeout` microseconds) | -| 9 | [`chatParseMarkdown()`](../common/src/commonMain/kotlin/chat/simplex/common/platform/Core.kt#L31) | `external fun chatParseMarkdown(str: String): String` | 31 | Parse markdown formatting | +| 9 | [`chatParseMarkdown()`](../common/src/commonMain/kotlin/chat/simplex/common/platform/Core.kt#L31) | `@JvmName("chatParseMarkdown") external fun nativeChatParseMarkdown(str: String): String`, called through [`var chatParseMarkdown`](../common/src/commonMain/kotlin/chat/simplex/common/platform/Core.kt#L49), which tests replace | 31 | Parse markdown formatting | | 10 | [`chatParseServer()`](../common/src/commonMain/kotlin/chat/simplex/common/platform/Core.kt#L32) | `external fun chatParseServer(str: String): String` | 32 | Parse SMP/XFTP server address | -| 11 | [`chatParseUri()`](../common/src/commonMain/kotlin/chat/simplex/common/platform/Core.kt#L33) | `external fun chatParseUri(str: String, safe: Int): String` | 33 | Parse SimpleX connection URI | +| 11 | [`chatParseUri()`](../common/src/commonMain/kotlin/chat/simplex/common/platform/Core.kt#L33) | `@JvmName("chatParseUri") external fun nativeChatParseUri(str: String, safe: Int): String`, called through [`var chatParseUri`](../common/src/commonMain/kotlin/chat/simplex/common/platform/Core.kt#L50), which tests replace | 33 | Parse SimpleX connection URI | | 12 | [`chatPasswordHash()`](../common/src/commonMain/kotlin/chat/simplex/common/platform/Core.kt#L34) | `external fun chatPasswordHash(pwd: String, salt: String): String` | 34 | Hash password with salt | | 13 | [`chatValidName()`](../common/src/commonMain/kotlin/chat/simplex/common/platform/Core.kt#L35) | `external fun chatValidName(name: String): String` | 35 | Validate/sanitize display name | | 14 | [`chatParseBadgeCode()`](../common/src/commonMain/kotlin/chat/simplex/common/platform/Core.kt#L36) | `external fun chatParseBadgeCode(code: String): String` | 36 | Canonical form of a badge code, or an empty string | diff --git a/plans/2026-11-16-name-alert-fixtures.md b/plans/2026-11-16-name-alert-fixtures.md new file mode 100644 index 0000000000..dfb7d17830 --- /dev/null +++ b/plans/2026-11-16-name-alert-fixtures.md @@ -0,0 +1,125 @@ +# App views tested on core responses + +Repository: simplex-chat/simplex-chat. +Branch: `ep/name-alert-fixtures-2`. +Base: master `88767bbc3` (#8220). + +The user's words: + +> you must be testing on the view level, as much as possible, with mocked API. So the question that must have been answered is how to make existing views to use mocked api responses + +> we need to cover as much of the app as possible, with as few app changes as possible, and without compiling the actual core library for the apps, because it's slow and complex. Instead we did fixtures that are tested against real haskell code. … I'd simply keep them in /tests fixtures, and have apps use them from there. + +> you just replace func with var + +## Composition + +```mermaid +flowchart LR + CT["core tests
apiFixture, nameMovedFixture"] -->|"responses, parses, events"| F["tests/fixtures/api"] + F --> KT["NameAlertsTest
desktop"] + F --> IT["NameAlertsTests
iOS, hosted by the app"] + KT -->|"sets"| KH["chatSendCmdRetry
chatParseMarkdown
chatParseUri"] + IT -->|"sets"| IH["sendSimpleXCmdStr
parseSimpleXMarkdownText
parseSanitizeUri"] + KH --> KF["planAndConnect, ChatListView,
ConnectByNameRow, SimplexNameView,
processReceivedMsg"] + IH --> IF["planAndConnect, ChatListSearchBar,
processReceivedMsg"] + KF --> KA["semantics texts, chat model"] + IF --> IA["presented controllers, chat model"] +``` + +## Hooks + +A function of the app that calls the core is a `var`; tests set it to a responder of recorded responses. + +| App | Hook | Replaces | +|---|---|---| +| iOS | `sendSimpleXCmdStr` | `func sendSimpleXCmdStr` | +| iOS | `parseSimpleXMarkdownText` | `func parseSimpleXMarkdownText` | +| iOS | `parseSanitizeUri` | `func parseSanitizeUri` | +| Kotlin | `chatSendCmdRetry` | `external fun chatSendCmdRetry`, now `nativeChatSendCmdRetry` with `@JvmName("chatSendCmdRetry")` | +| Kotlin | `chatParseMarkdown` | `external fun chatParseMarkdown`, now `nativeChatParseMarkdown` with `@JvmName("chatParseMarkdown")` | +| Kotlin | `chatParseUri` | `external fun chatParseUri`, now `nativeChatParseUri` with `@JvmName("chatParseUri")` | + +- The JNI symbols are unchanged. +- The call sites are unchanged, except the calls of `sendSimpleXCmdStr` and `parseSanitizeUri`, which lose their labels and default argument. +- Kotlin `processReceivedMsg` is `internal`, so tests process events. + +## Fixtures + +`tests/fixtures/api//.json`, written in tests/ChatTests/Utils.hs by `apiFixture fixture user placeholders FixtureRequests {frMarkdown, frUris, frCommands}`, and by `nameFixture fixture user name` for one plan of a name: + +``` +{ + "commands": {"": }, + "markdown": {"": }, + "uris": {"": } +} +``` + +- response: `chatSendCmd` of `Simplex.Chat.Mobile`, the JSON of the Kotlin app. +- parses: `chatParseMarkdown` and `chatParseUri` of `Simplex.Chat.Mobile`. +- placeholders: a link of the test replaced in keys and values, e.g. `CONTACT_LINK`. +- times replaced by 1970-01-01: `createdAt`, `updatedAt`, `chatTs`, `userMemberProfileSentAt`. +- random values replaced by their key: `agentConnId`, `xContactId`, `connFullLink`, `connShortLink`, `contactLink`, `groupLink`, `viaGroupLinkUri`, `simplexUri`, `memberId`, `memberPubKey`, `publicGroupId`, `businessId`, `customerId`. +- events: `nameMovedFixture`, the core's encoding of `CEvtNameMoved` for chats of the test. +- `registerExpiredName`: expiry 2026-01-01 12:00 UTC, grace until 2099-01-01 12:00 UTC. +- written with `testGenerate`: the test fails when its file differs. +- iOS: tagged objects converted to the single-field form when the test reads them. + +| Fixture | Core test | +|---|---| +| names/plan-known-expired, plan-known | known chat, resolved on every call | +| names/plan-own-expired | own name, expired | +| names/plan-known-available | known chat, name now available | +| names/plan-own-available | own name, now available | +| names/plan-known-reserved | known chat and own name, name without link or reserved | +| names/plan-known-moved | known chat and own name, name moved to a new address | +| names/plan-moved-known | known chat and own name, name moved to another known chat | +| names/plan-moved-business, event-name-moved | known chat, name moved to a known business chat | +| names/plan-other-kind | bare name, the other kind's chat moved, offered | +| names/plan-channel-no-relays | no local chat, the channel has no relays | +| names/search-team, plan-own-channel | local chats, before and after the name expired | +| names/error-available | connect by unregistered name reports it is available | +| names/error-not-registered | reserved for another reason | +| connect/contact-via-address | contact via address | + +## Tests + +Each test sets the hooks to the fixture and the current user, runs the app's flow and compares what the app shows. + +| Test | Flow | Checked | Apps | +|---|---|---|---| +| plan alerts | `planAndConnect` of the name | texts of the alert, the plan's chats in the chat list and passed to `showLocalChats` | both | +| Renew, Register, Re-register | a press of the button | the alert to open https://simplex.domains/#testing | both | +| Open chat | a press of the button | the chat's load requested; iOS: the chat opened | both | +| Connect to SimpleX team | a press of the button | Kotlin: the plan of the team address requested; iOS: the team address opened | both | +| other kind | a press of "Connect to @team.simplex" | the plan of the other kind and its alert, or the alert of its error | both | +| own channel, contact via address | `planAndConnect` | the alert of the known chat | both | +| moved event | `processReceivedMsg` of the recorded event | the contact and group marked moved | both | +| search | "team.simplex" typed in the chat list search | the chats found by the local lookups listed | Kotlin: `ChatListView`; iOS: `ChatListSearchBar` | +| connect by name | a press of `ConnectByNameRow` | the alert and the chats passed to `showLocalChats` | Kotlin | +| name view | `SimplexNameView` of each verification | a press copies a verified name and verifies a failed, moved or unchecked one | Kotlin | + +A request without a recorded response fails the test, unless the test expects it. +iOS compares the texts of an alert without their order, because the order of two buttons depends on their widths. + +Known gaps: +- an expired name without a grace date. +- iOS `SimplexNameView` and `ConnectByNameRow`: a SwiftUI tap is not reachable from a unit test. + +## iOS + +- target `SimpleX Unit Tests`, hosted by the app, as `SimpleX Snapshots`. +- the CI stubs of `chat_migrate_init` and `chat_migrate_init_key` return an empty string, so the app opens its database error screen and calls the core no more. +- the alert is read from `getTopViewController()`. +- setUp and tearDown dismiss every presented controller. + +## Core + +- src/Simplex/Chat/View.hs: the arm of `CESimplexDomainNotReady` matches every `SimplexDomainError` in one `case`; GHC 8.10.7 of the full matrix rejected the arm of #8220 as incomplete. + +## CI + +- desktop: `:common:desktopTest` in the Kotlin step of build-linux. +- iOS: the step "Run iOS unit tests" after "Build iOS app". +- `tests/fixtures/api/**`, the core responses of all app tests, starts the kotlin and ios scopes. diff --git a/scripts/ci/README.md b/scripts/ci/README.md index d4814235bb..b1c576b3e5 100644 --- a/scripts/ci/README.md +++ b/scripts/ci/README.md @@ -45,6 +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. - Local: ```sh cp scripts/cabal.project.local.linux cabal.project.local @@ -73,9 +74,10 @@ The reduced build runs one Linux job, build-linux (ubuntu-22.04 x86_64), for eve - Globs: - apps/ios/** + - tests/fixtures/api/** - scripts/ci/ios-stub-libs.sh -- CI: build-ios: stub libraries, then xcodebuild for the iOS Simulator without signing. -- Local, on macOS: `scripts/ci/ios-stub-libs.sh`, then the xcodebuild command of the step "Build iOS app" of build-ios. +- CI: build-ios: stub libraries, then xcodebuild for the iOS Simulator without signing (step "Build iOS app"), then the target SimpleX Unit Tests, hosted by the app, in a new simulator (step "Run iOS unit tests"). The stubs of `chat_migrate_init` and `chat_migrate_init_key` return an empty string, so the app opens its database error screen and calls the core no more. +- Local, on macOS: `scripts/ci/ios-stub-libs.sh`, then the commands of the steps "Build iOS app" and "Run iOS unit tests" of build-ios. #### packages @@ -165,7 +167,6 @@ The reduced build runs one Linux job, build-linux (ubuntu-22.04 x86_64), for eve | Scope | Paths | CI | |---|---|---| -| ios | apps/ios/** | compile only | | types package | packages/simplex-chat-client/types/typescript/** | compile only | | ts-client | packages/simplex-chat-client/typescript/** | - | | webrtc | packages/simplex-chat-webrtc/** | - | diff --git a/scripts/ci/ios-stub-libs.sh b/scripts/ci/ios-stub-libs.sh index ca0e3c9225..1482e9f2f2 100755 --- a/scripts/ci/ios-stub-libs.sh +++ b/scripts/ci/ios-stub-libs.sh @@ -17,7 +17,7 @@ trap 'rm -rf "$tmp"' EXIT # The linker resolves symbols by name only, so the stub signatures are not checked. sed -n 's/^extern [^(]*[ *]\([a-z_]*\)(.*/\1/p' "$IOS_DIR/SimpleXChat/SimpleX.h" "$IOS_DIR/SimpleXChat/hs_init.c" \ - | sort -u | sed 's/.*/void &(void) {}/' > "$tmp/stubs.c" + | sort -u | sed -E -e 's/^(chat_migrate_init|chat_migrate_init_key)$/void *calloc(unsigned long, unsigned long); char *\1(void) { return calloc(1, 1); }/' -e t -e 's/.*/void &(void) {}/' > "$tmp/stubs.c" if [ ! -s "$tmp/stubs.c" ]; then echo "Error: no extern functions found in SimpleX.h and hs_init.c" >&2 diff --git a/scripts/ci/packages_release.py b/scripts/ci/packages_release.py index dae1b14a4b..ca4b3aff0d 100644 --- a/scripts/ci/packages_release.py +++ b/scripts/ci/packages_release.py @@ -72,8 +72,8 @@ BUILD_CHANGES = { ".github/actions/**", ".github/changelog_conf.json", ], - "kotlin": ["apps/multiplatform/**", "Dockerfile*", ".github/workflows/build.yml", ".github/actions/**"], - "ios": ["apps/ios/**", "scripts/ci/ios-stub-libs.sh"], + "kotlin": ["apps/multiplatform/**", "tests/fixtures/api/**", "Dockerfile*", ".github/workflows/build.yml", ".github/actions/**"], + "ios": ["apps/ios/**", "tests/fixtures/api/**", "scripts/ci/ios-stub-libs.sh"], "packages": [ "packages/simplex-chat-nodejs/**", "packages/simplex-chat-client/types/typescript/**", diff --git a/scripts/ci/test_packages_release.py b/scripts/ci/test_packages_release.py index b1bea26fdf..c0cb515bfa 100644 --- a/scripts/ci/test_packages_release.py +++ b/scripts/ci/test_packages_release.py @@ -480,6 +480,9 @@ class ChangesTest(GitRepoTest): def test_core_change_builds_only_the_core(self): self.assertEqual(self.builds("src/Simplex/Chat.hs"), {"haskell"}) + def test_api_fixture_change_builds_the_core_and_both_apps(self): + self.assertEqual(self.builds("tests/fixtures/api/names/plan-known-expired.json"), {"haskell", "kotlin", "ios"}) + def test_ios_stub_script_builds_only_ios(self): self.assertEqual(self.builds("scripts/ci/ios-stub-libs.sh"), {"ios"}) diff --git a/src/Simplex/Chat/View.hs b/src/Simplex/Chat/View.hs index cfb6f1266c..65dada0a93 100644 --- a/src/Simplex/Chat/View.hs +++ b/src/Simplex/Chat/View.hs @@ -2855,12 +2855,12 @@ viewChatError isCmd logLevel testView = \case CEChatNotStopped -> ["error: chat not stopped"] CEChatStoreChanged -> ["error: chat store changed, please restart chat"] CEInvalidConnReq -> viewInvalidConnReq - CESimplexDomainNotReady domain (SDENameWarning w) -> [viewNameNotConnectable domain w] CESimplexDomainNotReady domain domainErr -> - let reason = case domainErr of - SDENoValidLink -> "has no valid connection link" - SDEUnknownDomain -> "is not included in the connection link's profile" - in [plain $ "SimpleX name " <> strEncode domain <> " " <> reason] + let notReady reason = [plain $ "SimpleX name " <> strEncode domain <> " " <> reason] + in case domainErr of + SDENameWarning w -> [viewNameNotConnectable domain w] + SDENoValidLink -> notReady "has no valid connection link" + SDEUnknownDomain -> notReady "is not included in the connection link's profile" CENotResolvedLocally -> ["no matching chat found, name resolution is disabled"] CEUnsupportedConnReq -> [ "", "Connection link is not supported by the your app version, please ugrade it.", plain updateStr] CEInvalidChatMessage Connection {connId} msgMeta_ msg e -> diff --git a/tests/ChatTests/Names.hs b/tests/ChatTests/Names.hs index 56f8d72499..0bdc6e8c04 100644 --- a/tests/ChatTests/Names.hs +++ b/tests/ChatTests/Names.hs @@ -264,6 +264,7 @@ testConnectByNameNotFound ps = withSmpServerAndNames ps $ \_reg -> enableNamesRole bob bob ##> "/c @nobody.simplex" bob <## "SimpleX name nobody.simplex is available: $20 for 2 years" + nameFixture "error-available" bob "@nobody.simplex" testSetNameNotOwnAddress :: HasCallStack => TestParams -> IO () testSetNameNotOwnAddress ps = withSmpServerAndNames ps $ \reg -> @@ -622,6 +623,7 @@ testPlanNameReservedOther = withAliceName $ \reg _r _alice bob -> do registerReservedName reg acmeName NRRTrademark bob ##> "/_connect plan 1 acme.simplex" bob <## "SimpleX name acme.simplex is not registered" + nameFixture "error-not-registered" bob "acme.simplex" where acmeName = SimplexNameInfo NTContact (SimplexDomain TLDSimplex "acme" []) @@ -640,6 +642,7 @@ testPlanKnownNameAvailable = withAliceName $ \reg _r alice bob -> do bob ##> "/_connect plan 1 @alice.simplex" knownAlicePlan bob bob <## "SimpleX name alice.simplex is no longer registered, available: $20 for 2 years" + apiFixture "names/plan-known-available" bob [] FixtureRequests {frMarkdown = ["@alice.simplex"], frUris = [nameHowToUri], frCommands = ["/_connect plan 1 @alice.simplex"]} testPlanKnownNameReserved :: HasCallStack => TestParams -> IO () testPlanKnownNameReserved = withAliceName $ \reg _r alice bob -> do @@ -662,6 +665,7 @@ testPlanKnownNameReserved = withAliceName $ \reg _r alice bob -> do bob ##> "/_connect plan 1 @alice.simplex" knownAlicePlan bob bob <## "SimpleX name alice.simplex is reserved for community" + apiFixture "names/plan-known-reserved" bob [] FixtureRequests {frMarkdown = ["@alice.simplex", simplexTeamUri], frUris = [], frCommands = ["/_connect plan 1 @alice.simplex"]} alice ##> "/_connect plan 1 @alice.simplex" alice <## "contact address: own address" alice <## "SimpleX name alice.simplex is reserved for community" @@ -684,9 +688,11 @@ testPlanKnownNameStale = withAliceName $ \reg (shortLink, _) alice bob -> do bob ##> "/_connect plan 1 @alice.simplex" knownAlicePlan bob bob <##. "SimpleX name alice.simplex expired on " + nameFixture "plan-known-expired" bob "@alice.simplex" registerName reg aliceSimplexName (aliceRecord shortLink) bob ##> "/_connect plan 1 @alice.simplex" knownAlicePlan bob + nameFixture "plan-known" bob "@alice.simplex" testPlanNameResolvedEveryCall :: HasCallStack => TestParams -> IO () testPlanNameResolvedEveryCall = withAliceName $ \reg (shortLink, _) _alice bob -> do @@ -706,6 +712,7 @@ testPlanOwnNameExpired = withAliceName $ \reg (shortLink, _) alice _bob -> do alice ##> "/_connect plan 1 @alice.simplex" alice <## "contact address: own address" alice <##. "your SimpleX name alice.simplex expired on " + apiFixture "names/plan-own-expired" alice [] FixtureRequests {frMarkdown = ["@alice.simplex"], frUris = [nameHowToUri], frCommands = ["/_connect plan 1 @alice.simplex"]} testPlanOwnNameAvailable :: HasCallStack => TestParams -> IO () testPlanOwnNameAvailable = withAliceName $ \reg _r alice _bob -> do @@ -713,6 +720,7 @@ testPlanOwnNameAvailable = withAliceName $ \reg _r alice _bob -> do alice ##> "/_connect plan 1 @alice.simplex" alice <## "contact address: own address" alice <## "your SimpleX name alice.simplex is no longer registered, available: $20 for 2 years" + apiFixture "names/plan-own-available" alice [] FixtureRequests {frMarkdown = ["@alice.simplex"], frUris = [nameHowToUri], frCommands = ["/_connect plan 1 @alice.simplex"]} testPlanNameResolveNever :: HasCallStack => TestParams -> IO () testPlanNameResolveNever = withAliceName $ \reg _r alice bob -> do @@ -746,6 +754,7 @@ testPlanKnownNameAddressChanged = withKnownAliceName $ \reg alice bob cath -> do bob <## "contact address: ok to connect" _ <- getTermLine bob bob <## "known contact @alice" + nameFixture "plan-known-moved" bob "@alice.simplex" bob ##> "/_connect plan 1 @alice.simplex resolve=never" knownAlicePlan bob bob ##> "/c @alice.simplex" @@ -780,6 +789,7 @@ testPlanKnownNameMovedToKnownChat = withKnownAliceName $ \reg alice bob cath -> bob ##> "/_connect plan 1 @alice.simplex" knownContactPlan "cath" "alice.simplex" bob bob <## "known contact @alice" + nameFixture "plan-moved-known" bob "@alice.simplex" alice ##> ("/c " <> cathLink) cath <#? alice cath ##> "/ac alice" @@ -811,6 +821,8 @@ testPlanKnownNameMovedToBusinessChat = withKnownAliceName $ \reg _alice bob cath bob <## "business address: known business #cath" bob <## "use #cath to send messages" bob <## "known contact @alice" + nameFixture "plan-moved-business" bob "@alice.simplex" + nameMovedFixture "event-name-moved" bob ["alice"] ["cath"] bob ##> "/_connect plan 1 @alice.simplex resolve=never" bob <## "business address: known business #cath" bob <## "use #cath to send messages" @@ -902,6 +914,7 @@ testPlanNameChannelNoRelays = withChannelChats $ \reg alice cath bob -> do bob ##> "/_connect plan 1 team.simplex" bob <## "group link: channel has no active relays, please try to join later" bob <## "You can also connect to @team.simplex in direct chat" + apiFixture "names/plan-channel-no-relays" bob [] FixtureRequests {frMarkdown = ["team.simplex", "@team.simplex"], frUris = [], frCommands = ["/_connect plan 1 team.simplex", "/_connect plan 1 @team.simplex"]} alice ##> "/_set domain 1 team.simplex" alice <## "new contact address set" bob ##> "/_connect plan 1 @team.simplex" @@ -935,6 +948,8 @@ testPlanNameLinkServer ps = flip withTeamChats ps $ \reg contactLink channelLink testPlanLocalChats :: HasCallStack => TestParams -> IO () testPlanLocalChats = withTeamChats $ \reg contactLink channelLink alice bob -> do + apiFixture "names/search-team" bob [] FixtureRequests {frMarkdown = ["", "team.simplex"], frUris = [], frCommands = ["/_connect plan 1 @team.simplex resolve=never", "/_connect plan 1 #team.simplex resolve=never"]} + apiFixture "names/plan-own-channel" alice [] FixtureRequests {frMarkdown = ["#team.simplex"], frUris = [], frCommands = ["/_connect plan 1 #team.simplex"]} bob ##> "/_connect plan 1 team.simplex resolve=never" knownGroupPlan "team" "team" bob bob ##> "/_connect plan 1 #team.simplex resolve=never" @@ -1002,6 +1017,7 @@ testPlanNameOtherKindMoved = withTeamChats $ \reg _contactLink channelLink alice bob ##> "/_connect plan 1 team.simplex" knownGroupPlan "team" "team" bob bob <## "You can also connect to @team.simplex in direct chat" + apiFixture "names/plan-other-kind" bob [] FixtureRequests {frMarkdown = ["team.simplex", "@team.simplex"], frUris = [], frCommands = ["/_connect plan 1 team.simplex", "/_connect plan 1 @team.simplex"]} bob ##> "/_connect plan 1 @team.simplex" bob <## "contact address: ok to connect" _ <- getTermLine bob @@ -1092,3 +1108,9 @@ testNameRecordOrWarning = do utc :: Int64 -> UTCTime utc = roundedToUTCTime . RoundedSystemTime + +nameHowToUri :: String +nameHowToUri = "https://simplex.domains/#testing" + +simplexTeamUri :: String +simplexTeamUri = "simplex:/a#lrdvu2d8A1GumSmoKb2krQmtKhWXq-tyGpHuM7aMwsw?h=smp6.simplex.im" diff --git a/tests/ChatTests/Profiles.hs b/tests/ChatTests/Profiles.hs index f6d709154d..dff29295bf 100644 --- a/tests/ChatTests/Profiles.hs +++ b/tests/ChatTests/Profiles.hs @@ -2426,6 +2426,7 @@ testPlanAddressContactViaAddress = bob ##> ("/_connect plan 1 " <> cLink) bob <## "contact address: known contact without connection alice" + apiFixture "connect/contact-via-address" bob [(cLink, "CONTACT_LINK")] FixtureRequests {frMarkdown = [cLink], frUris = [], frCommands = ["/_connect plan 1 " <> cLink]} -- terminal api bob ##> ("/c " <> cLink) diff --git a/tests/ChatTests/Utils.hs b/tests/ChatTests/Utils.hs index 9f9e0aaafe..113a5b4ed4 100644 --- a/tests/ChatTests/Utils.hs +++ b/tests/ChatTests/Utils.hs @@ -8,6 +8,7 @@ module ChatTests.Utils where +import APIDocs (testGenerate) import ChatClient import ChatTests.DBUtils import Control.Concurrent (threadDelay) @@ -15,18 +16,24 @@ import Control.Concurrent.Async (concurrently_, mapConcurrently_) import Control.Concurrent.STM import Control.Monad (join, unless, when) import Control.Monad.Except (runExceptT) +import qualified Data.Aeson as J +import qualified Data.Aeson.Key as JK +import qualified Data.Aeson.KeyMap as JM import Data.ByteString (ByteString) import qualified Data.ByteString.Base64 as B64 import qualified Data.ByteString.Char8 as B +import qualified Data.ByteString.Lazy.Char8 as LB import Data.Char (isDigit) -import Data.List (isPrefixOf, isSuffixOf) +import Data.Foldable (toList) +import Data.List (foldl', isPrefixOf, isSuffixOf) 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 (..), storeCxt) +import Simplex.Chat.Controller (ChatConfig (..), ChatController (..), ChatError, ChatEvent (CEvtNameMoved), storeCxt) import Simplex.Chat.Library.Commands (maxProfileImageSize) import Simplex.Chat.Markdown (viewName) +import Simplex.Chat.Mobile (chatParseMarkdown, chatParseUri, chatSendCmd, eitherToResult) import Simplex.Chat.Messages.CIContent (e2eInfoNoPQText, e2eInfoPQText) import Simplex.Chat.Protocol import Simplex.Chat.Store.Direct (getContact, getContactIdByName, getContactRequest, getContactRequestIdByName) @@ -46,6 +53,7 @@ import qualified Simplex.Messaging.Crypto as C import Simplex.Messaging.Crypto.BBS (BBSPresHeader (..)) import Simplex.Messaging.Crypto.Ratchet (PQEncryption (..), PQSupport, pattern PQEncOff, pattern PQEncOn, pattern PQSupportOff) import Simplex.Messaging.Encoding.String +import Simplex.Messaging.Util (safeDecodeUtf8) import Simplex.Messaging.Version import System.Directory (doesFileExist) import System.Environment (lookupEnv) @@ -986,3 +994,53 @@ setRelativePaths cc filesFolder tempFolder = do cc #$> ("/_temp_folder " <> tempFolder, id, "ok") cc ##> "/_start" cc <## "chat started" + +data FixtureRequests = FixtureRequests {frMarkdown :: [String], frUris :: [String], frCommands :: [String]} + +nameFixture :: String -> TestCC -> String -> IO () +nameFixture fixture cc name = apiFixture ("names/" <> fixture) cc [] FixtureRequests {frMarkdown = [name], frUris = [], frCommands = ["/_connect plan 1 " <> name]} + +apiFixture :: String -> TestCC -> [(String, String)] -> FixtureRequests -> IO () +apiFixture fixture TestCC {chatController = cc} placeholders FixtureRequests {frMarkdown, frUris, frCommands} = do + responses <- mapM (\cmd -> (JK.fromString cmd J..=) <$> (decodeJSON =<< chatSendCmd cc (B.pack cmd))) frCommands + parses <- mapM (\text -> (JK.fromString text J..=) <$> decodeJSON (chatParseMarkdown $ B.pack text)) frMarkdown + uris <- mapM (\uri -> (JK.fromString uri J..=) <$> decodeJSON (chatParseUri False $ B.pack uri)) frUris + writeFixture fixture . withPlaceholders . stableJSON $ J.object ["commands" J..= J.object responses, "markdown" J..= J.object parses, "uris" J..= J.object uris] + where + decodeJSON :: LB.ByteString -> IO J.Value + decodeJSON = either fail pure . J.eitherDecode + withPlaceholders = \case + J.Object o -> J.Object $ JM.fromList [(JK.fromText $ replaced $ JK.toText k, withPlaceholders v) | (k, v) <- JM.toList o] + J.Array a -> J.Array $ fmap withPlaceholders a + J.String s -> J.String $ replaced s + v -> v + replaced s = foldl' (\t (actual, placeholder) -> T.replace (T.pack actual) (T.pack placeholder) t) s placeholders + +nameMovedFixture :: String -> TestCC -> [ContactName] -> [GroupName] -> IO () +nameMovedFixture fixture cc contacts groups = withCCUser cc $ \user -> do + ids <- withCCTransaction cc $ \db -> runExceptT $ (,) <$> mapM (getContactIdByName db user) contacts <*> mapM (getGroupIdByName db user) groups + case ids of + Right (contactIds, groupIds) -> writeFixture ("names/" <> fixture) $ stableJSON $ J.toJSON (eitherToResult Nothing (Right $ CEvtNameMoved user contactIds groupIds :: Either ChatError ChatEvent)) + Left e -> error $ show e + +writeFixture :: String -> J.Value -> IO () +writeFixture fixture = testGenerate ("tests/fixtures/api/" <> fixture <> ".json") . prettyJSON + where + prettyJSON = (<> "\n") . pretty "" + pretty indent = \case + J.Object o | not (JM.null o) -> block indent "{" "}" [jsonText (J.String $ JK.toText k) <> ": " <> pretty (indent <> " ") v | (k, v) <- JM.toList o] + J.Array a | not (null a) -> block indent "[" "]" (map (pretty $ indent <> " ") $ toList a) + v -> jsonText v + block indent open close items = open <> "\n" <> T.intercalate ",\n" (map ((indent <> " ") <>) items) <> "\n" <> indent <> close + jsonText = safeDecodeUtf8 . LB.toStrict . J.encode + +stableJSON :: J.Value -> J.Value +stableJSON = \case + J.Object o -> J.Object $ JM.mapWithKey stableField o + J.Array a -> J.Array $ fmap stableJSON a + 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 + | otherwise = stableJSON v diff --git a/tests/NameResolver.hs b/tests/NameResolver.hs index f8ae2f254e..552ca3b2db 100644 --- a/tests/NameResolver.hs +++ b/tests/NameResolver.hs @@ -34,7 +34,7 @@ import Simplex.Messaging.Encoding.String (strEncode) import Simplex.Messaging.Names.Record (NamePricing (..), NameRecord (..), NameRegistration (..), NameReservedReason, NameResponse (..), USDCents (..)) import Simplex.Messaging.Server.Names (NamesConfig (..)) import Simplex.Messaging.SimplexName (SimplexDomain (..), SimplexNameInfo (..), labelHash) -import Simplex.Messaging.SystemTime (RoundedSystemTime (..), getSystemSeconds) +import Simplex.Messaging.SystemTime (RoundedSystemTime (..)) data TestNameAnswer = AnswerRegistration NameRegistration | AnswerFails @@ -67,11 +67,11 @@ registerAnswer :: NameRegistry -> SimplexNameInfo -> TestNameAnswer -> IO () registerAnswer reg ni a = atomically $ modifyTVar' reg $ M.insert (registryKey ni) a registerExpiredName :: NameRegistry -> SimplexNameInfo -> NameRecord -> IO () -registerExpiredName reg ni nameRecord = do - RoundedSystemTime now <- getSystemSeconds - let expires = Just $ RoundedSystemTime (now - 86400) - graceUntil = Just $ RoundedSystemTime (now + 30 * 86400) +registerExpiredName reg ni nameRecord = registerAnswer reg ni $ AnswerRegistration NRRegistered {expires, graceUntil, reservedReason_ = Nothing, nameRecord} + where + expires = Just $ RoundedSystemTime 1767268800 + graceUntil = Just $ RoundedSystemTime 4070952000 registerReservedName :: NameRegistry -> SimplexNameInfo -> NameReservedReason -> IO () registerReservedName reg ni reservedReason = registerAnswer reg ni $ AnswerRegistration NRReserved {reservedReason} diff --git a/tests/fixtures/api/connect/contact-via-address.json b/tests/fixtures/api/connect/contact-via-address.json new file mode 100644 index 0000000000..ff94a930ad --- /dev/null +++ b/tests/fixtures/api/connect/contact-via-address.json @@ -0,0 +1,264 @@ +{ + "commands": { + "/_connect plan 1 CONTACT_LINK": { + "result": { + "connLink": { + "connFullLink": "connFullLink" + }, + "connectionPlan": { + "contactAddressPlan": { + "contact": { + "chatDeleted": false, + "chatSettings": { + "enableNtfs": "all", + "favorite": false + }, + "chatTags": [], + "chatTs": "1970-01-01T00:00:00Z", + "contactGrpInvSent": false, + "contactId": 3, + "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": { + "contactLink": "contactLink", + "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": "contactViaAddress" + }, + "type": "contactAddress" + }, + "type": "connectionPlan", + "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+HHJ7g641UMSQlQATQBHEgBaQD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jTQO+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": { + "CONTACT_LINK": { + "formattedText": [ + { + "format": { + "linkType": "contact", + "simplexUri": "simplexUri", + "smpHosts": [ + "localhost" + ], + "type": "simplexLink" + }, + "text": "CONTACT_LINK" + } + ] + } + }, + "uris": {} +} diff --git a/tests/fixtures/api/names/error-available.json b/tests/fixtures/api/names/error-available.json new file mode 100644 index 0000000000..99520cb2be --- /dev/null +++ b/tests/fixtures/api/names/error-available.json @@ -0,0 +1,48 @@ +{ + "commands": { + "/_connect plan 1 @nobody.simplex": { + "error": { + "errorType": { + "simplexDomain": { + "domain": "nobody", + "nameTLD": "simplex", + "subDomain": [] + }, + "simplexDomainError": { + "nameWarning": { + "price": { + "amount": 2000, + "years": 2 + }, + "type": "available" + }, + "type": "nameWarning" + }, + "type": "simplexDomainNotReady" + }, + "type": "error" + } + } + }, + "markdown": { + "@nobody.simplex": { + "formattedText": [ + { + "format": { + "nameInfo": { + "nameDomain": { + "domain": "nobody", + "nameTLD": "simplex", + "subDomain": [] + }, + "nameType": "contact" + }, + "type": "simplexName" + }, + "text": "@nobody.simplex" + } + ] + } + }, + "uris": {} +} diff --git a/tests/fixtures/api/names/error-not-registered.json b/tests/fixtures/api/names/error-not-registered.json new file mode 100644 index 0000000000..a74b3bcd35 --- /dev/null +++ b/tests/fixtures/api/names/error-not-registered.json @@ -0,0 +1,36 @@ +{ + "commands": { + "/_connect plan 1 acme.simplex": { + "error": { + "errorType": { + "simplexDomain": { + "domain": "acme", + "nameTLD": "simplex", + "subDomain": [] + }, + "simplexDomainError": { + "nameWarning": { + "type": "notRegistered" + }, + "type": "nameWarning" + }, + "type": "simplexDomainNotReady" + }, + "type": "error" + } + } + }, + "markdown": { + "acme.simplex": { + "formattedText": [ + { + "format": { + "type": "uri" + }, + "text": "acme.simplex" + } + ] + } + }, + "uris": {} +} diff --git a/tests/fixtures/api/names/event-name-moved.json b/tests/fixtures/api/names/event-name-moved.json new file mode 100644 index 0000000000..b6657c0760 --- /dev/null +++ b/tests/fixtures/api/names/event-name-moved.json @@ -0,0 +1,82 @@ +{ + "result": { + "contactIds": [ + 2 + ], + "groupIds": [ + 1 + ], + "type": "nameMoved", + "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/AAngHliEIwkEUiAqJQtKQIqQO6UJ0yByyg1whLygQCoEioQQoBcqE9kD5UBFUBlVB9dBPUCd0GboBDUP3oUloDnoNfYRRMBmmwZKwEqwF02Er2AX2gTfBkXAinAHnwPvhUrgaPg23wZfhW/AoPAG/gBdRAEVCCaFkURooOsoG5Y4KQkWg2KidqDxUCaoa1YTqQvWj7qAmUPOoD2gsmoqWQWugTdGOaF80E52I3okuQJeh69Bt6D70HfQkegH9GUPBSGDUMSYYJ0wAJhKThsnFlGBqMK2Yq5hRzDTmHRaLFcIqY42wjthAbAx2O7YAewzbjO3BDmO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n0C9aL5fnc3/l/r3ip8vL8H5Z/DCwELEy/Yr/ivC54I/qm9q3+295Fj8Un7+LfLS/lvRd9X/eB/qH/o//HmeW0FdxK6SfVT12fXT4/4sRzOCwGm7FqBVBIwhERALyuBYASCAB1CPEPG9f8119+BvrK2fyNwVndL5jhvubRVsMQgCakeCFp04OsQ1LJEgAe5NodqT6WANbT+yf/iqQIPd21PXgaAcDJcjivtwJAQHLFgcNZ9uBwPlUgYhHf1z37f7V9g9e8ITewiP88wfWIYET6HPg21nzjV2fybQVcxfrg2/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": 1, + "shortDescr": "Bob" + }, + "sendRcptsContacts": true, + "sendRcptsSmallGroups": true, + "showNtfs": true, + "userChatRelay": false, + "userContactId": 1, + "userId": 1 + } + } +} diff --git a/tests/fixtures/api/names/plan-channel-no-relays.json b/tests/fixtures/api/names/plan-channel-no-relays.json new file mode 100644 index 0000000000..bbe8aca0b7 --- /dev/null +++ b/tests/fixtures/api/names/plan-channel-no-relays.json @@ -0,0 +1,185 @@ +{ + "commands": { + "/_connect plan 1 @team.simplex": { + "error": { + "errorType": { + "simplexDomain": { + "domain": "team", + "nameTLD": "simplex", + "subDomain": [] + }, + "simplexDomainError": { + "type": "unknownDomain" + }, + "type": "simplexDomainNotReady" + }, + "type": "error" + } + }, + "/_connect plan 1 team.simplex": { + "result": { + "connLink": { + "connFullLink": "connFullLink", + "connShortLink": "connShortLink" + }, + "connectionPlan": { + "groupLinkPlan": { + "groupSLinkData_": { + "groupProfile": { + "displayName": "team", + "fullName": "", + "groupPreferences": { + "directMessages": { + "enable": "on" + }, + "history": { + "enable": "on" + }, + "support": { + "enable": "off" + } + }, + "publicGroup": { + "groupLink": "groupLink", + "groupType": "channel", + "publicGroupAccess": { + "allowEmbedding": false, + "domainWebPage": false, + "groupDomainClaim": { + "domain": "team.simplex" + } + }, + "publicGroupId": "publicGroupId" + } + }, + "publicGroupData": { + "publicMemberCount": 1 + } + }, + "type": "noRelays" + }, + "type": "groupLink" + }, + "otherSimplexName": { + "nameDomain": { + "domain": "team", + "nameTLD": "simplex", + "subDomain": [] + }, + "nameType": "contact" + }, + "planSimplexName": { + "nameDomain": { + "domain": "team", + "nameTLD": "simplex", + "subDomain": [] + }, + "nameType": "publicGroup" + }, + "type": "connectionPlan", + "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/AAngHliEIwkEUiAqJQtKQIqQO6UJ0yByyg1whLygQCoEioQQoBcqE9kD5UBFUBlVB9dBPUCd0GboBDUP3oUloDnoNfYRRMBmmwZKwEqwF02Er2AX2gTfBkXAinAHnwPvhUrgaPg23wZfhW/AoPAG/gBdRAEVCCa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q15++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": { + "@team.simplex": { + "formattedText": [ + { + "format": { + "nameInfo": { + "nameDomain": { + "domain": "team", + "nameTLD": "simplex", + "subDomain": [] + }, + "nameType": "contact" + }, + "type": "simplexName" + }, + "text": "@team.simplex" + } + ] + }, + "team.simplex": { + "formattedText": [ + { + "format": { + "type": "uri" + }, + "text": "team.simplex" + } + ] + } + }, + "uris": {} +} diff --git a/tests/fixtures/api/names/plan-known-available.json b/tests/fixtures/api/names/plan-known-available.json new file mode 100644 index 0000000000..32970837ec --- /dev/null +++ b/tests/fixtures/api/names/plan-known-available.json @@ -0,0 +1,330 @@ +{ + "commands": { + "/_connect plan 1 @alice.simplex": { + "result": { + "connLink": { + "connFullLink": "connFullLink", + "connShortLink": "connShortLink" + }, + "connectionPlan": { + "contactAddressPlan": { + "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, + "xContactId": "xContactId" + }, + "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" + } + } + }, + "preparedContact": { + "connLinkToConnect": { + "connFullLink": "connFullLink", + "connShortLink": "connShortLink" + }, + "uiConnLinkType": "con" + }, + "profile": { + "contactDomain": { + "domain": "alice.simplex" + }, + "contactDomainVerified": "verified", + "contactLink": "contactLink", + "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": "known" + }, + "nameChange": { + "nameWarning": { + "price": { + "amount": 2000, + "years": 2 + }, + "type": "available" + }, + "type": "lapsed" + }, + "type": "contactAddress" + }, + "planSimplexName": { + "nameDomain": { + "domain": "alice", + "nameTLD": "simplex", + "subDomain": [] + }, + "nameType": "contact" + }, + "type": "connectionPlan", + "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+HHJ7g641UMSQlQATQBHEgB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zCCjTQO+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": { + "@alice.simplex": { + "formattedText": [ + { + "format": { + "nameInfo": { + "nameDomain": { + "domain": "alice", + "nameTLD": "simplex", + "subDomain": [] + }, + "nameType": "contact" + }, + "type": "simplexName" + }, + "text": "@alice.simplex" + } + ] + } + }, + "uris": { + "https://simplex.domains/#testing": { + "parseError": "", + "uriInfo": { + "scheme": "https" + } + } + } +} diff --git a/tests/fixtures/api/names/plan-known-expired.json b/tests/fixtures/api/names/plan-known-expired.json new file mode 100644 index 0000000000..f21251ca46 --- /dev/null +++ b/tests/fixtures/api/names/plan-known-expired.json @@ -0,0 +1,321 @@ +{ + "commands": { + "/_connect plan 1 @alice.simplex": { + "result": { + "connLink": { + "connFullLink": "connFullLink", + "connShortLink": "connShortLink" + }, + "connectionPlan": { + "contactAddressPlan": { + "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, + "xContactId": "xContactId" + }, + "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" + } + } + }, + "preparedContact": { + "connLinkToConnect": { + "connFullLink": "connFullLink", + "connShortLink": "connShortLink" + }, + "uiConnLinkType": "con" + }, + "profile": { + "contactDomain": { + "domain": "alice.simplex" + }, + "contactDomainVerified": "verified", + "contactLink": "contactLink", + "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": "known" + }, + "nameChange": { + "nameWarning": { + "expiredAt": "2026-01-01T12:00:00Z", + "graceUntil": "2099-01-01T12:00:00Z", + "type": "expired" + }, + "type": "lapsed" + }, + "type": "contactAddress" + }, + "planSimplexName": { + "nameDomain": { + "domain": "alice", + "nameTLD": "simplex", + "subDomain": [] + }, + "nameType": "contact" + }, + "type": "connectionPlan", + "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,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCA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qH/o//HmeW0FdxK6SfVT12fXT4/4sRzOCwGm7FqBVBIwhERALyuBYASCAB1CPEPG9f8119+BvrK2fyNwVndL5jhvubRVsMQgCakeCFp04OsQ1LJEgAe5NodqT6WANbT+yf/iqQIPd21PXgaAcDJcjivtwJAQHLFgcNZ9uBwPlUgYhHf1z37f7V9g9e8ITewiP88wfWIYET6HPg21nzjV2fybQVcxfrg2/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": 1, + "shortDescr": "Bob" + }, + "sendRcptsContacts": true, + "sendRcptsSmallGroups": true, + "showNtfs": true, + "userChatRelay": false, + "userContactId": 1, + "userId": 1 + } + } + } + }, + "markdown": { + "@alice.simplex": { + "formattedText": [ + { + "format": { + "nameInfo": { + "nameDomain": { + "domain": "alice", + "nameTLD": "simplex", + "subDomain": [] + }, + "nameType": "contact" + }, + "type": "simplexName" + }, + "text": "@alice.simplex" + } + ] + } + }, + "uris": {} +} diff --git a/tests/fixtures/api/names/plan-known-moved.json b/tests/fixtures/api/names/plan-known-moved.json new file mode 100644 index 0000000000..8598a4ac6d --- /dev/null +++ b/tests/fixtures/api/names/plan-known-moved.json @@ -0,0 +1,355 @@ +{ + "commands": { + "/_connect plan 1 @alice.simplex": { + "result": { + "connLink": { + "connFullLink": "connFullLink", + "connShortLink": "connShortLink" + }, + "connectionPlan": { + "contactAddressPlan": { + "contactSLinkData_": { + "business": false, + "profile": { + "contactDomain": { + "domain": "alice.simplex" + }, + "contactLink": "contactLink", + "displayName": "cath", + "fullName": "", + "preferences": { + "calls": { + "allow": "yes" + }, + "commands": [], + "files": { + "allow": "always" + }, + "fullDelete": { + "allow": "no" + }, + "reactions": { + "allow": "yes" + }, + "sessions": { + "allow": "no" + }, + "timedMessages": { + "allow": "yes" + }, + "voice": { + "allow": "yes" + } + }, + "shortDescr": "Catherine" + } + }, + "type": "ok" + }, + "nameChange": { + "knownChat": { + "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, + "xContactId": "xContactId" + }, + "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" + } + } + }, + "preparedContact": { + "connLinkToConnect": { + "connFullLink": "connFullLink", + "connShortLink": "connShortLink" + }, + "uiConnLinkType": "con" + }, + "profile": { + "contactDomain": { + "domain": "alice.simplex" + }, + "contactDomainVerified": "verified", + "contactLink": "contactLink", + "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" + }, + "type": "moved" + }, + "type": "contactAddress" + }, + "planSimplexName": { + "nameDomain": { + "domain": "alice", + "nameTLD": "simplex", + "subDomain": [] + }, + "nameType": "contact" + }, + "type": "connectionPlan", + "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/9qlvfqpGSQB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vkGlccu4XNdH0jnYU7cAUacidn37qR23cOxc4aGU0nYUAn7iSWEHkz46w0ocdQu1X6B/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": { + "@alice.simplex": { + "formattedText": [ + { + "format": { + "nameInfo": { + "nameDomain": { + "domain": "alice", + "nameTLD": "simplex", + "subDomain": [] + }, + "nameType": "contact" + }, + "type": "simplexName" + }, + "text": "@alice.simplex" + } + ] + } + }, + "uris": {} +} diff --git a/tests/fixtures/api/names/plan-known-reserved.json b/tests/fixtures/api/names/plan-known-reserved.json new file mode 100644 index 0000000000..a5c0c13a08 --- /dev/null +++ b/tests/fixtures/api/names/plan-known-reserved.json @@ -0,0 +1,334 @@ +{ + "commands": { + "/_connect plan 1 @alice.simplex": { + "result": { + "connLink": { + "connFullLink": "connFullLink", + "connShortLink": "connShortLink" + }, + "connectionPlan": { + "contactAddressPlan": { + "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, + "xContactId": "xContactId" + }, + "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" + } + } + }, + "preparedContact": { + "connLinkToConnect": { + "connFullLink": "connFullLink", + "connShortLink": "connShortLink" + }, + "uiConnLinkType": "con" + }, + "profile": { + "contactDomain": { + "domain": "alice.simplex" + }, + "contactDomainVerified": "verified", + "contactLink": "contactLink", + "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": "known" + }, + "nameChange": { + "nameWarning": { + "type": "reservedForCommunity" + }, + "type": "lapsed" + }, + "type": "contactAddress" + }, + "planSimplexName": { + "nameDomain": { + "domain": "alice", + "nameTLD": "simplex", + "subDomain": [] + }, + "nameType": "contact" + }, + "type": "connectionPlan", + "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/zDpz9ttzz7n73ffWm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LFgcNZ9uBwPlUgYhHf1z37f7V9g9e8ITewiP88wfWIYET6HPg21nzjV2fybQVcxfrg2/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": 1, + "shortDescr": "Bob" + }, + "sendRcptsContacts": true, + "sendRcptsSmallGroups": true, + "showNtfs": true, + "userChatRelay": false, + "userContactId": 1, + "userId": 1 + } + } + } + }, + "markdown": { + "@alice.simplex": { + "formattedText": [ + { + "format": { + "nameInfo": { + "nameDomain": { + "domain": "alice", + "nameTLD": "simplex", + "subDomain": [] + }, + "nameType": "contact" + }, + "type": "simplexName" + }, + "text": "@alice.simplex" + } + ] + }, + "simplex:/a#lrdvu2d8A1GumSmoKb2krQmtKhWXq-tyGpHuM7aMwsw?h=smp6.simplex.im": { + "formattedText": [ + { + "format": { + "linkType": "contact", + "simplexUri": "simplexUri", + "smpHosts": [ + "smp6.simplex.im" + ], + "type": "simplexLink" + }, + "text": "simplex:/a#lrdvu2d8A1GumSmoKb2krQmtKhWXq-tyGpHuM7aMwsw?h=smp6.simplex.im" + } + ] + } + }, + "uris": {} +} diff --git a/tests/fixtures/api/names/plan-known.json b/tests/fixtures/api/names/plan-known.json new file mode 100644 index 0000000000..77899271f5 --- /dev/null +++ b/tests/fixtures/api/names/plan-known.json @@ -0,0 +1,313 @@ +{ + "commands": { + "/_connect plan 1 @alice.simplex": { + "result": { + "connLink": { + "connFullLink": "connFullLink", + "connShortLink": "connShortLink" + }, + "connectionPlan": { + "contactAddressPlan": { + "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, + "xContactId": "xContactId" + }, + "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" + } + } + }, + "preparedContact": { + "connLinkToConnect": { + "connFullLink": "connFullLink", + "connShortLink": "connShortLink" + }, + "uiConnLinkType": "con" + }, + "profile": { + "contactDomain": { + "domain": "alice.simplex" + }, + "contactDomainVerified": "verified", + "contactLink": "contactLink", + "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": "known" + }, + "type": "contactAddress" + }, + "planSimplexName": { + "nameDomain": { + "domain": "alice", + "nameTLD": "simplex", + "subDomain": [] + }, + "nameType": "contact" + }, + "type": "connectionPlan", + "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/AAngHliEIwkEUiAqJQtKQIqQO6UJ0yByyg1whLygQCoEioQQoB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XwbdiWUZi0fUK01Eoc+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": { + "@alice.simplex": { + "formattedText": [ + { + "format": { + "nameInfo": { + "nameDomain": { + "domain": "alice", + "nameTLD": "simplex", + "subDomain": [] + }, + "nameType": "contact" + }, + "type": "simplexName" + }, + "text": "@alice.simplex" + } + ] + } + }, + "uris": {} +} diff --git a/tests/fixtures/api/names/plan-moved-business.json b/tests/fixtures/api/names/plan-moved-business.json new file mode 100644 index 0000000000..5ec9391523 --- /dev/null +++ b/tests/fixtures/api/names/plan-moved-business.json @@ -0,0 +1,306 @@ +{ + "commands": { + "/_connect plan 1 @alice.simplex": { + "result": { + "connLink": { + "connFullLink": "connFullLink", + "connShortLink": "connShortLink" + }, + "connectionPlan": { + "groupLinkPlan": { + "groupInfo": { + "businessChat": { + "businessDomain": { + "domain": "alice.simplex" + }, + "businessId": "businessId", + "chatType": "business", + "customerId": "customerId" + }, + "chatSettings": { + "enableNtfs": "all", + "favorite": false + }, + "chatTags": [], + "chatTs": "1970-01-01T00:00:00Z", + "createdAt": "1970-01-01T00:00:00Z", + "fullGroupPreferences": { + "commands": [], + "comments": { + "enable": "off" + }, + "directMessages": { + "enable": "off" + }, + "files": { + "enable": "on" + }, + "fullDelete": { + "enable": "off" + }, + "history": { + "enable": "on" + }, + "reactions": { + "enable": "on" + }, + "reports": { + "enable": "off" + }, + "sessions": { + "enable": "off" + }, + "signMessages": { + "enable": "off" + }, + "simplexLinks": { + "enable": "on" + }, + "support": { + "enable": "on" + }, + "timedMessages": { + "enable": "on" + }, + "voice": { + "enable": "on" + } + }, + "groupDomainVerified": "verified", + "groupId": 1, + "groupProfile": { + "displayName": "cath", + "fullName": "", + "groupPreferences": { + "commands": [], + "comments": { + "enable": "off" + }, + "directMessages": { + "enable": "off" + }, + "files": { + "enable": "on" + }, + "fullDelete": { + "enable": "off" + }, + "history": { + "enable": "on" + }, + "reactions": { + "enable": "on" + }, + "reports": { + "enable": "off" + }, + "sessions": { + "enable": "off" + }, + "signMessages": { + "enable": "off" + }, + "simplexLinks": { + "enable": "on" + }, + "support": { + "enable": "on" + }, + "timedMessages": { + "enable": "on" + }, + "voice": { + "enable": "on" + } + }, + "shortDescr": "Catherine" + }, + "groupSummary": { + "currentMembers": 2 + }, + "localAlias": "", + "localDisplayName": "cath", + "membersRequireAttention": 0, + "membership": { + "blockedByAdmin": false, + "createdAt": "1970-01-01T00:00:00Z", + "groupId": 1, + "groupMemberId": 2, + "indexInGroup": 1, + "invitedBy": { + "type": "unknown" + }, + "invitedByGroupMemberId": 1, + "localDisplayName": "bob", + "memberCategory": "user", + "memberChatVRange": { + "maxVersion": 22, + "minVersion": 9 + }, + "memberContactId": 1, + "memberContactProfileId": 1, + "memberId": "memberId", + "memberProfile": { + "displayName": "bob", + "fullName": "", + "image": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAKHGlDQ1BJQ0MgUHJvZmlsZQAASImFVgdUVNcWve9Nb7QZeu9NehtAem/Sq6gMQ28OQxWxgAQjEFFEREARNFQFg1KjiIhiIQgoYA9IEFBisCAq6OQNJNH4//r/zDpz9ttzz7n73ffWmg0A6QCDxYqD+QCIT0hmezlYywQEBsngngE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ITewiP88wfWIYET6HPg21nzjV2fybQVcxfrg2/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": 1, + "shortDescr": "Bob" + }, + "memberPubKey": "memberPubKey", + "memberRole": "member", + "memberSettings": { + "showMessages": true + }, + "memberStatus": "connected", + "updatedAt": "1970-01-01T00:00:00Z" + }, + "preparedGroup": { + "connLinkPreparedConnection": true, + "connLinkStartedConnection": true, + "connLinkToConnect": { + "connFullLink": "connFullLink", + "connShortLink": "connShortLink" + } + }, + "updatedAt": "1970-01-01T00:00:00Z", + "useRelays": false, + "userMemberProfileSentAt": "1970-01-01T00:00:00Z", + "viaGroupLinkUri": "viaGroupLinkUri" + }, + "groupUpdated": false, + "linkOwners": [], + "type": "known" + }, + "type": "groupLink" + }, + "planSimplexName": { + "nameDomain": { + "domain": "alice", + "nameTLD": "simplex", + "subDomain": [] + }, + "nameType": "contact" + }, + "type": "connectionPlan", + "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+Ntx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nYU7cAUacidn37qR23cOxc4aGU0nYUAn7iSWEHkz46w0ocdQu1X6B/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": { + "@alice.simplex": { + "formattedText": [ + { + "format": { + "nameInfo": { + "nameDomain": { + "domain": "alice", + "nameTLD": "simplex", + "subDomain": [] + }, + "nameType": "contact" + }, + "type": "simplexName" + }, + "text": "@alice.simplex" + } + ] + } + }, + "uris": {} +} diff --git a/tests/fixtures/api/names/plan-moved-known.json b/tests/fixtures/api/names/plan-moved-known.json new file mode 100644 index 0000000000..1823756d1a --- /dev/null +++ b/tests/fixtures/api/names/plan-moved-known.json @@ -0,0 +1,306 @@ +{ + "commands": { + "/_connect plan 1 @alice.simplex": { + "result": { + "connLink": { + "connFullLink": "connFullLink", + "connShortLink": "connShortLink" + }, + "connectionPlan": { + "contactAddressPlan": { + "contact": { + "activeConn": { + "agentConnId": "agentConnId", + "authErrCounter": 0, + "connChatVersion": 22, + "connId": 2, + "connLevel": 0, + "connStatus": { + "type": "ready" + }, + "connType": "contact", + "contactConnInitiated": false, + "createdAt": "1970-01-01T00:00:00Z", + "entityId": 3, + "localAlias": "", + "peerChatVRange": { + "maxVersion": 22, + "minVersion": 9 + }, + "pqEncryption": true, + "pqRcvEnabled": true, + "pqSndEnabled": true, + "pqSupport": true, + "quotaErrCounter": 0, + "viaGroupLink": false, + "xContactId": "xContactId" + }, + "chatDeleted": false, + "chatSettings": { + "enableNtfs": "all", + "favorite": false + }, + "chatTags": [], + "chatTs": "1970-01-01T00:00:00Z", + "contactGrpInvSent": false, + "contactId": 3, + "contactStatus": "active", + "contactUsed": true, + "createdAt": "1970-01-01T00:00:00Z", + "localDisplayName": "cath", + "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": { + "contactDomain": { + "domain": "alice.simplex" + }, + "contactDomainVerified": "verified", + "contactLink": "contactLink", + "displayName": "cath", + "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": 3, + "shortDescr": "Catherine" + }, + "updatedAt": "1970-01-01T00:00:00Z", + "userPreferences": {} + }, + "type": "known" + }, + "type": "contactAddress" + }, + "planSimplexName": { + "nameDomain": { + "domain": "alice", + "nameTLD": "simplex", + "subDomain": [] + }, + "nameType": "contact" + }, + "type": "connectionPlan", + "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/9nCISFJzEBgIIRTGey2MkILkawT1oyi4tnEUxjI6IQvMLFkauYqxjQQtewwuoaHy8bBNM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wAEAAAAAQAAABgAAAAAwf1XlwAAAaNJREFUSA3FlT1LA0EQQBN/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": { + "@alice.simplex": { + "formattedText": [ + { + "format": { + "nameInfo": { + "nameDomain": { + "domain": "alice", + "nameTLD": "simplex", + "subDomain": [] + }, + "nameType": "contact" + }, + "type": "simplexName" + }, + "text": "@alice.simplex" + } + ] + } + }, + "uris": {} +} diff --git a/tests/fixtures/api/names/plan-other-kind.json b/tests/fixtures/api/names/plan-other-kind.json new file mode 100644 index 0000000000..f1775ef9f5 --- /dev/null +++ b/tests/fixtures/api/names/plan-other-kind.json @@ -0,0 +1,627 @@ +{ + "commands": { + "/_connect plan 1 @team.simplex": { + "result": { + "connLink": { + "connFullLink": "connFullLink", + "connShortLink": "connShortLink" + }, + "connectionPlan": { + "contactAddressPlan": { + "contactSLinkData_": { + "business": false, + "profile": { + "contactDomain": { + "domain": "team.simplex" + }, + "contactLink": "contactLink", + "displayName": "alisa", + "fullName": "", + "preferences": { + "calls": { + "allow": "yes" + }, + "commands": [], + "files": { + "allow": "always" + }, + "fullDelete": { + "allow": "no" + }, + "reactions": { + "allow": "yes" + }, + "sessions": { + "allow": "no" + }, + "timedMessages": { + "allow": "yes" + }, + "voice": { + "allow": "yes" + } + } + } + }, + "type": "ok" + }, + "nameChange": { + "knownChat": { + "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, + "xContactId": "xContactId" + }, + "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" + } + } + }, + "preparedContact": { + "connLinkToConnect": { + "connFullLink": "connFullLink", + "connShortLink": "connShortLink" + }, + "uiConnLinkType": "con" + }, + "profile": { + "contactDomain": { + "domain": "team.simplex" + }, + "contactDomainVerified": "verified", + "contactLink": "contactLink", + "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" + }, + "type": "moved" + }, + "type": "contactAddress" + }, + "planSimplexName": { + "nameDomain": { + "domain": "team", + "nameTLD": "simplex", + "subDomain": [] + }, + "nameType": "contact" + }, + "type": "connectionPlan", + "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/AAngHliEIwkEUiAqJQtKQIqQO6UJ0yByyg1whLygQCoEioQQoBcqE9kD5UBFUBlVB9dBPUCd0GboBDUP3oUloDnoNfYRRMBmmwZKwEqwF02Er2AX2gTfBkXAinAHnwPvhU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tefZiEeZeVZWWSndgwj6fVf3XON8Qwq15++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 + } + } + }, + "/_connect plan 1 team.simplex": { + "result": { + "connLink": { + "connFullLink": "connFullLink", + "connShortLink": "connShortLink" + }, + "connectionPlan": { + "groupLinkPlan": { + "groupInfo": { + "chatSettings": { + "enableNtfs": "all", + "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": "off" + }, + "timedMessages": { + "enable": "off", + "ttl": 86400 + }, + "voice": { + "enable": "on" + } + }, + "groupDomainVerified": "verified", + "groupId": 1, + "groupProfile": { + "displayName": "team", + "fullName": "", + "groupPreferences": { + "directMessages": { + "enable": "on" + }, + "history": { + "enable": "on" + }, + "support": { + "enable": "off" + } + }, + "publicGroup": { + "groupLink": "groupLink", + "groupType": "channel", + "publicGroupAccess": { + "allowEmbedding": false, + "domainWebPage": false, + "groupDomainClaim": { + "domain": "team.simplex" + } + }, + "publicGroupId": "publicGroupId" + } + }, + "groupSummary": { + "currentMembers": 3, + "publicMemberCount": 1 + }, + "localAlias": "", + "localDisplayName": "team", + "membersRequireAttention": 0, + "membership": { + "blockedByAdmin": false, + "createdAt": "1970-01-01T00:00:00Z", + "groupId": 1, + "groupMemberId": 1, + "indexInGroup": 0, + "invitedBy": { + "type": "unknown" + }, + "localDisplayName": "bob", + "memberCategory": "user", + "memberChatVRange": { + "maxVersion": 22, + "minVersion": 9 + }, + "memberContactId": 1, + "memberContactProfileId": 1, + "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/AAngHliEIwkEUiAqJQtKQIqQO6UJ0yByyg1whLygQ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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" + }, + "memberPubKey": "memberPubKey", + "memberRole": "observer", + "memberSettings": { + "showMessages": true + }, + "memberStatus": "connected", + "updatedAt": "1970-01-01T00:00:00Z" + }, + "preparedGroup": { + "connLinkPreparedConnection": true, + "connLinkStartedConnection": true, + "connLinkToConnect": { + "connFullLink": "connFullLink", + "connShortLink": "connShortLink" + } + }, + "rosterVersion": 0, + "updatedAt": "1970-01-01T00:00:00Z", + "useRelays": true, + "userMemberProfileSentAt": "1970-01-01T00:00:00Z", + "viaGroupLinkUri": "viaGroupLinkUri" + }, + "groupUpdated": false, + "linkOwners": [], + "type": "known" + }, + "type": "groupLink" + }, + "otherSimplexName": { + "nameDomain": { + "domain": "team", + "nameTLD": "simplex", + "subDomain": [] + }, + "nameType": "contact" + }, + "planSimplexName": { + "nameDomain": { + "domain": "team", + "nameTLD": "simplex", + "subDomain": [] + }, + "nameType": "publicGroup" + }, + "type": "connectionPlan", + "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/AAngHliEIwkEUiAqJQtKQIqQO6UJ0yByyg1whLygQCoEioQQoBcqE9kD5UBFUBlVB9dBPUCd0GboBDUP3oUloDnoNfYRRMBmmwZKwEqwF02Er2AX2gTfBkXAinAHnwPvhUrgaPg23wZfhW/AoPAG/gBdRAEVCCaFkURooOsoG5Y4KQkWg2KidqDxUCaoa1YTqQvWj7qAmUPOoD2gsmoqWQWugTdGOaF80E52I3okuQJeh69Bt6D70HfQkegH9GUPBSGDUMSYYJ0wAJhKThsnFlGBq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2k4OPPV++nCKOfXit6TfVqZznlGelcxIz9TP6s5emLOfG3q+8fn0C9aL5fnc3/l/r3ip8vL8H5Z/DCwELEy/Yr/ivC54I/qm9q3+295Fj8Un7+LfLS/lvRd9X/eB/qH/o//HmeW0FdxK6SfVT12fXT4/4sRzOCwGm7FqBVBIwhERALyuBYASCAB1CPEPG9f8119+BvrK2fyNwVndL5jhvubRVsMQgCakeCFp04OsQ1LJEgAe5NodqT6WANbT+yf/iqQIPd21PXgaAcDJcjivtwJAQHLFgcNZ9uBwPlUgYhHf1z37f7V9g9e8ITewiP88wfWIYET6HPg21nzjV2fybQVcxfrg2/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": 1, + "shortDescr": "Bob" + }, + "sendRcptsContacts": true, + "sendRcptsSmallGroups": true, + "showNtfs": true, + "userChatRelay": false, + "userContactId": 1, + "userId": 1 + } + } + } + }, + "markdown": { + "@team.simplex": { + "formattedText": [ + { + "format": { + "nameInfo": { + "nameDomain": { + "domain": "team", + "nameTLD": "simplex", + "subDomain": [] + }, + "nameType": "contact" + }, + "type": "simplexName" + }, + "text": "@team.simplex" + } + ] + }, + "team.simplex": { + "formattedText": [ + { + "format": { + "type": "uri" + }, + "text": "team.simplex" + } + ] + } + }, + "uris": {} +} diff --git a/tests/fixtures/api/names/plan-own-available.json b/tests/fixtures/api/names/plan-own-available.json new file mode 100644 index 0000000000..9032b2b7d4 --- /dev/null +++ b/tests/fixtures/api/names/plan-own-available.json @@ -0,0 +1,139 @@ +{ + "commands": { + "/_connect plan 1 @alice.simplex": { + "result": { + "connLink": { + "connFullLink": "connFullLink", + "connShortLink": "connShortLink" + }, + "connectionPlan": { + "contactAddressPlan": { + "type": "ownLink" + }, + "nameChange": { + "nameWarning": { + "price": { + "amount": 2000, + "years": 2 + }, + "type": "available" + }, + "type": "lapsed" + }, + "type": "contactAddress" + }, + "planSimplexName": { + "nameDomain": { + "domain": "alice", + "nameTLD": "simplex", + "subDomain": [] + }, + "nameType": "contact" + }, + "type": "connectionPlan", + "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": { + "contactDomain": { + "domain": "alice.simplex" + }, + "contactLink": "contactLink", + "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 + } + } + } + }, + "markdown": { + "@alice.simplex": { + "formattedText": [ + { + "format": { + "nameInfo": { + "nameDomain": { + "domain": "alice", + "nameTLD": "simplex", + "subDomain": [] + }, + "nameType": "contact" + }, + "type": "simplexName" + }, + "text": "@alice.simplex" + } + ] + } + }, + "uris": { + "https://simplex.domains/#testing": { + "parseError": "", + "uriInfo": { + "scheme": "https" + } + } + } +} diff --git a/tests/fixtures/api/names/plan-own-channel.json b/tests/fixtures/api/names/plan-own-channel.json new file mode 100644 index 0000000000..ca3db4d916 --- /dev/null +++ b/tests/fixtures/api/names/plan-own-channel.json @@ -0,0 +1,275 @@ +{ + "commands": { + "/_connect plan 1 #team.simplex": { + "result": { + "connLink": { + "connFullLink": "connFullLink", + "connShortLink": "connShortLink" + }, + "connectionPlan": { + "groupLinkPlan": { + "groupInfo": { + "chatSettings": { + "enableNtfs": "all", + "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": "off" + }, + "timedMessages": { + "enable": "off", + "ttl": 86400 + }, + "voice": { + "enable": "on" + } + }, + "groupDomainVerified": "verified", + "groupId": 1, + "groupProfile": { + "displayName": "team", + "fullName": "", + "groupPreferences": { + "directMessages": { + "enable": "on" + }, + "history": { + "enable": "on" + }, + "support": { + "enable": "off" + } + }, + "publicGroup": { + "groupLink": "groupLink", + "groupType": "channel", + "publicGroupAccess": { + "allowEmbedding": false, + "domainWebPage": false, + "groupDomainClaim": { + "domain": "team.simplex" + } + }, + "publicGroupId": "publicGroupId" + } + }, + "groupSummary": { + "currentMembers": 3, + "publicMemberCount": 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": { + "contactDomain": { + "domain": "team.simplex" + }, + "contactLink": "contactLink", + "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" + }, + "rosterVersion": 0, + "updatedAt": "1970-01-01T00:00:00Z", + "useRelays": true, + "userMemberProfileSentAt": "1970-01-01T00:00:00Z" + }, + "type": "ownLink" + }, + "type": "groupLink" + }, + "planSimplexName": { + "nameDomain": { + "domain": "team", + "nameTLD": "simplex", + "subDomain": [] + }, + "nameType": "publicGroup" + }, + "type": "connectionPlan", + "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": { + "contactDomain": { + "domain": "team.simplex" + }, + "contactLink": "contactLink", + "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 + } + } + } + }, + "markdown": { + "#team.simplex": { + "formattedText": [ + { + "format": { + "nameInfo": { + "nameDomain": { + "domain": "team", + "nameTLD": "simplex", + "subDomain": [] + }, + "nameType": "publicGroup" + }, + "type": "simplexName" + }, + "text": "#team.simplex" + } + ] + } + }, + "uris": {} +} diff --git a/tests/fixtures/api/names/plan-own-expired.json b/tests/fixtures/api/names/plan-own-expired.json new file mode 100644 index 0000000000..b33110269b --- /dev/null +++ b/tests/fixtures/api/names/plan-own-expired.json @@ -0,0 +1,137 @@ +{ + "commands": { + "/_connect plan 1 @alice.simplex": { + "result": { + "connLink": { + "connFullLink": "connFullLink", + "connShortLink": "connShortLink" + }, + "connectionPlan": { + "contactAddressPlan": { + "type": "ownLink" + }, + "nameChange": { + "nameWarning": { + "expiredAt": "2026-01-01T12:00:00Z", + "graceUntil": "2099-01-01T12:00:00Z", + "type": "expired" + }, + "type": "lapsed" + }, + "type": "contactAddress" + }, + "planSimplexName": { + "nameDomain": { + "domain": "alice", + "nameTLD": "simplex", + "subDomain": [] + }, + "nameType": "contact" + }, + "type": "connectionPlan", + "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": { + "contactDomain": { + "domain": "alice.simplex" + }, + "contactLink": "contactLink", + "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 + } + } + } + }, + "markdown": { + "@alice.simplex": { + "formattedText": [ + { + "format": { + "nameInfo": { + "nameDomain": { + "domain": "alice", + "nameTLD": "simplex", + "subDomain": [] + }, + "nameType": "contact" + }, + "type": "simplexName" + }, + "text": "@alice.simplex" + } + ] + } + }, + "uris": { + "https://simplex.domains/#testing": { + "parseError": "", + "uriInfo": { + "scheme": "https" + } + } + } +} diff --git a/tests/fixtures/api/names/search-team.json b/tests/fixtures/api/names/search-team.json new file mode 100644 index 0000000000..4a323cd752 --- /dev/null +++ b/tests/fixtures/api/names/search-team.json @@ -0,0 +1,560 @@ +{ + "commands": { + "/_connect plan 1 #team.simplex resolve=never": { + "result": { + "connLink": { + "connFullLink": "connFullLink", + "connShortLink": "connShortLink" + }, + "connectionPlan": { + "groupLinkPlan": { + "groupInfo": { + "chatSettings": { + "enableNtfs": "all", + "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": "off" + }, + "timedMessages": { + "enable": "off", + "ttl": 86400 + }, + "voice": { + "enable": "on" + } + }, + "groupDomainVerified": "verified", + "groupId": 1, + "groupProfile": { + "displayName": "team", + "fullName": "", + "groupPreferences": { + "directMessages": { + "enable": "on" + }, + "history": { + "enable": "on" + }, + "support": { + "enable": "off" + } + }, + "publicGroup": { + "groupLink": "groupLink", + "groupType": "channel", + "publicGroupAccess": { + "allowEmbedding": false, + "domainWebPage": false, + "groupDomainClaim": { + "domain": "team.simplex" + } + }, + "publicGroupId": "publicGroupId" + } + }, + "groupSummary": { + "currentMembers": 2, + "publicMemberCount": 1 + }, + "localAlias": "", + "localDisplayName": "team", + "membersRequireAttention": 0, + "membership": { + "blockedByAdmin": false, + "createdAt": "1970-01-01T00:00:00Z", + "groupId": 1, + "groupMemberId": 1, + "indexInGroup": 0, + "invitedBy": { + "type": "unknown" + }, + "localDisplayName": "bob", + "memberCategory": "user", + "memberChatVRange": { + "maxVersion": 22, + "minVersion": 9 + }, + "memberContactId": 1, + "memberContactProfileId": 1, + "memberId": "memberId", + "memberProfile": { + "displayName": "bob", + "fullName": "", + "image": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgd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meW0FdxK6SfVT12fXT4/4sRzOCwGm7FqBVBIwhERALyuBYASCAB1CPEPG9f8119+BvrK2fyNwVndL5jhvubRVsMQgCakeCFp04OsQ1LJEgAe5NodqT6WANbT+yf/iqQIPd21PXgaAcDJcjivtwJAQHLFgcNZ9uBwPlUgYhHf1z37f7V9g9e8ITewiP88wfWIYET6HPg21nzjV2fybQVcxfrg2/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": 1, + "shortDescr": "Bob" + }, + "memberPubKey": "memberPubKey", + "memberRole": "observer", + "memberSettings": { + "showMessages": true + }, + "memberStatus": "connected", + "updatedAt": "1970-01-01T00:00:00Z" + }, + "preparedGroup": { + "connLinkPreparedConnection": true, + "connLinkStartedConnection": true, + "connLinkToConnect": { + "connFullLink": "connFullLink", + "connShortLink": "connShortLink" + } + }, + "updatedAt": "1970-01-01T00:00:00Z", + "useRelays": true, + "userMemberProfileSentAt": "1970-01-01T00:00:00Z", + "viaGroupLinkUri": "viaGroupLinkUri" + }, + "groupUpdated": false, + "linkOwners": [], + "type": "known" + }, + "type": "groupLink" + }, + "planSimplexName": { + "nameDomain": { + "domain": "team", + "nameTLD": "simplex", + "subDomain": [] + }, + "nameType": "publicGroup" + }, + "type": "connectionPlan", + "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/9nCISFJzEBgIIRTGey2MkILkawT1oyi4tnEUxjI6IQvMLFkauYqxjQQtewwuoaHy8bBNMBwJMZDHYkAERbhJdJZUYic4hhCNZOCItOQ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FUSA3FlT1LA0EQQBN/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 + } + } + }, + "/_connect plan 1 @team.simplex resolve=never": { + "result": { + "connLink": { + "connFullLink": "connFullLink", + "connShortLink": "connShortLink" + }, + "connectionPlan": { + "contactAddressPlan": { + "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, + "xContactId": "xContactId" + }, + "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" + } + } + }, + "preparedContact": { + "connLinkToConnect": { + "connFullLink": "connFullLink", + "connShortLink": "connShortLink" + }, + "uiConnLinkType": "con" + }, + "profile": { + "contactDomain": { + "domain": "team.simplex" + }, + "contactDomainVerified": "verified", + "contactLink": "contactLink", + "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": "known" + }, + "type": "contactAddress" + }, + "planSimplexName": { + "nameDomain": { + "domain": "team", + "nameTLD": "simplex", + "subDomain": [] + }, + "nameType": "contact" + }, + "type": "connectionPlan", + "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/9nCISFJzEBgIIRTGey2MkILkawT1oyi4tnEUxjI6IQvMLFkauYqxjQQtewwuoaHy8bBNMBwJMZDHYkAERbhJdJZUYic4hhCNZOCItOQDB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SA3FlT1LA0EQQBN/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": { + "": {}, + "team.simplex": { + "formattedText": [ + { + "format": { + "type": "uri" + }, + "text": "team.simplex" + } + ] + } + }, + "uris": {} +} From dabee7dab8456140bd2c8087d29a872b87b17a82 Mon Sep 17 00:00:00 2001 From: "Evgeny @ SimpleX Chat" <259188159+evgeny-simplex@users.noreply.github.com> Date: Tue, 17 Nov 2026 08:03:21 +0000 Subject: [PATCH 2/3] ios: fix the crash when a new chat fails to open; ui: test lapsed and moved channel names (#8241) * core, ui: plan name alert tests against core fixtures * core: write name lookup responses to app fixtures in name tests * android, desktop: name alerts tested against core fixtures * core, ios: plan Swift fixtures and iOS unit tests of name alerts * core: write name lookup responses in the Swift form to iOS fixtures * ios: name alerts tested against core fixtures * core: write both app fixtures of a name test in one run * ui: add name lookup responses written by the core tests as fixtures * core: keep the fixture writer of name tests to the forms it receives * desktop: run name alert tests in the US locale * ios: one switch for the title and effect of name alert actions * docs: name alert tests in the app specs, CI guide and plan * docs: known gaps of the name alert tests in the plan * ui: restore the name alert code and the iOS project of master * core: record name lookup responses and name parses for app tests * android, desktop: test name alerts of planAndConnect on recorded responses * ci: run the app tests for a change of the name fixtures * core: name lookup responses and name parses recorded by the core tests * docs: plan of app views tested on core responses * ios: test name alerts of planAndConnect on recorded responses * ci: iOS unit tests in the iOS job, the app launched on stub migrations * android, desktop: core hooks below the externals, in the specs * ios: name alert tests compile with the converter at file scope * ui: the moved name test expects the alert to open a chat with the new address * core, ui: app test fixtures under tests/fixtures/api * core: record the responses of the name lookup flows that the apps test * core: record URI parses, and normalize the random values of fixtures * android, desktop: URI parse hook and event processing for tests * ios: URI parse hook for tests * desktop: full failure messages of tests * core: domain errors view compiles with GHC 8.10.7 * core: normalize parses and profile send times in fixtures * core: record the parses of the chat list search * core: recorded responses of the name flows and the contact address * android, desktop: test name alerts, buttons, search and name view * ios: test name alerts, buttons, search and the moved event * docs: plan, specs and CI guide of the app tests * core: record lapsed names without grace, channels lapsed, moved, failed * android, desktop: test the prepare domain, cleanup, search row and reasons * ios: test the prepare domain, onOpen and the event's terminal text * core: the grace date of an expired name in tests is in seconds * core: recorded plans of lapsed, moved and unverified names; relays normalized * ios, android, desktop: test lapsed, moved and unverified channel names * docs: the follow-up tests and the gaps they leave * ios: wait for the alert of a failed prepare before the next test * ios: show the alert of a failed new chat on the main thread --- .../Shared/Views/NewChat/NewChatView.swift | 4 +- .../SimpleX Unit Tests/NameAlertsTests.swift | 60 +++- .../kotlin/chat/simplex/app/NameAlertsTest.kt | 96 +++++- plans/2026-11-16-name-alert-fixtures.md | 25 +- tests/ChatTests/Names.hs | 14 + tests/ChatTests/Utils.hs | 1 + tests/NameResolver.hs | 13 +- .../api/names/plan-channel-moved.json | 323 ++++++++++++++++++ .../names/plan-known-expired-no-grace.json | 320 +++++++++++++++++ .../fixtures/api/names/plan-known-failed.json | 268 +++++++++++++++ .../fixtures/api/names/plan-old-channel.json | 269 +++++++++++++++ .../api/names/plan-own-channel-expired.json | 282 +++++++++++++++ .../api/names/plan-own-expired-no-grace.json | 129 +++++++ 13 files changed, 1780 insertions(+), 24 deletions(-) create mode 100644 tests/fixtures/api/names/plan-channel-moved.json create mode 100644 tests/fixtures/api/names/plan-known-expired-no-grace.json create mode 100644 tests/fixtures/api/names/plan-known-failed.json create mode 100644 tests/fixtures/api/names/plan-old-channel.json create mode 100644 tests/fixtures/api/names/plan-own-channel-expired.json create mode 100644 tests/fixtures/api/names/plan-own-expired-no-grace.json diff --git a/apps/ios/Shared/Views/NewChat/NewChatView.swift b/apps/ios/Shared/Views/NewChat/NewChatView.swift index 31124edb05..67174d8a86 100644 --- a/apps/ios/Shared/Views/NewChat/NewChatView.swift +++ b/apps/ios/Shared/Views/NewChat/NewChatView.swift @@ -1125,8 +1125,8 @@ private func showPrepareContactAlert( } } catch let error { logger.error("showPrepareContactAlert apiPrepareContact error: \(error.localizedDescription)") - showAlert(NSLocalizedString("Error opening chat", comment: ""), message: responseError(error)) await MainActor.run { + showAlert(NSLocalizedString("Error opening chat", comment: ""), message: responseError(error)) cleanup?() } } @@ -1188,8 +1188,8 @@ private func showPrepareGroupAlert( } } catch let error { logger.error("showPrepareGroupAlert apiPrepareGroup error: \(error.localizedDescription)") - showAlert(NSLocalizedString(isChannel ? "Error opening channel" : "Error opening group", comment: "alert title"), message: responseError(error)) await MainActor.run { + showAlert(NSLocalizedString(isChannel ? "Error opening channel" : "Error opening group", comment: "alert title"), message: responseError(error)) cleanup?() } } diff --git a/apps/ios/SimpleX Unit Tests/NameAlertsTests.swift b/apps/ios/SimpleX Unit Tests/NameAlertsTests.swift index 2073797bfc..489e9a48fc 100644 --- a/apps/ios/SimpleX Unit Tests/NameAlertsTests.swift +++ b/apps/ios/SimpleX Unit Tests/NameAlertsTests.swift @@ -11,6 +11,7 @@ final class NameAlertsTests: XCTestCase { private let lock = NSLock() private var unrecorded: [String] = [] private var shownLocalChats: [String] = [] + private var opened = 0 @MainActor override func setUp() async throws { @@ -41,6 +42,7 @@ final class NameAlertsTests: XCTestCase { try await press("Open chat") try await waitFor { ChatModel.shared.chatId == "@2" } try await assertRequested { $0.hasPrefix("/_get chat @2 ") } + XCTAssertEqual(opened, 1) } @MainActor @@ -88,6 +90,9 @@ final class NameAlertsTests: XCTestCase { connect("@alice.simplex") try await assertTexts(["cath", "@alice.simplex", "Open new chat", "Cancel"]) XCTAssertEqual(shownLocalChats, ["@2"]) + try await press("Open new chat") + try await assertRequested { $0.hasPrefix("/_prepare contact 1 ") && $0.contains(" domain=alice.simplex ") } + try await assertTexts(["Error opening chat", "no data", "Ok"]) } @MainActor @@ -157,6 +162,57 @@ final class NameAlertsTests: XCTestCase { XCTAssertEqual(shownLocalChats, ["#1"]) } + @MainActor + func testKnownNameExpiredWithoutGrace() async throws { + try recorded("names/plan-known-expired-no-grace") + connect("@alice.simplex") + try await assertTexts(["Name expired", "alice.simplex expired on January 1, 2026.", "Open chat", "Ok"]) + XCTAssertEqual(shownLocalChats, ["@2"]) + } + + @MainActor + func testOwnNameExpiredWithoutGrace() async throws { + try recorded("names/plan-own-expired-no-grace") + connect("@alice.simplex") + try await assertTexts(["Your name has expired", "Your name alice.simplex expired on January 1, 2026.", "Renew", "Ok"]) + } + + @MainActor + func testOwnChannelNameExpired() async throws { + try recorded("names/plan-own-channel-expired") + connect("#team.simplex") + try await assertTexts(["Your name has expired", "Your name team.simplex expired on January 1, 2026. Renew it before January 1, 2099.", "Renew", "Open chat", "Ok"]) + XCTAssertEqual(shownLocalChats, ["#1"]) + } + + @MainActor + func testChannelNameMoved() async throws { + try recorded("names/plan-channel-moved") + connect("#team.simplex") + try await assertTexts(["teamv2", "#team", "1 subscribers", "Open channel", "Cancel"]) + XCTAssertEqual(shownLocalChats, ["#1"]) + } + + @MainActor + func testMovedChannel() async throws { + try recorded("names/plan-old-channel") + connect("TEAM_LINK") + try await assertTexts(["team", "1 subscribers", "You are a subscriber", "Open channel", "Cancel"]) + XCTAssertEqual(shownLocalChats, ["#1"]) + guard case let .group(groupInfo, _)? = ChatModel.shared.getGroupChat(1)?.chatInfo else { return XCTFail("channel not listed") } + XCTAssertEqual(groupInfo.groupDomainVerified, .moved) + } + + @MainActor + func testChannelNameNotVerified() async throws { + try recorded("names/plan-known-failed") + connect("TEAM_LINK") + try await assertTexts(["team", "2 subscribers", "You are a subscriber", "Open channel", "Cancel"]) + XCTAssertEqual(shownLocalChats, ["#1"]) + guard case let .group(groupInfo, _)? = ChatModel.shared.getGroupChat(1)?.chatInfo else { return XCTFail("channel not listed") } + XCTAssertEqual(groupInfo.groupDomainVerified, .failed) + } + @MainActor func testContactViaAddress() async throws { try recorded("connect/contact-via-address") @@ -173,6 +229,8 @@ final class NameAlertsTests: XCTestCase { ChatModel.shared.addChat(Chat(chatInfo: .group(groupInfo: GroupInfo.sampleData, groupChatScope: nil), chatItems: [])) let event: APIResult = decodeAPIResult(try JSONSerialization.data(withJSONObject: singleFieldJSON(try fixtureJSON("names/event-name-moved")))) guard case let .result(ev) = event else { return XCTFail("event not decoded: \(event.responseType)") } + XCTAssertEqual(ev.responseType, "nameMoved") + XCTAssertEqual(ev.details, "userId: 1\ncontactIds: [2]\ngroupIds: [1]") await processReceivedMsg(ev) guard case let .direct(movedContact)? = ChatModel.shared.getContactChat(2)?.chatInfo, case let .group(movedGroup, _)? = ChatModel.shared.getGroupChat(1)?.chatInfo else { return XCTFail("chats removed") } @@ -234,7 +292,7 @@ final class NameAlertsTests: XCTestCase { @MainActor private func connect(_ name: String) { - planAndConnect(name, theme: CurrentColors.toAppTheme(), dismiss: false, showLocalChats: { [unowned self] chats in self.shownLocalChats += chats.map(\.id) }) + planAndConnect(name, theme: CurrentColors.toAppTheme(), dismiss: false, showLocalChats: { [unowned self] chats in self.shownLocalChats += chats.map(\.id) }, onOpen: { [unowned self] in self.opened += 1 }) } @MainActor 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 7b450e54ba..5b7d7a5f0c 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 @@ -124,6 +124,17 @@ class NameAlertsTest { connect("@alice.simplex") assertTexts("cath", "@alice.simplex", "Open new chat", "Cancel") assertLocalChats("@2") + press("Open new chat") + assertRequested { it.startsWith("/_prepare contact 1 ") && it.contains(" domain=alice.simplex ") } + } + + @Test + fun okClosesNameAlert() = recordedAlerts("names/plan-known-expired") { + var cleanups = 0 + connect("@alice.simplex", cleanup = { cleanups++ }) + press("OK") + assertTexts() + assertEquals(1, cleanups) } @Test @@ -185,6 +196,49 @@ class NameAlertsTest { assertLocalChats("#1") } + @Test + fun knownNameExpiredWithoutGrace() = recordedAlerts("names/plan-known-expired-no-grace") { + connect("@alice.simplex") + assertTexts("Name expired", "alice.simplex expired on January 1, 2026.", "Open chat", "OK") + assertLocalChats("@2") + } + + @Test + fun ownNameExpiredWithoutGrace() = recordedAlerts("names/plan-own-expired-no-grace") { + connect("@alice.simplex") + assertTexts("Your name has expired", "Your name alice.simplex expired on January 1, 2026.", "Renew", "OK") + } + + @Test + fun ownChannelNameExpired() = recordedAlerts("names/plan-own-channel-expired") { + connect("#team.simplex") + assertTexts("Your name has expired", "Your name team.simplex expired on January 1, 2026. Renew it before January 1, 2099.", "Renew", "Open chat", "OK") + assertLocalChats("#1") + } + + @Test + fun channelNameMoved() = recordedAlerts("names/plan-channel-moved") { + connect("#team.simplex") + assertTexts("teamv2", "#team", "1 subscriber", "Open channel", "Cancel") + assertLocalChats("#1") + } + + @Test + fun movedChannel() = recordedAlerts("names/plan-old-channel") { + connect("TEAM_LINK") + assertTexts("team", "1 subscriber", "You are a subscriber", "Open channel", "Cancel") + assertLocalChats("#1") + assertEquals(DomainVerification.Moved, (chatInfo("#1") as ChatInfo.Group).groupInfo.groupDomainVerified) + } + + @Test + fun channelNameNotVerified() = recordedAlerts("names/plan-known-failed") { + connect("TEAM_LINK") + assertTexts("team", "2 subscribers", "You are a subscriber", "Open channel", "Cancel") + assertLocalChats("#1") + assertEquals(DomainVerification.Failed, (chatInfo("#1") as ChatInfo.Group).groupInfo.groupDomainVerified) + } + @Test fun contactViaAddress() = recordedAlerts("connect/contact-via-address") { connect("CONTACT_LINK") @@ -194,14 +248,22 @@ class NameAlertsTest { @Test fun connectByNameRowShowsLocalChats() = recorded("names/plan-known") { + val searchText = mutableStateOf(TextFieldValue("alice")) + val candidate = mutableStateOf("@alice.simplex") setContent { - ConnectByNameRow("@alice.simplex", mutableStateOf(TextFieldValue("alice")), mutableStateOf("@alice.simplex"), close = null, showLocalChats = { chats -> shownLocalChats += chats.map { it.id } }) + ConnectByNameRow("@alice.simplex", searchText, candidate, close = null, showLocalChats = { chats -> shownLocalChats += chats.map { it.id } }) AlertManager.shared.showInView() AlertManager.privacySensitive.showInView() } press("Connect to @alice.simplex") assertTexts("Connect to @alice.simplex", "alice", "@alice.simplex", "Open chat", "Cancel") assertLocalChats("@2") + assertEquals("alice", searchText.value.text) + assertEquals("@alice.simplex", candidate.value) + press("Open chat") + assertRequested("/_get chat @2 initial=100") + assertEquals("", searchText.value.text) + assertEquals(null, candidate.value) } @Test @@ -215,6 +277,9 @@ class NameAlertsTest { } assertEquals(DomainVerification.Moved, (chatInfo("@2") as ChatInfo.Direct).contact.profile.contactDomainVerified) assertEquals(DomainVerification.Moved, (chatInfo("#1") as ChatInfo.Group).groupInfo.groupDomainVerified) + val terminalItem = ChatModel.terminalItems.value.last() + assertEquals("< nameMoved", terminalItem.label) + assertEquals("userId: 1\ncontactIds: [2]\ngroupIds: [1]", terminalItem.details) } @Test @@ -230,6 +295,7 @@ class NameAlertsTest { onNode(hasSetTextAction()).performTextInput("team.simplex") waitUntil(timeoutMillis = 5_000) { names.all { onAllNodesWithText(it).fetchSemanticsNodes().size > shownBefore.getValue(it) } } assertEquals(setOf("@2", "#1"), chatIds().toSet()) + onNodeWithText("Connect to team.simplex").assertExists() } @Test @@ -247,6 +313,14 @@ class NameAlertsTest { waitUntil(timeoutMillis = 5_000) { verifications() == 1 } } + @Test + fun failedVerificationShowsReason() = simplexName(DomainVerification.Failed, DomainVerification.Failed to "the name does not resolve to the contact's address") { verifications, _ -> + onNodeWithText(SIMPLEX_NAME).performClick() + waitUntil(timeoutMillis = 5_000) { verifications() == 1 && AlertManager.shared.hasAlertsShown() } + onNodeWithText("SimpleX name not verified").assertExists() + onNodeWithText("the name does not resolve to the contact's address").assertExists() + } + @Test fun movedNameIsVerifiedAgain() = simplexName(DomainVerification.Moved) { verifications, _ -> onNodeWithText(SIMPLEX_NAME).performClick() @@ -278,7 +352,11 @@ class NameAlertsTest { test() } - private fun simplexName(verified: DomainVerification?, test: ComposeUiTest.(verifications: () -> Int, copied: List) -> Unit) = runComposeUiTest { + private fun simplexName( + verified: DomainVerification?, + verification: Pair? = null, + test: ComposeUiTest.(verifications: () -> Int, copied: List) -> Unit + ) = runComposeUiTest { var verifications = 0 val copied = mutableListOf() val clipboard = object : ClipboardManager { @@ -287,8 +365,9 @@ class NameAlertsTest { } setContent { CompositionLocalProvider(LocalClipboardManager provides clipboard) { - SimplexNameView(SIMPLEX_NAME, verified) { verifications++; null } + SimplexNameView(SIMPLEX_NAME, verified) { verifications++; verification } } + AlertManager.shared.showInView() } test({ verifications }, copied) } @@ -298,8 +377,8 @@ class NameAlertsTest { return "{}" } - private fun ComposeUiTest.connect(name: String) { - runBlocking { planAndConnect(rhId = null, name, close = null, showLocalChats = { chats -> shownLocalChats += chats.map { it.id } }) } + private fun ComposeUiTest.connect(name: String, cleanup: (() -> Unit)? = null) { + runBlocking { planAndConnect(rhId = null, name, close = null, cleanup = cleanup, showLocalChats = { chats -> shownLocalChats += chats.map { it.id } }) } waitForIdle() } @@ -313,10 +392,13 @@ class NameAlertsTest { assertEquals(texts.toList(), shownTexts()) } - private fun ComposeUiTest.assertRequested(request: String) { + private fun ComposeUiTest.assertRequested(request: String) = assertRequested { it == request } + + private fun ComposeUiTest.assertRequested(expected: (String) -> Boolean) { runCatching { waitUntil(timeoutMillis = 5_000) { synchronized(unrecorded) { unrecorded.isNotEmpty() } } } synchronized(unrecorded) { - assertEquals(listOf(request), unrecorded.toList()) + assertEquals(1, unrecorded.size, unrecorded.toString()) + assertTrue(expected(unrecorded.single()), unrecorded.toString()) unrecorded.clear() } waitUntil(timeoutMillis = 5_000) { AlertManager.shared.hasAlertsShown() } diff --git a/plans/2026-11-16-name-alert-fixtures.md b/plans/2026-11-16-name-alert-fixtures.md index dfb7d17830..fba75d722c 100644 --- a/plans/2026-11-16-name-alert-fixtures.md +++ b/plans/2026-11-16-name-alert-fixtures.md @@ -68,8 +68,8 @@ A function of the app that calls the core is a `var`; tests set it to a responde | Fixture | Core test | |---|---| -| names/plan-known-expired, plan-known | known chat, resolved on every call | -| names/plan-own-expired | own name, expired | +| names/plan-known-expired, plan-known-expired-no-grace, plan-known | known chat, resolved on every call | +| names/plan-own-expired, plan-own-expired-no-grace | own name, expired | | names/plan-known-available | known chat, name now available | | names/plan-own-available | own name, now available | | names/plan-known-reserved | known chat and own name, name without link or reserved | @@ -78,6 +78,8 @@ A function of the app that calls the core is a `var`; tests set it to a responde | names/plan-moved-business, event-name-moved | known chat, name moved to a known business chat | | names/plan-other-kind | bare name, the other kind's chat moved, offered | | names/plan-channel-no-relays | no local chat, the channel has no relays | +| names/plan-own-channel-expired, plan-channel-moved, plan-old-channel | channel name moved | +| names/plan-known-failed | verify channel name, fail on re-point | | names/search-team, plan-own-channel | local chats, before and after the name expired | | names/error-available | connect by unregistered name reports it is available | | names/error-not-registered | reserved for another reason | @@ -90,22 +92,29 @@ Each test sets the hooks to the fixture and the current user, runs the app's flo | Test | Flow | Checked | Apps | |---|---|---|---| | plan alerts | `planAndConnect` of the name | texts of the alert, the plan's chats in the chat list and passed to `showLocalChats` | both | +| lapsed own channel, moved channel name | `planAndConnect` | the owner's alert with its chat; the new channel with the moved one listed | both | +| moved and failed verification | `planAndConnect` of the channel's link | the known channel's alert and its decoded verification | both | | Renew, Register, Re-register | a press of the button | the alert to open https://simplex.domains/#testing | both | -| Open chat | a press of the button | the chat's load requested; iOS: the chat opened | both | +| Open chat | a press of the button | the chat's load requested; iOS: the chat opened and `onOpen` called | both | +| Open new chat | a press of the button | the prepare command with the name's domain | both | +| OK | a press of the button | the alert closed and the cleanup called | Kotlin | | Connect to SimpleX team | a press of the button | Kotlin: the plan of the team address requested; iOS: the team address opened | both | | other kind | a press of "Connect to @team.simplex" | the plan of the other kind and its alert, or the alert of its error | both | | own channel, contact via address | `planAndConnect` | the alert of the known chat | both | -| moved event | `processReceivedMsg` of the recorded event | the contact and group marked moved | both | -| search | "team.simplex" typed in the chat list search | the chats found by the local lookups listed | Kotlin: `ChatListView`; iOS: `ChatListSearchBar` | -| connect by name | a press of `ConnectByNameRow` | the alert and the chats passed to `showLocalChats` | Kotlin | -| name view | `SimplexNameView` of each verification | a press copies a verified name and verifies a failed, moved or unchecked one | Kotlin | +| moved event | `processReceivedMsg` of the recorded event | the contact and group marked moved, its terminal label and details | both | +| search | "team.simplex" typed in the chat list search | the chats found by the local lookups listed, the connect row kept | Kotlin: `ChatListView`; iOS: `ChatListSearchBar` | +| connect by name | a press of `ConnectByNameRow` | the alert, the chats passed to `showLocalChats`, the search kept until a chat opens | Kotlin | +| name view | `SimplexNameView` of each verification | a press copies a verified name and verifies a failed, moved or unchecked one; a failed manual verification shows its reason | Kotlin | A request without a recorded response fails the test, unless the test expects it. iOS compares the texts of an alert without their order, because the order of two buttons depends on their widths. Known gaps: -- an expired name without a grace date. - iOS `SimplexNameView` and `ConnectByNameRow`: a SwiftUI tap is not reachable from a unit test. +- the chats of a pending connection (`connectingProhibit`): no core test plans one. +- the other kind's button in the ask, own-link and update-required alerts, and a price with cents: no core test records them. +- the connect row on Android mobile: not reachable from the desktop tests. +- colours and icons of `SimplexNameView`. ## iOS diff --git a/tests/ChatTests/Names.hs b/tests/ChatTests/Names.hs index 0bdc6e8c04..6a2f1eedba 100644 --- a/tests/ChatTests/Names.hs +++ b/tests/ChatTests/Names.hs @@ -333,6 +333,7 @@ testChannelDomainVerify ps = withSmpServerAndNames ps $ \reg -> bob <## "group link: known group #team" bob <## "SimpleX name: #team (verification failed)" bob <## "use #team to send messages" + apiFixture "names/plan-known-failed" bob [(shortLink, "TEAM_LINK")] FixtureRequests {frMarkdown = [shortLink], frUris = [], frCommands = ["/_connect plan 1 " <> shortLink]} where teamName = SimplexNameInfo NTPublicGroup (SimplexDomain TLDSimplex "team" []) @@ -689,6 +690,11 @@ testPlanKnownNameStale = withAliceName $ \reg (shortLink, _) alice bob -> do knownAlicePlan bob bob <##. "SimpleX name alice.simplex expired on " nameFixture "plan-known-expired" bob "@alice.simplex" + registerExpiredName' reg aliceSimplexName Nothing (aliceRecord shortLink) + bob ##> "/_connect plan 1 @alice.simplex" + knownAlicePlan bob + bob <##. "SimpleX name alice.simplex expired on " + nameFixture "plan-known-expired-no-grace" bob "@alice.simplex" registerName reg aliceSimplexName (aliceRecord shortLink) bob ##> "/_connect plan 1 @alice.simplex" knownAlicePlan bob @@ -713,6 +719,11 @@ testPlanOwnNameExpired = withAliceName $ \reg (shortLink, _) alice _bob -> do alice <## "contact address: own address" alice <##. "your SimpleX name alice.simplex expired on " apiFixture "names/plan-own-expired" alice [] FixtureRequests {frMarkdown = ["@alice.simplex"], frUris = [nameHowToUri], frCommands = ["/_connect plan 1 @alice.simplex"]} + registerExpiredName' reg aliceSimplexName Nothing (aliceRecord shortLink) + alice ##> "/_connect plan 1 @alice.simplex" + alice <## "contact address: own address" + alice <##. "your SimpleX name alice.simplex expired on " + nameFixture "plan-own-expired-no-grace" alice "@alice.simplex" testPlanOwnNameAvailable :: HasCallStack => TestParams -> IO () testPlanOwnNameAvailable = withAliceName $ \reg _r alice _bob -> do @@ -857,6 +868,7 @@ testPlanChannelNameMoved = withChannelChats $ \reg alice cath bob -> do alice ##> "/_connect plan 1 #team.simplex" alice <## "group link: own link for group #team" alice <##. "your SimpleX name team.simplex expired on " + apiFixture "names/plan-own-channel-expired" alice [] FixtureRequests {frMarkdown = ["#team.simplex"], frUris = [nameHowToUri], frCommands = ["/_connect plan 1 #team.simplex"]} (shortLink2, fullLink2) <- prepareChannel' 2 "teamv2" alice cath registerName reg teamSimplexName (channelNameRecord "team.simplex" (T.pack shortLink2)) setChannelDomain alice cath "alice_1" "teamv2" "team.simplex" @@ -864,6 +876,7 @@ testPlanChannelNameMoved = withChannelChats $ \reg alice cath bob -> do bob <## "group link: ok to connect via relays" _ <- getTermLine bob bob <## "known channel #team" + apiFixture "names/plan-channel-moved" bob [] FixtureRequests {frMarkdown = ["#team.simplex"], frUris = [], frCommands = ["/_connect plan 1 #team.simplex"]} memberJoinChannel' "teamv2" 2 1 1 1 [cath] [alice] shortLink2 fullLink2 bob bob ##> "/_verify domain #2" bob <## "SimpleX name #team verified" @@ -871,6 +884,7 @@ testPlanChannelNameMoved = withChannelChats $ \reg alice cath bob -> do knownGroupPlan "teamv2" "team" bob alice ##> "/_connect plan 1 #team.simplex resolve=never" alice <## "group link: own link for group #teamv2" + apiFixture "names/plan-old-channel" bob [(shortLink, "TEAM_LINK")] FixtureRequests {frMarkdown = [shortLink], frUris = [], frCommands = ["/_connect plan 1 " <> shortLink]} testPlanChannelNameMovedNoRelays :: HasCallStack => TestParams -> IO () testPlanChannelNameMovedNoRelays = withChannelChats $ \reg alice cath bob -> do diff --git a/tests/ChatTests/Utils.hs b/tests/ChatTests/Utils.hs index 113a5b4ed4..3f0b71b28a 100644 --- a/tests/ChatTests/Utils.hs +++ b/tests/ChatTests/Utils.hs @@ -1043,4 +1043,5 @@ stableJSON = \case 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 == "groupRelays", J.Array a <- v = J.Array $ J.String "groupRelay" <$ a | otherwise = stableJSON v diff --git a/tests/NameResolver.hs b/tests/NameResolver.hs index 552ca3b2db..5b366331f3 100644 --- a/tests/NameResolver.hs +++ b/tests/NameResolver.hs @@ -10,6 +10,7 @@ module NameResolver withNameResolver, registerName, registerExpiredName, + registerExpiredName', registerReservedName, unregisterName, failNameResolution, @@ -34,7 +35,7 @@ import Simplex.Messaging.Encoding.String (strEncode) import Simplex.Messaging.Names.Record (NamePricing (..), NameRecord (..), NameRegistration (..), NameReservedReason, NameResponse (..), USDCents (..)) import Simplex.Messaging.Server.Names (NamesConfig (..)) import Simplex.Messaging.SimplexName (SimplexDomain (..), SimplexNameInfo (..), labelHash) -import Simplex.Messaging.SystemTime (RoundedSystemTime (..)) +import Simplex.Messaging.SystemTime (RoundedSystemTime (..), SystemSeconds) data TestNameAnswer = AnswerRegistration NameRegistration | AnswerFails @@ -67,11 +68,11 @@ registerAnswer :: NameRegistry -> SimplexNameInfo -> TestNameAnswer -> IO () registerAnswer reg ni a = atomically $ modifyTVar' reg $ M.insert (registryKey ni) a registerExpiredName :: NameRegistry -> SimplexNameInfo -> NameRecord -> IO () -registerExpiredName reg ni nameRecord = - registerAnswer reg ni $ AnswerRegistration NRRegistered {expires, graceUntil, reservedReason_ = Nothing, nameRecord} - where - expires = Just $ RoundedSystemTime 1767268800 - graceUntil = Just $ RoundedSystemTime 4070952000 +registerExpiredName reg ni = registerExpiredName' reg ni (Just $ RoundedSystemTime 4070952000) + +registerExpiredName' :: NameRegistry -> SimplexNameInfo -> Maybe SystemSeconds -> NameRecord -> IO () +registerExpiredName' reg ni graceUntil nameRecord = + registerAnswer reg ni $ AnswerRegistration NRRegistered {expires = Just $ RoundedSystemTime 1767268800, graceUntil, reservedReason_ = Nothing, nameRecord} registerReservedName :: NameRegistry -> SimplexNameInfo -> NameReservedReason -> IO () registerReservedName reg ni reservedReason = registerAnswer reg ni $ AnswerRegistration NRReserved {reservedReason} diff --git a/tests/fixtures/api/names/plan-channel-moved.json b/tests/fixtures/api/names/plan-channel-moved.json new file mode 100644 index 0000000000..6f9f2066a7 --- /dev/null +++ b/tests/fixtures/api/names/plan-channel-moved.json @@ -0,0 +1,323 @@ +{ + "commands": { + "/_connect plan 1 #team.simplex": { + "result": { + "connLink": { + "connFullLink": "connFullLink", + "connShortLink": "connShortLink" + }, + "connectionPlan": { + "groupLinkPlan": { + "groupSLinkData_": { + "groupProfile": { + "displayName": "teamv2", + "fullName": "", + "groupPreferences": { + "directMessages": { + "enable": "on" + }, + "history": { + "enable": "on" + }, + "support": { + "enable": "off" + } + }, + "publicGroup": { + "groupLink": "groupLink", + "groupType": "channel", + "publicGroupAccess": { + "allowEmbedding": false, + "domainWebPage": false, + "groupDomainClaim": { + "domain": "team.simplex" + } + }, + "publicGroupId": "publicGroupId" + } + }, + "publicGroupData": { + "publicMemberCount": 1 + } + }, + "groupSLinkInfo_": { + "direct": false, + "groupRelays": [ + "groupRelay" + ], + "publicGroupId": "publicGroupId" + }, + "type": "ok" + }, + "nameChange": { + "knownChat": { + "groupInfo": { + "chatSettings": { + "enableNtfs": "all", + "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": "off" + }, + "timedMessages": { + "enable": "off", + "ttl": 86400 + }, + "voice": { + "enable": "on" + } + }, + "groupDomainVerified": "verified", + "groupId": 1, + "groupProfile": { + "displayName": "team", + "fullName": "", + "groupPreferences": { + "directMessages": { + "enable": "on" + }, + "history": { + "enable": "on" + }, + "support": { + "enable": "off" + } + }, + "publicGroup": { + "groupLink": "groupLink", + "groupType": "channel", + "publicGroupAccess": { + "allowEmbedding": false, + "domainWebPage": false, + "groupDomainClaim": { + "domain": "team.simplex" + } + }, + "publicGroupId": "publicGroupId" + } + }, + "groupSummary": { + "currentMembers": 3, + "publicMemberCount": 1 + }, + "localAlias": "", + "localDisplayName": "team", + "membersRequireAttention": 0, + "membership": { + "blockedByAdmin": false, + "createdAt": "1970-01-01T00:00:00Z", + "groupId": 1, + "groupMemberId": 1, + "indexInGroup": 0, + "invitedBy": { + "type": "unknown" + }, + "localDisplayName": "bob", + "memberCategory": "user", + "memberChatVRange": { + "maxVersion": 22, + "minVersion": 9 + }, + "memberContactId": 1, + "memberContactProfileId": 1, + "memberId": "memberId", + "memberProfile": { + "displayName": "bob", + "fullName": "", + "image": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAKHGlDQ1BJQ0MgUHJvZmlsZQAASImFVgdUVNcWve9Nb7QZeu9NehtAem/Sq6gMQ28OQxWxgAQjEFFEREARNFQFg1KjiIhiIQgoYA9IEFBisCAq6OQNJNH4//r/zDpz9ttzz7n73ffWmg0A6QCDxYqD+QCIT0hmezlYywQEBsngngEYCAIy0AC6DGYSy8rDwxUg8Xf9d7wbAxC33tHgzvrP3/9nCISFJzEBgIIRTGey2MkILkawT1oyi4tnEUxjI6IQvMLFkauYqxjQQtewwu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AAAQAAABigAwAEAAAAAQAAABgAAAAAwf1XlwAAAaNJREFUSA3FlT1LA0EQQBN/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" + }, + "memberPubKey": "memberPubKey", + "memberRole": "observer", + "memberSettings": { + "showMessages": true + }, + "memberStatus": "connected", + "updatedAt": "1970-01-01T00:00:00Z" + }, + "preparedGroup": { + "connLinkPreparedConnection": true, + "connLinkStartedConnection": true, + "connLinkToConnect": { + "connFullLink": "connFullLink", + "connShortLink": "connShortLink" + } + }, + "rosterVersion": 0, + "updatedAt": "1970-01-01T00:00:00Z", + "useRelays": true, + "userMemberProfileSentAt": "1970-01-01T00:00:00Z", + "viaGroupLinkUri": "viaGroupLinkUri" + }, + "type": "group" + }, + "type": "moved" + }, + "type": "groupLink" + }, + "planSimplexName": { + "nameDomain": { + "domain": "team", + "nameTLD": "simplex", + "subDomain": [] + }, + "nameType": "publicGroup" + }, + "type": "connectionPlan", + "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+e2F4DzyLkSB79wyi0A8KoBcL2GmcJOXePQ3C8MIAJeQAOiQArIAxXuWwMMgSmwBH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5gPXaCHnZr4vvFGMoEKudKn8YvQIOOe+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": { + "#team.simplex": { + "formattedText": [ + { + "format": { + "nameInfo": { + "nameDomain": { + "domain": "team", + "nameTLD": "simplex", + "subDomain": [] + }, + "nameType": "publicGroup" + }, + "type": "simplexName" + }, + "text": "#team.simplex" + } + ] + } + }, + "uris": {} +} diff --git a/tests/fixtures/api/names/plan-known-expired-no-grace.json b/tests/fixtures/api/names/plan-known-expired-no-grace.json new file mode 100644 index 0000000000..285831a019 --- /dev/null +++ b/tests/fixtures/api/names/plan-known-expired-no-grace.json @@ -0,0 +1,320 @@ +{ + "commands": { + "/_connect plan 1 @alice.simplex": { + "result": { + "connLink": { + "connFullLink": "connFullLink", + "connShortLink": "connShortLink" + }, + "connectionPlan": { + "contactAddressPlan": { + "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, + "xContactId": "xContactId" + }, + "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" + } + } + }, + "preparedContact": { + "connLinkToConnect": { + "connFullLink": "connFullLink", + "connShortLink": "connShortLink" + }, + "uiConnLinkType": "con" + }, + "profile": { + "contactDomain": { + "domain": "alice.simplex" + }, + "contactDomainVerified": "verified", + "contactLink": "contactLink", + "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": "known" + }, + "nameChange": { + "nameWarning": { + "expiredAt": "2026-01-01T12:00:00Z", + "type": "expired" + }, + "type": "lapsed" + }, + "type": "contactAddress" + }, + "planSimplexName": { + "nameDomain": { + "domain": "alice", + "nameTLD": "simplex", + "subDomain": [] + }, + "nameType": "contact" + }, + "type": "connectionPlan", + "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/9nCISFJ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ZVhJZk1NACoAAAAIAAGHaQAEAAAAAQAAABoAAAAAAAKgAgAEAAAAAQAAABigAwAEAAAAAQAAABgAAAAAwf1XlwAAAaNJREFUSA3FlT1LA0EQQBN/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": { + "@alice.simplex": { + "formattedText": [ + { + "format": { + "nameInfo": { + "nameDomain": { + "domain": "alice", + "nameTLD": "simplex", + "subDomain": [] + }, + "nameType": "contact" + }, + "type": "simplexName" + }, + "text": "@alice.simplex" + } + ] + } + }, + "uris": {} +} diff --git a/tests/fixtures/api/names/plan-known-failed.json b/tests/fixtures/api/names/plan-known-failed.json new file mode 100644 index 0000000000..d353142e9e --- /dev/null +++ b/tests/fixtures/api/names/plan-known-failed.json @@ -0,0 +1,268 @@ +{ + "commands": { + "/_connect plan 1 TEAM_LINK": { + "result": { + "connLink": { + "connFullLink": "connFullLink", + "connShortLink": "connShortLink" + }, + "connectionPlan": { + "groupLinkPlan": { + "groupInfo": { + "chatSettings": { + "enableNtfs": "all", + "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": "off" + }, + "timedMessages": { + "enable": "off", + "ttl": 86400 + }, + "voice": { + "enable": "on" + } + }, + "groupDomainVerified": "failed", + "groupId": 1, + "groupProfile": { + "displayName": "team", + "fullName": "", + "groupPreferences": { + "directMessages": { + "enable": "on" + }, + "history": { + "enable": "on" + }, + "support": { + "enable": "off" + } + }, + "publicGroup": { + "groupLink": "groupLink", + "groupType": "channel", + "publicGroupAccess": { + "allowEmbedding": false, + "domainWebPage": false, + "groupDomainClaim": { + "domain": "team.simplex" + } + }, + "publicGroupId": "publicGroupId" + } + }, + "groupSummary": { + "currentMembers": 3, + "publicMemberCount": 2 + }, + "localAlias": "", + "localDisplayName": "team", + "membersRequireAttention": 0, + "membership": { + "blockedByAdmin": false, + "createdAt": "1970-01-01T00:00:00Z", + "groupId": 1, + "groupMemberId": 1, + "indexInGroup": 0, + "invitedBy": { + "type": "unknown" + }, + "localDisplayName": "bob", + "memberCategory": "user", + "memberChatVRange": { + "maxVersion": 22, + "minVersion": 9 + }, + "memberContactId": 1, + "memberContactProfileId": 1, + "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/gBdRAEVCCaFkURooOsoG5Y4KQkWg2KidqDxUCaoa1YTqQvWj7qAmUPOoD2gsmoqWQWugTdGOaF80E52I3okuQJeh69Bt6D70HfQkegH9GUPBSGD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": { + "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" + }, + "memberPubKey": "memberPubKey", + "memberRole": "observer", + "memberSettings": { + "showMessages": true + }, + "memberStatus": "connected", + "updatedAt": "1970-01-01T00:00:00Z" + }, + "preparedGroup": { + "connLinkPreparedConnection": true, + "connLinkStartedConnection": true, + "connLinkToConnect": { + "connFullLink": "connFullLink", + "connShortLink": "connShortLink" + } + }, + "updatedAt": "1970-01-01T00:00:00Z", + "useRelays": true, + "userMemberProfileSentAt": "1970-01-01T00:00:00Z", + "viaGroupLinkUri": "viaGroupLinkUri" + }, + "groupUpdated": false, + "linkOwners": [], + "type": "known" + }, + "type": "groupLink" + }, + "type": "connectionPlan", + "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/9nCISFJzEBgIIRTGey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AAAAIAAGHaQAEAAAAAQAAABoAAAAAAAKgAgAEAAAAAQAAABigAwAEAAAAAQAAABgAAAAAwf1XlwAAAaNJREFUSA3FlT1LA0EQQBN/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": { + "TEAM_LINK": { + "formattedText": [ + { + "format": { + "linkType": "channel", + "simplexUri": "simplexUri", + "smpHosts": [ + "localhost" + ], + "type": "simplexLink" + }, + "text": "TEAM_LINK" + } + ] + } + }, + "uris": {} +} diff --git a/tests/fixtures/api/names/plan-old-channel.json b/tests/fixtures/api/names/plan-old-channel.json new file mode 100644 index 0000000000..59315987fe --- /dev/null +++ b/tests/fixtures/api/names/plan-old-channel.json @@ -0,0 +1,269 @@ +{ + "commands": { + "/_connect plan 1 TEAM_LINK": { + "result": { + "connLink": { + "connFullLink": "connFullLink", + "connShortLink": "connShortLink" + }, + "connectionPlan": { + "groupLinkPlan": { + "groupInfo": { + "chatSettings": { + "enableNtfs": "all", + "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": "off" + }, + "timedMessages": { + "enable": "off", + "ttl": 86400 + }, + "voice": { + "enable": "on" + } + }, + "groupDomainVerified": "moved", + "groupId": 1, + "groupProfile": { + "displayName": "team", + "fullName": "", + "groupPreferences": { + "directMessages": { + "enable": "on" + }, + "history": { + "enable": "on" + }, + "support": { + "enable": "off" + } + }, + "publicGroup": { + "groupLink": "groupLink", + "groupType": "channel", + "publicGroupAccess": { + "allowEmbedding": false, + "domainWebPage": false, + "groupDomainClaim": { + "domain": "team.simplex" + } + }, + "publicGroupId": "publicGroupId" + } + }, + "groupSummary": { + "currentMembers": 3, + "publicMemberCount": 1 + }, + "localAlias": "", + "localDisplayName": "team", + "membersRequireAttention": 0, + "membership": { + "blockedByAdmin": false, + "createdAt": "1970-01-01T00:00:00Z", + "groupId": 1, + "groupMemberId": 1, + "indexInGroup": 0, + "invitedBy": { + "type": "unknown" + }, + "localDisplayName": "bob", + "memberCategory": "user", + "memberChatVRange": { + "maxVersion": 22, + "minVersion": 9 + }, + "memberContactId": 1, + "memberContactProfileId": 1, + "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/gBdRAEVCCaFkURooOsoG5Y4KQkWg2KidqDxUCaoa1YTqQvWj7qAmUPOoD2gsmoqWQWugTdGOaF80E52I3okuQJeh69Bt6D70HfQkegH9GUPBSGDUMSYYJ0wAJhKThsnFlGBqMK2Yq5h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nCKOfXit6TfVqZznlGelcxIz9TP6s5emLOfG3q+8fn0C9aL5fnc3/l/r3ip8vL8H5Z/DCwELEy/Yr/ivC54I/qm9q3+295Fj8Un7+LfLS/lvRd9X/eB/qH/o//HmeW0FdxK6SfVT12fXT4/4sRzOCwGm7FqBVBIwhERALyuBYASCAB1CPEPG9f8119+BvrK2fyNwVndL5jhvubRVsMQgCakeCFp04OsQ1LJEgAe5NodqT6WANbT+yf/iqQIPd21PXgaAcDJcjivtwJAQHLFgcNZ9uBwPlUgYhHf1z37f7V9g9e8ITewiP88wfWIYET6HPg21nzjV2fybQVcxfrg2/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": 1, + "shortDescr": "Bob" + }, + "memberPubKey": "memberPubKey", + "memberRole": "observer", + "memberSettings": { + "showMessages": true + }, + "memberStatus": "connected", + "updatedAt": "1970-01-01T00:00:00Z" + }, + "preparedGroup": { + "connLinkPreparedConnection": true, + "connLinkStartedConnection": true, + "connLinkToConnect": { + "connFullLink": "connFullLink", + "connShortLink": "connShortLink" + } + }, + "rosterVersion": 0, + "updatedAt": "1970-01-01T00:00:00Z", + "useRelays": true, + "userMemberProfileSentAt": "1970-01-01T00:00:00Z", + "viaGroupLinkUri": "viaGroupLinkUri" + }, + "groupUpdated": false, + "linkOwners": [], + "type": "known" + }, + "type": "groupLink" + }, + "type": "connectionPlan", + "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/9nCISFJzEBgIIRTGey2MkILkawT1oyi4tnEUx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AQAAABoAAAAAAAKgAgAEAAAAAQAAABigAwAEAAAAAQAAABgAAAAAwf1XlwAAAaNJREFUSA3FlT1LA0EQQBN/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": { + "TEAM_LINK": { + "formattedText": [ + { + "format": { + "linkType": "channel", + "simplexUri": "simplexUri", + "smpHosts": [ + "localhost" + ], + "type": "simplexLink" + }, + "text": "TEAM_LINK" + } + ] + } + }, + "uris": {} +} diff --git a/tests/fixtures/api/names/plan-own-channel-expired.json b/tests/fixtures/api/names/plan-own-channel-expired.json new file mode 100644 index 0000000000..7b8cf00ac8 --- /dev/null +++ b/tests/fixtures/api/names/plan-own-channel-expired.json @@ -0,0 +1,282 @@ +{ + "commands": { + "/_connect plan 1 #team.simplex": { + "result": { + "connLink": { + "connFullLink": "connFullLink", + "connShortLink": "connShortLink" + }, + "connectionPlan": { + "groupLinkPlan": { + "groupInfo": { + "chatSettings": { + "enableNtfs": "all", + "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": "off" + }, + "timedMessages": { + "enable": "off", + "ttl": 86400 + }, + "voice": { + "enable": "on" + } + }, + "groupDomainVerified": "verified", + "groupId": 1, + "groupProfile": { + "displayName": "team", + "fullName": "", + "groupPreferences": { + "directMessages": { + "enable": "on" + }, + "history": { + "enable": "on" + }, + "support": { + "enable": "off" + } + }, + "publicGroup": { + "groupLink": "groupLink", + "groupType": "channel", + "publicGroupAccess": { + "allowEmbedding": false, + "domainWebPage": false, + "groupDomainClaim": { + "domain": "team.simplex" + } + }, + "publicGroupId": "publicGroupId" + } + }, + "groupSummary": { + "currentMembers": 3, + "publicMemberCount": 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" + }, + "rosterVersion": 0, + "updatedAt": "1970-01-01T00:00:00Z", + "useRelays": true, + "userMemberProfileSentAt": "1970-01-01T00:00:00Z" + }, + "type": "ownLink" + }, + "nameChange": { + "nameWarning": { + "expiredAt": "2026-01-01T12:00:00Z", + "graceUntil": "2099-01-01T12:00:00Z", + "type": "expired" + }, + "type": "lapsed" + }, + "type": "groupLink" + }, + "planSimplexName": { + "nameDomain": { + "domain": "team", + "nameTLD": "simplex", + "subDomain": [] + }, + "nameType": "publicGroup" + }, + "type": "connectionPlan", + "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 + } + } + } + }, + "markdown": { + "#team.simplex": { + "formattedText": [ + { + "format": { + "nameInfo": { + "nameDomain": { + "domain": "team", + "nameTLD": "simplex", + "subDomain": [] + }, + "nameType": "publicGroup" + }, + "type": "simplexName" + }, + "text": "#team.simplex" + } + ] + } + }, + "uris": { + "https://simplex.domains/#testing": { + "parseError": "", + "uriInfo": { + "scheme": "https" + } + } + } +} diff --git a/tests/fixtures/api/names/plan-own-expired-no-grace.json b/tests/fixtures/api/names/plan-own-expired-no-grace.json new file mode 100644 index 0000000000..129cddbfc9 --- /dev/null +++ b/tests/fixtures/api/names/plan-own-expired-no-grace.json @@ -0,0 +1,129 @@ +{ + "commands": { + "/_connect plan 1 @alice.simplex": { + "result": { + "connLink": { + "connFullLink": "connFullLink", + "connShortLink": "connShortLink" + }, + "connectionPlan": { + "contactAddressPlan": { + "type": "ownLink" + }, + "nameChange": { + "nameWarning": { + "expiredAt": "2026-01-01T12:00:00Z", + "type": "expired" + }, + "type": "lapsed" + }, + "type": "contactAddress" + }, + "planSimplexName": { + "nameDomain": { + "domain": "alice", + "nameTLD": "simplex", + "subDomain": [] + }, + "nameType": "contact" + }, + "type": "connectionPlan", + "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": { + "contactDomain": { + "domain": "alice.simplex" + }, + "contactLink": "contactLink", + "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 + } + } + } + }, + "markdown": { + "@alice.simplex": { + "formattedText": [ + { + "format": { + "nameInfo": { + "nameDomain": { + "domain": "alice", + "nameTLD": "simplex", + "subDomain": [] + }, + "nameType": "contact" + }, + "type": "simplexName" + }, + "text": "@alice.simplex" + } + ] + } + }, + "uris": {} +} From 4eeddce11da25cc6014edef6d973362c92c5593e Mon Sep 17 00:00:00 2001 From: "Evgeny @ SimpleX Chat" <259188159+evgeny-simplex@users.noreply.github.com> Date: Tue, 17 Nov 2026 20:47:18 +0000 Subject: [PATCH 3/3] core, ui: chatItemUpdated event has the previous item (#8219) * core, ui: chatItemUpdated event has the previous item Apps change counters by the difference between the previous and the new item, and insert an updated item only when the update created it. * core, ui: a recreated item is sent as newChatItems An update of a locally deleted message creates it again and sends it as a new item, so chatItemUpdated always has the previous item and the apps never insert on an update. * core, ui: previous item is optional and has no chat info Events from older remote hosts decode without it; the apps then insert the item if it is not loaded and change no counters. * core: catch-up subscriber gets an edited history post as a new item * ui: updates in another profile do not notify, as on iOS * core, ui: one type for the updated item and its previous version AChatItemUpdate has the chat info, the new item and the previous item with the same chat type and direction. Its JSON is the JSON of AChatItem with an optional prevChatItem; the event keeps the key chatItem. * core: tested event key, previous item reactions, cleared mentions One function renames the event field to chatItem for JSON and docs, and the test checks the wire key and compatibility with AChatItem. The previous item of a direct edit has its reactions. An edit that removes all mentions sends the item without them. * core: test that an edit removing mentions sends the item without them * core: event JSON field mapping inline in the TH options, for the Windows build * core: file chat item update checked in one store transaction * core: test that a file reset by unknown relays sends its previous item * core, ui: chatItemUpdated event key chatItemUpdate * core, ui: chatItemUpdated always has the previous item * ci: mcp scope tests the plugin with its published dependencies * core: mention of the user follows edits of a group message * core: previous item of a prohibited file is read before the prohibition * android, desktop: missed call check inline, counter test with core pairs * ios: spec link of the chatItemUpdated event * core: mention edits in support chats update members requiring attention * core: one rule for the mention of the user in received and edited items * core: record item events of updates for app tests * android, desktop: remove the missed call notification of updates, never shown * android, desktop: test item updates on events recorded by the core * ios: test item updates on events recorded by the core * docs: plan of app tests of item updates, recording tests in the CI guide * core: record the response to an update after its item status is final * ios: notification manager replaceable in tests * ios: test notifications of updates and the update response * android, desktop: test the recorded update response * docs: plan with iOS notifications and the update response * core: recorded response to an update of a sent message --- apps/ios/Shared/Model/AppAPITypes.swift | 4 +- apps/ios/Shared/Model/ChatModel.swift | 46 +- apps/ios/Shared/Model/NtfManager.swift | 4 +- apps/ios/Shared/Model/SimpleXAPI.swift | 25 +- .../ChatItemUpdateTests.swift | 211 +++ .../SimpleX Unit Tests/NameAlertsTests.swift | 34 +- apps/ios/SimpleX.xcodeproj/project.pbxproj | 4 + apps/ios/SimpleXChat/ChatTypes.swift | 10 + apps/ios/spec/api.md | 2 +- apps/ios/spec/services/notifications.md | 4 +- apps/ios/spec/state.md | 13 + .../chat/simplex/common/model/ChatModel.kt | 87 +- .../chat/simplex/common/model/SimpleXAPI.kt | 33 +- .../chat/simplex/app/ChatItemUpdateTest.kt | 198 +++ .../kotlin/chat/simplex/app/NameAlertsTest.kt | 4 +- apps/multiplatform/spec/api.md | 2 +- .../spec/services/notifications.md | 2 +- apps/multiplatform/spec/state.md | 1 + .../src/Directory/Events.hs | 2 +- bots/api/EVENTS.md | 4 +- bots/api/TYPES.md | 13 + bots/src/API/Docs/Events.hs | 2 +- bots/src/API/Docs/Types.hs | 1 + .../types/typescript/src/events.ts | 2 +- .../types/typescript/src/types.ts | 7 + .../simplex-chat-nodejs/tests/live.test.ts | 4 +- .../src/simplex_chat/types/_events.py | 2 +- .../src/simplex_chat/types/_types.py | 7 + plans/2026-11-17-update-event-fixtures.md | 73 + scripts/ci/README.md | 14 +- scripts/ci/packages_release.py | 6 +- scripts/ci/scope-tests.sh | 3 - scripts/ci/test_packages_release.py | 4 +- src/Simplex/Chat/Controller.hs | 2 +- src/Simplex/Chat/Library/Commands.hs | 4 +- src/Simplex/Chat/Library/Internal.hs | 43 +- src/Simplex/Chat/Library/Subscriber.hs | 62 +- src/Simplex/Chat/Messages.hs | 28 + src/Simplex/Chat/Store/Messages.hs | 45 +- src/Simplex/Chat/Terminal/Output.hs | 4 +- src/Simplex/Chat/View.hs | 2 +- tests/ChatTests/Direct.hs | 67 +- tests/ChatTests/Files.hs | 40 +- tests/ChatTests/Groups.hs | 72 +- tests/ChatTests/Utils.hs | 20 +- tests/fixtures/api/updates/direct-edit.json | 1240 +++++++++++++++++ .../api/updates/direct-recreated.json | 297 ++++ tests/fixtures/api/updates/group-mention.json | 1154 +++++++++++++++ tests/fixtures/api/updates/missed-call.json | 615 ++++++++ .../fixtures/api/updates/update-response.json | 302 ++++ 50 files changed, 4641 insertions(+), 184 deletions(-) create mode 100644 apps/ios/SimpleX Unit Tests/ChatItemUpdateTests.swift create mode 100644 apps/multiplatform/common/src/desktopTest/kotlin/chat/simplex/app/ChatItemUpdateTest.kt create mode 100644 plans/2026-11-17-update-event-fixtures.md create mode 100644 tests/fixtures/api/updates/direct-edit.json create mode 100644 tests/fixtures/api/updates/direct-recreated.json create mode 100644 tests/fixtures/api/updates/group-mention.json create mode 100644 tests/fixtures/api/updates/missed-call.json create mode 100644 tests/fixtures/api/updates/update-response.json 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/zDpz9ttzz7n73ffWmg0A6QCDxYqD+QCIT0hmezlYywQEBsngngEYCAIy0AC6DGYSy8rDwxUg8Xf9d7wbAxC33tHgzvrP3/9nCISFJzEBgIIRTGey2MkILkawT1oyi4tnEUxjI6IQvMLFkauYqxjQQtewwuoaHy8bBNMBwJMZDHYkAERbhJdJZUYic4hhCNZOCItOQDB3vjkzioFwxLsIXhcRl5IOAImrRzs+fivCk7QRrIL0shAcwNUW+tX8yH/tFfr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axED/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/zDpz9ttzz7n73ffWmg0A6QCDxYqD+QCIT0hmezlYywQEBsngngEYCAIy0AC6DGYSy8rDwxUg8Xf9d7wbAxC33tHgzvrP3/9nCISFJzEBgIIRTGey2MkILkawT1oyi4tnEUxjI6IQvMLFkauYqxjQQtewwuoaHy8bBNMBwJMZDHYkAERbhJdJZUYic4hhCNZOCItOQDB3vjkzioFwxLsIXhcRl5IOAImrRzs+fivCk7QRrIL0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8ABtttBBCsLGzsLG2sxaxED/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,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAKHGlDQ1BJQ0MgUHJvZml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m7FqBVBIwhERALyuBYASCAB1CPEPG9f8119+BvrK2fyNwVndL5jhvubRVsMQgCakeCFp04OsQ1LJEgAe5NodqT6WANbT+yf/iqQIPd21PXgaAcDJcjivtwJAQHLFgcNZ9uBwPlUgYhHf1z37f7V9g9e8ITewiP88wfWIYET6HPg21nzjV2fybQVcxfrg2/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": "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,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAKH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K6SfVT12fXT4/4sRzOCwGm7FqBVBIwhERALyuBYASCAB1CPEPG9f8119+BvrK2fyNwVndL5jhvubRVsMQgCakeCFp04OsQ1LJEgAe5NodqT6WANbT+yf/iqQIPd21PXgaAcDJcjivtwJAQHLFgcNZ9uBwPlUgYhHf1z37f7V9g9e8ITewiP88wfWIYET6HPg21nzjV2fybQVcxfrg2/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, 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/tFfrPXgxG5D84Pi6F+dc9ck+HHJ7g641UMSQlQATQBHEgBaQDGcACbLAVYaIRJhx5Dv+9j77aZ4OsZIFtSEc0iARRIBnpt/9qlvfqpGSQBhjImnCEcUU+NtxnujZy4fbqVEiU/wuXdQyA9S0cDqfzC+e2F4DzyLkSB79wyi0A8KoBcL2GmcJOXePQ3C8MIAJeQAOiQArIAxXuWwMMgSmwBHbAGbgDHxAINgMmojceUZ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EKudKn8YvQIOOe+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,iVBORw0KGgoAAAANSUhEUgAAABgAA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X/eB/qH/o//HmeW0FdxK6SfVT12fXT4/4sRzOCwGm7FqBVBIwhERALyuBYASCAB1CPEPG9f8119+BvrK2fyNwVndL5jhvubRVsMQgCakeCFp04OsQ1LJEgAe5NodqT6WANbT+yf/iqQIPd21PXgaAcDJcjivtwJAQHLFgcNZ9uBwPlUgYhHf1z37f7V9g9e8ITewiP88wfWIYET6HPg21nzjV2fybQVcxfrg2/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" + }, + "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+e2F4DzyLkSB79wyi0A8KoBcL2GmcJOXePQ3C8MIAJeQAOiQArIAxXuWwMMgSmwBHbAGbgDHxAINgMmojceUZUGMkEWyAX54AA4DMpAJTgJ6sAZ0ALawQVwGVwDt8AQGAUPwQSYBi/AAngHliEIwkEUiAqJQtKQIqQO6UJ0yByyg1whLygQCoEioQQoBcqE9kD5UBFUBlVB9dBPUCd0GboBDUP3oUloDnoNfYRRMBmmwZKwEqwF02Er2AX2gTfBkX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jtPhWLKodjCtefZiEeZeVZWWSndgwj6fVf3XON8Qwq15++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/AAngHliEIwkEUiAqJQtKQIqQO6UJ0yByyg1whLygQCoEioQQoBcqE9kD5UBFUBlVB9dBPUCd0GboBDUP3oUloDnoNfYRRMBmmwZKwEqwF02Er2AX2gTfBkXAinAHnwPvhUrgaPg23wZfhW/AoPAG/gBdRAEVCCaFkURooOsoG5Y4KQkWg2KidqDxUCaoa1YTqQvWj7qAmUPOoD2gsmoqWQWugTdGOaF80E52I3okuQJeh69Bt6D70HfQkegH9GUPBSGDUMSYYJ0wAJhKThsnFlGBqMK2Yq5hRzDTmHRaLFcIqY42wjthAbAx2O7YAewzbjO3BD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8fn0C9aL5fnc3/l/r3ip8vL8H5Z/DCwELEy/Yr/ivC54I/qm9q3+295Fj8Un7+LfLS/lvRd9X/eB/qH/o//HmeW0FdxK6SfVT12fXT4/4sRzOCwGm7FqBVBIwhERALyuBYASCAB1CPEPG9f8119+BvrK2fyNwVndL5jhvubRVsMQgCakeCFp04OsQ1LJEgAe5NodqT6WANbT+yf/iqQIPd21PXgaAcDJcjivtwJAQHLFgcNZ9uBwPlUgYhHf1z37f7V9g9e8ITewiP88wfWIYET6HPg21nzjV2fybQVcxfrg2/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" + }, + "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/9qlvfqpGSQBhjImnCEcUU+NtxnujZy4fbqVEiU/wuXdQyA9S0cDqfzC+e2F4DzyLkSB79wyi0A8KoBcL2GmcJOXePQ3C8MIAJeQAOiQArIAxXuWwMMgSmwBHbAGbgDHxAINgMmojceUZUGMkEWyAX54AA4DMpAJTgJ6sAZ0ALawQVwGVwDt8AQGAUPwQSYBi/AAngHliEIwkEUiAqJQtKQIqQO6UJ0yByyg1whLygQCo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JyDnNLXwbdiWUZi0fUK01Eoc+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,iVBORw0KGgoAAAANSUhEUgAAABgA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9X/eB/qH/o//HmeW0FdxK6SfVT12fXT4/4sRzOCwGm7FqBVBIwhERALyuBYASCAB1CPEPG9f8119+BvrK2fyNwVndL5jhvubRVsMQgCakeCFp04OsQ1LJEgAe5NodqT6WANbT+yf/iqQIPd21PXgaAcDJcjivtwJAQHLFgcNZ9uBwPlUgYhHf1z37f7V9g9e8ITewiP88wfWIYET6HPg21nzjV2fybQVcxfrg2/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" + }, + "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/AAngHliEIwkEUiAqJQtKQIqQO6UJ0yByyg1whLygQCoEioQQoBcqE9kD5UBFUBlVB9dBPUCd0GboBDUP3oUloDnoNfYRRMBmmwZKwEqwF02Er2AX2gTfBkXAinAHnwPvhUrgaPg23wZfhW/AoPAG/gBdRAEVCCaFkURooOsoG5Y4KQkWg2KidqDxUCaoa1YTqQvWj7qAmUPOoD2gsmoqWQWugTdGOaF80E52I3okuQJeh69Bt6D70HfQkegH9GUPBSGDUMSYYJ0wAJhKThsnFlGBqMK2Yq5hRzDTmHRaLFcIqY42wjthAbAx2O7YAewzbjO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3q+8fn0C9aL5fnc3/l/r3ip8vL8H5Z/DCwELEy/Yr/ivC54I/qm9q3+295Fj8Un7+LfLS/lvRd9X/eB/qH/o//HmeW0FdxK6SfVT12fXT4/4sRzOCwGm7FqBVBIwhERALyuBYASCAB1CPEPG9f8119+BvrK2fyNwVndL5jhvubRVsMQgCakeCFp04OsQ1LJEgAe5NodqT6WANbT+yf/iqQIPd21PXgaAcDJcjivtwJAQHLFgcNZ9uBwPlUgYhHf1z37f7V9g9e8ITewiP88wfWIYET6HPg21nzjV2fybQVcxfrg2/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": 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+9j77aZ4OsZIFtSEc0iARRIBnpt/9qlvfqpGSQBhjImnCEcUU+NtxnujZy4fbqVEiU/wuXdQyA9S0cDqfzC+e2F4DzyLkSB79wyi0A8KoBcL2GmcJOXePQ3C8MIAJeQAOiQArIAxXuWwMMgSmwBHbAGbgDHxAINgMmojceUZUGMkEWyAX54AA4DMpAJTgJ6sAZ0ALawQVwGVwDt8AQGAUPwQSYBi/AA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buZWKKxzYYEJc2xp9AUUjGt8KC2jvgYadF8+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/9nCISFJzEBgIIRTGey2MkILkawT1oyi4tnEUxjI6IQvMLFkauYqxjQQtewwuoaHy8bBNMBwJMZDHYkAERbhJdJZUYic4hhCNZOCItOQDB3vjkzioFwxLsIXhcRl5IOAImrRzs+fivCk7QRrIL0shAcwNUW+tX8yH/tFfrPXgxG5D84Pi6F+dc9ck+HHJ7g641UMSQlQATQBHEgBaQDGcACbLAVYaIRJhx5Dv+9j77aZ4OsZIFtSEc0iARR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GSw2mE1iUwT18gpI74WvkGlccu4XNdH0jnYU7cAUacidn37qR23cOxc4aGU0nYUAn7iSWEHkz46w0ocdQu1X6B/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": {} +}