diff --git a/src/main/webapp/app/overview/course-conversations/course-wide-search/course-wide-search.component.ts b/src/main/webapp/app/overview/course-conversations/course-wide-search/course-wide-search.component.ts index 9e07517c3f8a..7c4ce294e0ac 100644 --- a/src/main/webapp/app/overview/course-conversations/course-wide-search/course-wide-search.component.ts +++ b/src/main/webapp/app/overview/course-conversations/course-wide-search/course-wide-search.component.ts @@ -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'; @@ -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) {