Skip to content

Commit

Permalink
Communication: Add private channel icon to sidebar (#9150)
Browse files Browse the repository at this point in the history
  • Loading branch information
asliayk authored Aug 4, 2024
1 parent f88baae commit b05cb55
Showing 1 changed file with 17 additions and 4 deletions.
21 changes: 17 additions & 4 deletions src/main/webapp/app/overview/course-overview.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ import { cloneDeep } from 'lodash-es';
import { faGraduationCap } from '@fortawesome/free-solid-svg-icons';
import { ConversationDTO } from 'app/entities/metis/conversation/conversation.model';
import { ChannelSubType, getAsChannelDTO } from 'app/entities/metis/conversation/channel.model';
import { faBullhorn, faHashtag } from '@fortawesome/free-solid-svg-icons';
import { IconDefinition } from '@fortawesome/fontawesome-svg-core';
import { faBullhorn, faHashtag, faLock } from '@fortawesome/free-solid-svg-icons';
import { isOneToOneChatDTO } from 'app/entities/metis/conversation/one-to-one-chat.model';
import { isGroupChatDTO } from 'app/entities/metis/conversation/group-chat.model';
import { ConversationService } from 'app/shared/metis/conversations/conversation.service';
Expand Down Expand Up @@ -73,8 +74,9 @@ export class CourseOverviewService {
private conversationService: ConversationService,
) {}

faBullhorn = faBullhorn;
faHashtag = faHashtag;
readonly faBullhorn = faBullhorn;
readonly faHashtag = faHashtag;
readonly faLock = faLock;

getUpcomingTutorialGroup(tutorialGroups: TutorialGroup[] | undefined): TutorialGroup | undefined {
if (tutorialGroups && tutorialGroups.length) {
Expand Down Expand Up @@ -308,12 +310,23 @@ export class CourseOverviewService {
return examCardItem;
}

private getChannelIcon(conversation: ConversationDTO): IconDefinition {
const channelDTO = getAsChannelDTO(conversation);
if (channelDTO?.isPublic === false) {
return this.faLock;
} else if (channelDTO?.name === 'announcement') {
return this.faBullhorn;
} else {
return this.faHashtag;
}
}

mapConversationToSidebarCardElement(conversation: ConversationDTO): SidebarCardElement {
const conversationCardItem: SidebarCardElement = {
title: this.conversationService.getConversationName(conversation) ?? '',
id: conversation.id ?? '',
type: conversation.type,
icon: getAsChannelDTO(conversation)?.name === 'announcement' ? this.faBullhorn : this.faHashtag,
icon: this.getChannelIcon(conversation),
conversation: conversation,
size: 'S',
};
Expand Down

0 comments on commit b05cb55

Please sign in to comment.