telerik / kendo-angular

Issue tracker - Kendo UI for Angular
http://www.telerik.com/kendo-angular-ui/
Other
468 stars 217 forks source link

Conversational UI not displaying messages #3177

Closed Ryukote closed 3 years ago

Ryukote commented 3 years ago

Describe the bug ChatComponent does not recognize user object. user object is filled and passed to [user] inside but I get "ERROR Error: User must be set and have a valid id. at ChatComponent.ngAfterViewInit (index.js:537)" error. This error is causing ChatComponent to display 0 messages even tho I have messages.

I am using @progress/kendo-angular-conversational-ui@^2.0.2

To Reproduce Steps to reproduce the behavior:

This is how my html looks like:

<kendo-chat *ngIf="messageId && kendoMessages">
    [messages]="kendoMessages"
    [user]="currentUser"
</kendo-chat>
kendoMessages: Message[] = [];
currentUser: User;

where both Message and User interfaces are from Kendo package '@progress/kendo-angular-conversational-ui'.

this.currentUser = {
      id: decodedToken.userId,
      name: decodedToken.userName
};

currentUser is always filled, I can see it with breakpoint and nothing in the code is removing those values.

And this is the function I am using to convert messages from database to Kendo specific type:

private toKendoMessages(messages: IMessage[]): Message[] {
    const kendoMessages: Message[] = [];

    messages.map(message => {
      const user: User = {
        id: message.sender.id,
        name: `${message.sender.firstName} ${message.sender.lastName}`
      };

      kendoMessages.push({
        text: message.content,
        author: user,
        timestamp: message.createDate,
        typing: false,
      });
    });

    return kendoMessages;
}

Expected behavior Expected behavior is to display messages from collection. Both sender and receiver have their id set. Since Message interface only requires author of type User to be filled, I don't get what is the problem.

Screenshots

https://imgur.com/a/zZdn7V4

Browser

mbechev commented 3 years ago

Hi @Ryukote,

Could you please try to replicate the experienced issue in a runnable demo (like this one), so that we can determine if its a bug on our side or it is due to an incorrect configuration? Thank you in advance.

mbechev commented 3 years ago

Closing this issue due to inactivity.