Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Communication: Remove announcements from unresolved filter #9561

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading