From 82de472f2d17559a1a48511cfce45144ce6e9580 Mon Sep 17 00:00:00 2001 From: Ivan Date: Sun, 3 May 2026 14:04:00 -0500 Subject: [PATCH] refactor(LxmfUserIcon): remove seed property and related color generation logic; add test for outbound location sharing --- .../src/frontend/components/LxmfUserIcon.vue | 15 +-------------- tests/backend/test_lxmf_utils_extended.py | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+), 14 deletions(-) diff --git a/meshchatx/src/frontend/components/LxmfUserIcon.vue b/meshchatx/src/frontend/components/LxmfUserIcon.vue index b403ddb..fd00adb 100644 --- a/meshchatx/src/frontend/components/LxmfUserIcon.vue +++ b/meshchatx/src/frontend/components/LxmfUserIcon.vue @@ -51,10 +51,6 @@ export default { type: String, default: "", }, - seed: { - type: String, - default: "", - }, iconClass: { type: String, default: "", @@ -93,16 +89,7 @@ export default { if (this.iconBackgroundColour && this.iconBackgroundColour !== "") { return this.iconBackgroundColour; } - if (!this.seed) { - return ""; - } - // Simple deterministic color from seed string - let hash = 0; - for (let i = 0; i < this.seed.length; i++) { - hash = this.seed.charCodeAt(i) + ((hash << 5) - hash); - } - const h = Math.abs(hash % 360); - return `hsl(${h}, 35%, 85%)`; + return ""; }, }, }; diff --git a/tests/backend/test_lxmf_utils_extended.py b/tests/backend/test_lxmf_utils_extended.py index 850289d..a824626 100644 --- a/tests/backend/test_lxmf_utils_extended.py +++ b/tests/backend/test_lxmf_utils_extended.py @@ -354,6 +354,24 @@ def test_sidebar_preview_telemetry_location_incoming(): assert out == "Riley shared their location" +def test_sidebar_preview_telemetry_location_outbound_you(): + me = "c" * 32 + row = { + "content": "", + "fields": json.dumps( + {"telemetry": {"location": {"latitude": 1.0, "longitude": 2.0}}}, + ), + "is_incoming": 0, + "source_hash": me, + } + out = lxmf_sidebar_preview_for_conversation_latest_row( + row, + local_hash=me, + peer_display_name="Sam", + ) + assert out == "You shared your location" + + def test_sidebar_preview_location_request_outbound_you(): me = "c" * 32 row = {