Skip to content

Commit

Permalink
chat: better order (fixes #7383) (#7384)
Browse files Browse the repository at this point in the history
Co-authored-by: dogi <[email protected]>
  • Loading branch information
Mutugiii and dogi authored Dec 22, 2023
1 parent 5640e00 commit e145ec2
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"name": "planet",
"license": "AGPL-3.0",
"version": "0.13.96",
"version": "0.13.97",
"myplanet": {
"latest": "v0.12.24",
"latest": "v0.12.28",
"min": "v0.11.60"
},
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion src/app/chat/chat-sidebar/chat-sidebar.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
</div>
<ng-container *ngIf="filteredConversations?.length; else noChats">
<ul>
<li *ngFor="let conversation of filteredConversations.reverse(); let i = index" (click)="selectConversation(conversation)">
<li *ngFor="let conversation of filteredConversations; let i = index" (click)="selectConversation(conversation)">
<ng-container *ngIf="isEditing; else notEditing">
<ng-container *ngIf="selectedConversation?._id === conversation?._id; else conversationTitle">
<form [formGroup]="titleForm[conversation?._id]" (ngSubmit)="submitTitle(conversation)">
Expand Down
9 changes: 7 additions & 2 deletions src/app/chat/chat-sidebar/chat-sidebar.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,13 @@ export class ChatSidebarComponent implements OnInit, OnDestroy {

getChatHistory() {
this.chatService.findConversations([], [ this.userService.get().name ]).subscribe(
(conversations) => {
this.conversations = conversations;
(conversations: any) => {
this.conversations = conversations.sort((a, b) => {
const dateA = a.updatedDate || a.createdDate;
const dateB = b.updatedDate || b.createdDate;

return dateB - dateA;
});
this.filteredConversations = [ ...conversations ];
this.initializeFormGroups();
},
Expand Down

0 comments on commit e145ec2

Please sign in to comment.