diff --git a/src/app/components/shared/_dialogs/topic-cloud-administration/topic-cloud-administration.component.ts b/src/app/components/shared/_dialogs/topic-cloud-administration/topic-cloud-administration.component.ts index a76893264c4d18c41d9fef9c31e2b8dba5f99e35..6154f966ebcb8bf64abf60552e4d4e9e7de9852a 100644 --- a/src/app/components/shared/_dialogs/topic-cloud-administration/topic-cloud-administration.component.ts +++ b/src/app/components/shared/_dialogs/topic-cloud-administration/topic-cloud-administration.component.ts @@ -82,6 +82,7 @@ export class TopicCloudAdministrationComponent implements OnInit, OnDestroy { this.profanitywordlist = this.topicCloudAdminService.getProfanityListFromStorage(); this.profanitylistSubscription = this.topicCloudAdminService.getCustomProfanityList().subscribe(list => { this.profanitywordlist = list; + this.refreshKeywords(); }); this.isCreatorOrMod = this.data.user.role !== UserRole.PARTICIPANT; this.translateService.use(localStorage.getItem('currentLang')); @@ -172,8 +173,10 @@ export class TopicCloudAdministrationComponent implements OnInit, OnDestroy { this.keywords = []; tempKeywords.forEach(keyword => { keyword.comments.forEach(comment => this.pushInKeywords(comment)); - console.log(this.keywords); }); + if (this.searchMode){ + this.searchKeyword(); + } } pushInKeywords(comment: Comment){ @@ -432,33 +435,19 @@ export class TopicCloudAdministrationComponent implements OnInit, OnDestroy { addProfanityWord() { this.topicCloudAdminService.addToProfanityList(this.newProfanityWord); this.newProfanityWord = undefined; - if (this.searchMode){ - this.searchKeyword(); - } - this.ngOnDestroy(); - this.ngOnInit(); } addBlacklistWord() { this.topicCloudAdminService.addWordToBlacklist(this.newBlacklistWord); this.newBlacklistWord = undefined; - if (this.searchMode){ - this.searchKeyword(); - } - this.ngOnDestroy(); - this.ngOnInit(); } removeWordFromProfanityList(word: string) { this.topicCloudAdminService.removeFromProfanityList(word); - this.ngOnDestroy(); - this.ngOnInit(); } removeWordFromBlacklist(word: string) { this.topicCloudAdminService.removeWordFromBlacklist(word); - this.ngOnDestroy(); - this.ngOnInit(); } changeProfanityFilter() { @@ -466,7 +455,9 @@ export class TopicCloudAdministrationComponent implements OnInit, OnDestroy { this.translateService.get('topic-cloud-dialog.words-will-be-overwritten').subscribe(msg => { this.notificationService.show(msg); }); - this.searchKeyword(); + if (this.searchMode){ + this.searchKeyword(); + } } } diff --git a/src/app/services/util/topic-cloud-admin.service.ts b/src/app/services/util/topic-cloud-admin.service.ts index 93edcdb0639fc381f5da3d0934dfa2119c028cd9..297b61f4add42275ea7fcb5f9ca8197e0b54c502 100644 --- a/src/app/services/util/topic-cloud-admin.service.ts +++ b/src/app/services/util/topic-cloud-admin.service.ts @@ -92,8 +92,8 @@ export class TopicCloudAdminService { const plist = this.getProfanityListFromStorage(); if (!plist.includes(word.toLowerCase().trim())) { plist.push(word.toLowerCase().trim()); - this.customProfanityWords.next(plist); localStorage.setItem(this.profanityKey, JSON.stringify(plist)); + this.customProfanityWords.next(plist); } } } @@ -101,8 +101,8 @@ export class TopicCloudAdminService { removeFromProfanityList(word: string) { const plist = this.getProfanityListFromStorage(); plist.splice(plist.indexOf(word, 0), 1); - this.customProfanityWords.next(plist); localStorage.setItem(this.profanityKey, JSON.stringify(plist)); + this.customProfanityWords.next(plist); } removeProfanityList() {