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: Rename 'hidden' to 'archived' for conversations #10385

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
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 @@ -3,8 +3,8 @@ import { ChangeDetectorRef, Component, ElementRef, EventEmitter, HostListener, O
import { FormsModule } from '@angular/forms';
import { ActivatedRoute, Router } from '@angular/router';
import {
faBan,
faBookmark,
faBoxArchive,
faClock,
faComment,
faComments,
Expand Down Expand Up @@ -67,7 +67,7 @@ const DEFAULT_CHANNEL_GROUPS: AccordionGroups = {
lectureChannels: { entityData: [] },
examChannels: { entityData: [] },
feedbackDiscussion: { entityData: [] },
hiddenChannels: { entityData: [] },
archivedChannels: { entityData: [] },
savedPosts: { entityData: [] },
};

Expand All @@ -79,7 +79,7 @@ const CHANNEL_TYPE_ICON: ChannelTypeIcons = {
directMessages: faComment,
favoriteChannels: faHeart,
lectureChannels: faFile,
hiddenChannels: faBan,
archivedChannels: faBoxArchive,
feedbackDiscussion: faPersonChalkboard,
savedPosts: faBookmark,
recents: faClock,
Expand All @@ -93,7 +93,7 @@ const DEFAULT_COLLAPSE_STATE: CollapseState = {
directMessages: true,
favoriteChannels: false,
lectureChannels: true,
hiddenChannels: true,
archivedChannels: true,
feedbackDiscussion: true,
savedPosts: true,
recents: true,
Expand All @@ -107,7 +107,7 @@ const DEFAULT_SHOW_ALWAYS: SidebarItemShowAlways = {
directMessages: true,
favoriteChannels: true,
lectureChannels: false,
hiddenChannels: false,
archivedChannels: false,
feedbackDiscussion: false,
savedPosts: true,
recents: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,9 @@ export class ConversationMessagesComponent implements OnInit, AfterViewInit, OnD

private subscribeToActiveConversation() {
this.metisConversationService.activeConversation$.pipe(takeUntil(this.ngUnsubscribe)).subscribe((conversation: ConversationDTO) => {
if (this._activeConversation && getAsChannelDTO(conversation)?.isArchived !== getAsChannelDTO(this._activeConversation)?.isArchived) {
this._activeConversation = conversation;
}
// This statement avoids a bug that reloads the messages when the conversation is already displayed
if (conversation && this._activeConversation?.id === conversation.id) {
return;
Expand Down
4 changes: 2 additions & 2 deletions src/main/webapp/app/overview/course-overview.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ const DEFAULT_CHANNEL_GROUPS: AccordionGroups = {
lectureChannels: { entityData: [] },
examChannels: { entityData: [] },
feedbackDiscussion: { entityData: [] },
hiddenChannels: { entityData: [] },
archivedChannels: { entityData: [] },
};

@Injectable({
Expand Down Expand Up @@ -174,7 +174,7 @@ export class CourseOverviewService {
const groups: ChannelGroupCategory[] = [];

if (conversation.isHidden) {
groups.push('hiddenChannels');
groups.push('archivedChannels');
return groups;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@
: ('artemisApp.conversationsLayout.conversationSelectionSideBar.sideBarSection.mute' | artemisTranslate)
}}
</button>
<button class="hide" ngbDropdownItem (click)="onHiddenClicked($event)">
<fa-icon [icon]="conversation.isHidden ? faEye : faEyeSlash" size="sm" class="me-1" />
<button class="hide" ngbDropdownItem (click)="onArchiveClicked($event)">
<fa-icon [icon]="conversation.isHidden ? faBoxOpen : faBoxArchive" size="sm" class="me-1" />
{{
conversation.isHidden
? ('artemisApp.conversationsLayout.conversationSelectionSideBar.sideBarSection.show' | artemisTranslate)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { ChangeDetectionStrategy, Component, EventEmitter, Input, OnDestroy, OnI
import { ConversationDTO, shouldNotifyRecipient } from 'app/entities/metis/conversation/conversation.model';
import { ChannelDTO, getAsChannelDTO } from 'app/entities/metis/conversation/channel.model';
import { ConversationService } from 'app/shared/metis/conversations/conversation.service';
import { faEllipsisVertical, faEye, faEyeSlash, faGear, faHeart as faHearthSolid, faVolumeUp, faVolumeXmark } from '@fortawesome/free-solid-svg-icons';
import { faBoxArchive, faBoxOpen, faEllipsisVertical, faGear, faHeart as faHearthSolid, faVolumeUp, faVolumeXmark } from '@fortawesome/free-solid-svg-icons';
import { faHeart as faHeartRegular } from '@fortawesome/free-regular-svg-icons';
import { EMPTY, Subject, debounceTime, distinctUntilChanged, from, takeUntil } from 'rxjs';
import { catchError, mergeWith } from 'rxjs/operators';
Expand Down Expand Up @@ -58,8 +58,8 @@ export class ConversationOptionsComponent implements OnInit, OnDestroy {
faEllipsisVertical = faEllipsisVertical;
faHeartSolid = faHearthSolid;
faHeartRegular = faHeartRegular;
faEye = faEye;
faEyeSlash = faEyeSlash;
faBoxArchive = faBoxArchive;
faBoxOpen = faBoxOpen;
faVolumeXmark = faVolumeXmark;
faVolumeUp = faVolumeUp;
faGear = faGear;
Expand All @@ -79,7 +79,7 @@ export class ConversationOptionsComponent implements OnInit, OnDestroy {
this.channelSubTypeReferenceRouterLink = this.metisService.getLinkForChannelSubType(this.conversationAsChannel);
}

onHiddenClicked(event: MouseEvent) {
onArchiveClicked(event: MouseEvent) {
event.stopPropagation();
if (!this.course.id || !this.conversation.id) {
return;
Expand Down
2 changes: 1 addition & 1 deletion src/main/webapp/app/types/sidebar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export type ChannelGroupCategory =
| 'examChannels'
| 'feedbackDiscussion'
| 'savedPosts'
| 'hiddenChannels';
| 'archivedChannels';
export type CollapseState = {
[key: string]: boolean;
} & (Record<TimeGroupCategory, boolean> | Record<ChannelGroupCategory, boolean> | Record<ExamGroupCategory, boolean> | Record<TutorialGroupCategory, boolean>);
Expand Down
4 changes: 2 additions & 2 deletions src/main/webapp/i18n/de/conversation.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@
},
"conversationSelectionSideBar": {
"header": "Konversationen",
"show": "Konversationen zeigen",
"hide": "Konversationen ausblenden",
"show": "Dearchivieren",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds a bit odd to me, i think something along "Wiederherstellen" might be better?

"hide": "Archivieren",
"notFound": "Keine Konversation gefunden",
"favoriteChannels": "Favoriten",
"hiddenChannels": "Ausgeblendet",
Expand Down
2 changes: 1 addition & 1 deletion src/main/webapp/i18n/de/student-dashboard.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
"hide": "Konversationen ausblenden",
"notFound": "Keine Konversation gefunden",
"favoriteChannels": "Favoriten",
"hiddenChannels": "Ausgeblendet",
"archivedChannels": "Archiviert",
"savedPosts": "Gespeicherte Beiträge",
"progress": "In Bearbeitung",
"completed": "Erledigt",
Expand Down
4 changes: 2 additions & 2 deletions src/main/webapp/i18n/en/conversation.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@
"sideBarSection": {
"shown": "shown",
"hidden": "hidden",
"show": "Show",
"hide": "Hide",
"show": "Unarchive",
"hide": "Archive",
"favorite": "Favorite",
"unfavorite": "Unfavorite",
"mute": "Mute",
Expand Down
2 changes: 1 addition & 1 deletion src/main/webapp/i18n/en/student-dashboard.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
"hide": "Hide conversations",
"notFound": "No conversation found",
"favoriteChannels": "Favorites",
"hiddenChannels": "Hidden",
"archivedChannels": "Archived",
"savedPosts": "Saved Messages",
"progress": "In Progress",
"completed": "Completed",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -453,7 +453,7 @@ describe('CourseOverviewService', () => {
expect(getAsChannelDTO(groupedConversations['generalChannels'].entityData[1].conversation)?.name).toBe('General 2');
});

it('should group favorite and hidden conversations correctly', () => {
it('should group favorite and archived conversations correctly', () => {
const conversations = [generalChannel, examChannel, exerciseChannel, generalChannel2, favoriteChannel, hiddenChannel];

jest.spyOn(service, 'getCorrespondingChannelSubType');
Expand All @@ -466,7 +466,7 @@ describe('CourseOverviewService', () => {
expect(groupedConversations['examChannels'].entityData).toHaveLength(1);
expect(groupedConversations['exerciseChannels'].entityData).toHaveLength(1);
expect(groupedConversations['favoriteChannels'].entityData).toHaveLength(1);
expect(groupedConversations['hiddenChannels'].entityData).toHaveLength(1);
expect(groupedConversations['archivedChannels'].entityData).toHaveLength(1);
expect(service.mapConversationToSidebarCardElement).toHaveBeenCalledTimes(6);
expect(service.getConversationGroup).toHaveBeenCalledTimes(6);
expect(service.getCorrespondingChannelSubType).toHaveBeenCalledTimes(5);
Expand All @@ -476,7 +476,7 @@ describe('CourseOverviewService', () => {
expect(getAsChannelDTO(groupedConversations['examChannels'].entityData[0].conversation)?.name).toBe('exam-test');
expect(getAsChannelDTO(groupedConversations['exerciseChannels'].entityData[0].conversation)?.name).toBe('exercise-test');
expect(getAsChannelDTO(groupedConversations['favoriteChannels'].entityData[0].conversation)?.name).toBe('fav-channel');
expect(getAsChannelDTO(groupedConversations['hiddenChannels'].entityData[0].conversation)?.name).toBe('hidden-channel');
expect(getAsChannelDTO(groupedConversations['archivedChannels'].entityData[0].conversation)?.name).toBe('hidden-channel');
});

it('should not remove favorite conversations from their original section but keep them at the top of the related section', () => {
Expand Down
Loading