Skip to content

Commit

Permalink
Communication: Fix sidebar refresh issue after channel deletion (#9271)
Browse files Browse the repository at this point in the history
  • Loading branch information
asliayk authored and JohannesWt committed Sep 23, 2024
1 parent adf0e5f commit 9575b81
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
}
<div class="col flex-grow-1 module-bg rounded-3 scrollable-content" [ngClass]="{ 'content-height-dev': !isProduction || isTestServer }" style="min-width: 200px">
@if (activeConversation) {
<jhi-conversation-header (collapseSearch)="toggleChannelSearch()" />
<jhi-conversation-header (collapseSearch)="toggleChannelSearch()" (onUpdateSidebar)="prepareSidebarData()" />
<jhi-conversation-messages
[contentHeightDev]="!isProduction || isTestServer"
(openThread)="postInThread = $event"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -260,9 +260,13 @@ export class CourseConversationsComponent implements OnInit, OnDestroy {
}

prepareSidebarData() {
this.sidebarConversations = this.courseOverviewService.mapConversationsToSidebarCardElements(this.conversationsOfUser);
this.accordionConversationGroups = this.courseOverviewService.groupConversationsByChannelType(this.conversationsOfUser, this.messagingEnabled);
this.updateSidebarData();
this.metisConversationService.forceRefresh().subscribe({
complete: () => {
this.sidebarConversations = this.courseOverviewService.mapConversationsToSidebarCardElements(this.conversationsOfUser);
this.accordionConversationGroups = this.courseOverviewService.groupConversationsByChannelType(this.conversationsOfUser, this.messagingEnabled);
this.updateSidebarData();
},
});
}

updateSidebarData() {
Expand Down Expand Up @@ -308,9 +312,6 @@ export class CourseConversationsComponent implements OnInit, OnDestroy {
.subscribe((chatPartners: UserPublicInfoDTO[]) => {
this.metisConversationService.createGroupChat(chatPartners?.map((partner) => partner.login!)).subscribe({
complete: () => {
this.metisConversationService.forceRefresh().subscribe({
complete: () => {},
});
this.prepareSidebarData();
},
});
Expand All @@ -330,9 +331,6 @@ export class CourseConversationsComponent implements OnInit, OnDestroy {
if (chatPartner?.login) {
this.metisConversationService.createOneToOneChat(chatPartner.login).subscribe({
complete: () => {
this.metisConversationService.forceRefresh().subscribe({
complete: () => {},
});
this.prepareSidebarData();
},
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ export class ConversationHeaderComponent implements OnInit, OnDestroy {
private ngUnsubscribe = new Subject<void>();

@Output() collapseSearch = new EventEmitter<void>();
@Output() onUpdateSidebar = new EventEmitter<void>();

INFO = ConversationDetailTabs.INFO;
MEMBERS = ConversationDetailTabs.MEMBERS;
Expand Down Expand Up @@ -107,6 +108,7 @@ export class ConversationHeaderComponent implements OnInit, OnDestroy {
this.metisConversationService.forceRefresh().subscribe({
complete: () => {},
});
this.onUpdateSidebar.emit();
});
}

Expand Down

0 comments on commit 9575b81

Please sign in to comment.