diff --git a/src/assets/wise5/authoringTool/project-authoring/project-authoring.component.ts b/src/assets/wise5/authoringTool/project-authoring/project-authoring.component.ts index 71b63dc7b2d..6a6d8c393cf 100644 --- a/src/assets/wise5/authoringTool/project-authoring/project-authoring.component.ts +++ b/src/assets/wise5/authoringTool/project-authoring/project-authoring.component.ts @@ -5,8 +5,6 @@ import { TeacherProjectService } from '../../services/teacherProjectService'; import { TeacherDataService } from '../../services/teacherDataService'; import * as $ from 'jquery'; import { Subscription, filter } from 'rxjs'; -import { Message } from '@stomp/stompjs'; -import { RxStomp } from '@stomp/rx-stomp'; import { temporarilyHighlightElement } from '../../common/dom/dom'; import { ActivatedRoute, NavigationEnd, Router } from '@angular/router'; @@ -17,15 +15,13 @@ import { ActivatedRoute, NavigationEnd, Router } from '@angular/router'; }) export class ProjectAuthoringComponent { protected groupNodeSelected: boolean = false; - protected authors: string[] = []; private idToNode: any; protected inactiveGroupNodes: any[]; private inactiveNodes: any[]; protected inactiveStepNodes: any[]; protected items: any; - private projectId: number; + protected projectId: number; protected showProjectView: boolean = true; - private rxStomp: RxStomp; protected stepNodeSelected: boolean = false; private subscriptions: Subscription = new Subscription(); @@ -53,7 +49,7 @@ export class ProjectAuthoringComponent { this.inactiveStepNodes = this.projectService.getInactiveStepNodes(); this.inactiveNodes = this.projectService.getInactiveNodes(); this.idToNode = this.projectService.getIdToNode(); - this.subscribeToCurrentAuthors(this.projectId); + this.projectService.notifyAuthorProjectBegin(this.projectId); this.subscriptions.add( this.projectService.refreshProject$.subscribe(() => { this.refreshProject(); @@ -67,12 +63,12 @@ export class ProjectAuthoringComponent { ); window.onbeforeunload = (event) => { - this.endProjectAuthoringSession(); + this.projectService.notifyAuthorProjectEnd(this.projectId); }; } ngOnDestroy(): void { - this.endProjectAuthoringSession(); + this.projectService.notifyAuthorProjectEnd(this.projectId); this.subscriptions.unsubscribe(); } @@ -80,11 +76,6 @@ export class ProjectAuthoringComponent { this.showProjectView = /\/teacher\/edit\/unit\/(\d*)$/.test(this.router.url); } - private endProjectAuthoringSession(): void { - this.rxStomp.deactivate(); - this.projectService.notifyAuthorProjectEnd(this.projectId); - } - protected previewProject(): void { window.open(`${this.configService.getConfigParam('previewProjectURL')}`); } @@ -319,18 +310,4 @@ export class ProjectAuthoringComponent { this.getSelectedNodeIds().every((nodeId) => this.projectService.isApplicationNode(nodeId)) ); } - - private subscribeToCurrentAuthors(projectId: number): void { - this.rxStomp = new RxStomp(); - this.rxStomp.configure({ - brokerURL: this.configService.getWebSocketURL() - }); - this.rxStomp.activate(); - this.rxStomp.watch(`/topic/current-authors/${projectId}`).subscribe((message: Message) => { - this.authors = JSON.parse(message.body); - }); - this.rxStomp.connected$.subscribe(() => { - this.projectService.notifyAuthorProjectBegin(this.projectId); - }); - } } diff --git a/src/messages.xlf b/src/messages.xlf index 812bfe1466d..cbc7683329a 100644 --- a/src/messages.xlf +++ b/src/messages.xlf @@ -9676,12 +9676,12 @@ Click "Cancel" to keep the invalid JSON open so you can fix it. - Also currently editing this unit: . Be careful not to overwrite each other's work! + Also currently editing this unit: . Be careful not to overwrite each other's work! src/assets/wise5/authoringTool/concurrent-authors-message/concurrent-authors-message.component.ts - 18,20 + 36,38 @@ -11991,14 +11991,14 @@ Click "Cancel" to keep the invalid JSON open so you can fix it.Are you sure you want to delete the selected item? src/assets/wise5/authoringTool/project-authoring/project-authoring.component.ts - 132 + 123 Are you sure you want to delete the selected items? src/assets/wise5/authoringTool/project-authoring/project-authoring.component.ts - 133 + 124