diff --git a/src/app/components/shared/tag-cloud/tag-cloud.component.ts b/src/app/components/shared/tag-cloud/tag-cloud.component.ts index ecb6d8354a25e8cc08c3423f8824159d73d8047e..91c28a70749dd4f4c8487c91515220f44c12f3c3 100644 --- a/src/app/components/shared/tag-cloud/tag-cloud.component.ts +++ b/src/app/components/shared/tag-cloud/tag-cloud.component.ts @@ -87,8 +87,8 @@ export class TagCloudComponent implements OnInit, OnDestroy, AfterContentInit { @ViewChild(TagCloudPopUpComponent) popup: TagCloudPopUpComponent; @ViewChild(MatDrawer) drawer: MatDrawer; - @Input() user: User; - @Input() roomId: string; + roomId: string; + user: User; room: Room; directSend = true; shortId: string; @@ -146,7 +146,7 @@ export class TagCloudComponent implements OnInit, OnDestroy, AfterContentInit { this._calcCanvas = document.createElement('canvas'); this._calcRenderContext = this._calcCanvas.getContext('2d'); this._syncFenceBuildCloud = new SyncFence(2, - () => this.dataManager.bindToRoom(this.roomId, this.room.ownerId, this.userRole)); + () => this.dataManager.bindToRoom(this.room, this.userRole, this.user.id)); } private static getCurrentCloudParameters(): CloudParameters { diff --git a/src/app/services/util/tag-cloud-data.service.ts b/src/app/services/util/tag-cloud-data.service.ts index 84a267bd9cc19f702b707ce2d5825163e9a55ec7..f79b7cb6610c38a8efe29d8ae95312e2e65e8de9 100644 --- a/src/app/services/util/tag-cloud-data.service.ts +++ b/src/app/services/util/tag-cloud-data.service.ts @@ -11,6 +11,7 @@ import { CloudParameters } from '../../utils/cloud-parameters'; import { SmartDebounce } from '../../utils/smart-debounce'; import { ModeratorService } from '../http/moderator.service'; import { CommentListFilter } from '../../components/shared/comment-list/comment-list.filter'; +import { Room } from '../../models/room'; export interface TagCloudDataTagEntry { weight: number; @@ -171,23 +172,26 @@ export class TagCloudDataService { ]; } - bindToRoom(roomId: string, roomOwner: string, userRole: UserRole): void { + bindToRoom(room: Room, userRole: UserRole, userId: string): void { if (this._subscriptionAdminData) { throw new Error('Room already bound.'); } this._currentModerators = null; this._currentFilter = CommentListFilter.loadCurrentFilter(); - this._roomId = roomId; - this._currentOwner = roomOwner; - this._moderatorService.get(roomId).subscribe(moderators => { + this._currentFilter.updateRoom(room); + this._roomId = room.id; + this._currentOwner = room.ownerId; + this._currentFilter.updateUserId(userId); + this._moderatorService.get(room.id).subscribe(moderators => { this._currentModerators = moderators.map(moderator => moderator.accountId); + this._currentFilter.updateModerators(this._currentModerators); this.rebuildTagData(); }); this._lastFetchedComments = null; this._subscriptionAdminData = this._tagCloudAdmin.getAdminData.subscribe(adminData => { this.onReceiveAdminData(adminData, true); }); - this._tagCloudAdmin.ensureRoomBound(roomId, userRole); + this._tagCloudAdmin.ensureRoomBound(room.id, userRole); this.fetchData(); if (!this._currentFilter.freezedAt) {