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

Fix redraw bug

Sometimes the tag cloud did a redraw unnecessarily
when joining the tag cloud via dialog.

[Ticket: #186]
parent 49495bda
No related merge requests found
......@@ -68,7 +68,7 @@ export class TopicCloudFilterComponent implements OnInit {
this.filteredComments = this.getCommentCounts(this.comments.filter(comment => this.tmpFilter.checkComment(comment)));
this.commentsLoadedCallback();
this.hasNoKeywords = this.comments.length >= 3 &&
this.allComments.keywords === 0 &&
this.comments.every(comment => !comment.keywordsFromSpacy || comment.keywordsFromSpacy.length === 0) &&
!WorkerDialogComponent.isWorkingOnRoom(data.room.id);
});
this.eventService.broadcast('pushCurrentRoomData');
......
......@@ -156,7 +156,7 @@ const getDefaultCloudParameters = (): CloudParameters => {
templateUrl: './tag-cloud.component.html',
styleUrls: ['./tag-cloud.component.scss']
})
export class TagCloudComponent implements OnInit, OnDestroy, AfterContentInit, AfterViewInit {
export class TagCloudComponent implements OnInit, OnDestroy, AfterContentInit {
@ViewChild(TCloudComponent, { static: false }) child: TCloudComponent;
@ViewChild(TagCloudPopUpComponent) popup: TagCloudPopUpComponent;
......@@ -303,15 +303,11 @@ export class TagCloudComponent implements OnInit, OnDestroy, AfterContentInit, A
ngAfterContentInit() {
document.getElementById('footer_rescale').style.display = 'none';
this._calcFont = window.getComputedStyle(document.getElementById('tagCloudComponent')).fontFamily;
this.dataManager.bindToRoom(this.roomId, this.userRole);
setTimeout(() => this.dataManager.bindToRoom(this.roomId, this.userRole));
this.dataManager.updateDemoData(this.translateService);
this.setCloudParameters(TagCloudComponent.getCurrentCloudParameters(), false);
}
ngAfterViewInit() {
setTimeout(() => this.rebuildData());
}
ngOnDestroy() {
document.getElementById('footer_rescale').style.display = 'block';
this.headerInterface.unsubscribe();
......
......@@ -154,8 +154,12 @@ export class TagCloudDataService {
}
bindToRoom(roomId: string, userRole: UserRole): void {
if (this._subscriptionAdminData) {
throw new Error('Room already bound.');
}
this._currentFilter = CommentFilter.currentFilter;
this._roomId = roomId;
this._lastFetchedComments = null;
this._subscriptionAdminData = this._tagCloudAdmin.getAdminData.subscribe(adminData => {
this.onReceiveAdminData(adminData, true);
});
......@@ -181,6 +185,7 @@ export class TagCloudDataService {
unbindRoom(): void {
this._subscriptionAdminData.unsubscribe();
this._subscriptionAdminData = null;
if (this._commentSubscription !== null) {
this._commentSubscription.unsubscribe();
this._commentSubscription = null;
......
......@@ -146,9 +146,12 @@ export class TopicCloudAdminService {
this.roomService.getRoom(roomId).subscribe(room => {
this.blacklistActive = room.blacklistIsActive;
const adminData = TopicCloudAdminService.getDefaultAdminData;
adminData.blacklistIsActive = room.blacklistIsActive;
adminData.profanityFilter = room.profanityFilter;
this.setAdminData(adminData, false, userRole);
if (adminData.blacklistIsActive !== room.blacklistIsActive ||
adminData.profanityFilter !== room.profanityFilter) {
adminData.blacklistIsActive = room.blacklistIsActive;
adminData.profanityFilter = room.profanityFilter;
this.setAdminData(adminData, false, userRole);
}
});
}
......
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