Skip to content

Commit

Permalink
Communication: Remove announcements from unresolved filter (#9561)
Browse files Browse the repository at this point in the history
  • Loading branch information
cremertim authored Oct 24, 2024
1 parent cf918b3 commit 982060f
Showing 1 changed file with 12 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import { faCircleNotch, faEnvelope, faFilter, faLongArrowAltDown, faLongArrowAlt
import { FormBuilder, FormGroup } from '@angular/forms';
import { Subject, takeUntil } from 'rxjs';
import { Course } from 'app/entities/course.model';
import { getAsChannelDTO } from 'app/entities/metis/conversation/channel.model';
import { ChannelDTO, getAsChannelDTO } from 'app/entities/metis/conversation/channel.model';
import { Post } from 'app/entities/metis/post.model';
import { MetisService } from 'app/shared/metis/metis.service';
import { MetisConversationService } from 'app/shared/metis/metis-conversation.service';
Expand Down Expand Up @@ -150,10 +150,20 @@ export class CourseWideSearchComponent implements OnInit, AfterViewInit, OnDestr
pageSize: 50,
};
this.metisConversationService.conversationsOfUser$.pipe(takeUntil(this.ngUnsubscribe)).subscribe((conversations: ConversationDTO[]) => {
this.currentPostContextFilter!.courseWideChannelIds = conversations.map((conversation) => conversation!.id!);
this.currentPostContextFilter!.courseWideChannelIds = conversations
.filter((conversation) => !(this.currentPostContextFilter?.filterToUnresolved && this.conversationIsAnnouncement(conversation)))
.map((conversation) => conversation.id!);
});
}

conversationIsAnnouncement(conversation: ConversationDTO) {
if (conversation.type === 'channel') {
const channel = conversation as ChannelDTO;
return channel.isAnnouncementChannel;
}
return false;
}

postsTrackByFn = (index: number, post: Post): number => post.id!;

setPostForThread(post: Post) {
Expand Down

0 comments on commit 982060f

Please sign in to comment.