feat(frontend): add compact anonymous conversation labels
Build and publish Docker images / Build and publish images (push) Successful in 2m48s

This commit is contained in:
2026-09-15 13:30:49 +08:00
parent 4d684a71eb
commit f79c80519d
6 changed files with 136 additions and 6 deletions
@@ -1,5 +1,6 @@
import {
filterDuplicateSourceMessages,
getConversationContactDisplayName,
getLastMessage,
getReadMessages,
getUnreadMessages,
@@ -37,6 +38,36 @@ describe('conversationHelper', () => {
});
});
describe('#getConversationContactDisplayName', () => {
it('formats a geolocated anonymous visitor with a base36 session code', () => {
expect(
getConversationContactDisplayName(
{
name: '河北邯郸客户',
additional_attributes: {
visitor_name_source: 'ip_geolocation',
visitor_province: '河北',
visitor_city: '邯郸',
},
},
1296
)
).toBe('河北邯郸·100');
});
it('uses the anonymous label when location is unavailable', () => {
expect(
getConversationContactDisplayName({ name: '商务通访客' }, 36)
).toBe('匿名10');
});
it('keeps a real contact name unchanged', () => {
expect(getConversationContactDisplayName({ name: '张三' }, 1296)).toBe(
'张三'
);
});
});
describe('#readMessages', () => {
it('should return read messages if conversation is passed', () => {
expect(