Skip to content
Snippets Groups Projects
Commit fa7f8fa0 authored by Ruben Bimberg's avatar Ruben Bimberg :computer:
Browse files

Merge branch '721-use-new-filter-inside-the-topic-cloud' into 'staging'

Resolve "Use new filter inside the Topic Cloud"

Closes #721

See merge request arsnova/frag.jetzt!721
parents 6a0b660b 231d8869
No related merge requests found
......@@ -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 {
......
......@@ -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) {
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment