refactor(LxmfUserIcon): remove seed property and related color generation logic; add test for outbound location sharing

This commit is contained in:
Ivan committed 2026-05-03 14:04:00 -05:00
1 parent 3b5630474d
commit 82de472f2d
2 files changed
+19 -14

No files matched your search

@@ -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 "";
},
},
};
+18
View File
@@ -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 = {