Skip to content

Commit 7053b64

Browse files
authored
Merge pull request #293 from GetStream/avatar-fix
fix: id fallback fall channel member names in avatar
2 parents 5a2089b + 004806a commit 7053b64

File tree

3 files changed

+6
-3
lines changed

3 files changed

+6
-3
lines changed

docusaurus/docs/Angular/components/ChannelPreviewComponent.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
The `ChannelPreview` component displays a channel preview in the channel list, it consists of the image, name and latest message of the channel.
1+
The `ChannelPreview` component displays a channel preview in the channel list, it consists of the image, name (or list of members if name isn't defined) and latest message of the channel.
22

33
## Customization
44

projects/stream-chat-angular/src/lib/avatar/avatar.component.spec.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,10 @@ describe('AvatarComponent', () => {
150150

151151
expect(component.initials).toBe('J');
152152

153+
delete channel.state.members['otheruser'].user!.name;
154+
155+
expect(component.initials).toBe('o');
156+
153157
channel.state.members = {
154158
otheruser: {
155159
user_id: 'otheruser',

projects/stream-chat-angular/src/lib/avatar/avatar.component.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,7 @@ export class AvatarComponent {
6363
(m) => m.user_id !== this.chatClientService.chatClient.user?.id
6464
);
6565
if (otherMembers.length === 1) {
66-
result =
67-
otherMembers[0].user?.name || otherMembers[0].user?.name || '';
66+
result = otherMembers[0].user?.name || otherMembers[0].user?.id || '';
6867
} else {
6968
result = '#';
7069
}

0 commit comments

Comments
 (0)