diff --git a/src/app/components/shared/_dialogs/topic-cloud-administration/topic-cloud-administration.component.html b/src/app/components/shared/_dialogs/topic-cloud-administration/topic-cloud-administration.component.html index 7409a358d3474ec7bd759ff03a1fc702b7ddfd50..d3a70fcf9492519e743d1dc6c52d3ed2ccee2f00 100644 --- a/src/app/components/shared/_dialogs/topic-cloud-administration/topic-cloud-administration.component.html +++ b/src/app/components/shared/_dialogs/topic-cloud-administration/topic-cloud-administration.component.html @@ -36,9 +36,9 @@ {{'topic-cloud-dialog.hide-blacklist' | translate}} </mat-slide-toggle> - <mat-accordion class="new-Badword" multi> - <mat-expansion-panel class="color-background" (opened)="enterBadword=true; focusInput('bad-word-input')" - (closed)="enterBadword = false"> + <mat-accordion class="new-profanity-word" multi> + <mat-expansion-panel class="color-background" (opened)="enterProfanityWord=true; focusInput('profanity-word-input')" + (closed)="enterProfanityWord = false"> <mat-expansion-panel-header class="color-background"> <mat-panel-title> {{'topic-cloud-dialog.edit-profanity-list' | translate}} @@ -47,25 +47,25 @@ <mat-form-field> <mat-label>{{'topic-cloud-dialog.enter-word' | translate}}</mat-label> - <input matInput id="bad-word-input" [(ngModel)]="newBadWord"> + <input matInput id="bad-word-input" [(ngModel)]="newProfanityWord"> </mat-form-field> - <button mat-stroked-button color="primary" class="margin-left" (click)="addBadword()"> + <button mat-stroked-button color="primary" class="margin-left" (click)="addProfanityWord()"> {{'topic-cloud-dialog.add-word' | translate}} </button> - <mat-list role="list" *ngIf="showBadWordList" class="margin-bottom"> - <mat-list-item class="color-on-surface" *ngFor="let word of getBadWordList()" role="listitem">{{word}} - <button style="margin-left: auto" mat-icon-button class="red" (click)="removeWordFromBadWords(word)"> + <mat-list role="list" *ngIf="showProfanityList" class="margin-bottom"> + <mat-list-item class="color-on-surface" *ngFor="let word of getProfanityList()" role="listitem">{{word}} + <button style="margin-left: auto" mat-icon-button class="red" (click)="removeWordFromProfanityList(word)"> <mat-icon mat-list-icon style="margin-bottom: 6px;">delete</mat-icon> </button> </mat-list-item> </mat-list> <div> - <button mat-raised-button *ngIf="getBadWordList().length > 0" class="primaryBackground" - (click)="showBadWordList=!showBadWordList"> - {{showBadWordList ? "Hide badword list" : "Show badword list"}} + <button mat-raised-button *ngIf="getProfanityList().length > 0" class="primaryBackground" + (click)="showProfanityList=!showProfanityList"> + {{showProfanityList ? "Hide profanity list" : "Show profanity list"}} </button> </div> </mat-expansion-panel> diff --git a/src/app/components/shared/_dialogs/topic-cloud-administration/topic-cloud-administration.component.scss b/src/app/components/shared/_dialogs/topic-cloud-administration/topic-cloud-administration.component.scss index 297e9c8c04ea31eeb8d24a22d06b2f0119d108e5..f44532d248f95cfcc58ff91faad7bb06a4d2e4e3 100644 --- a/src/app/components/shared/_dialogs/topic-cloud-administration/topic-cloud-administration.component.scss +++ b/src/app/components/shared/_dialogs/topic-cloud-administration/topic-cloud-administration.component.scss @@ -99,18 +99,18 @@ mat-panel-title, mat-panel-description { opacity: 1.0 !important; } -.new-Badword .mat-expansion-panel-header-title, -.new-Badword .mat-expansion-panel-header-description { +.new-profanity-word .mat-expansion-panel-header-title, +.new-profanity-word .mat-expansion-panel-header-description { flex-basis: 0; } -.new-Badword .mat-expansion-panel-header-description, -.new-Badword .button { +.new-profanity-word .mat-expansion-panel-header-description, +.new-profanity-word .button { justify-content: space-between; align-items: center; } -.new-Badword .mat-form-field + .mat-form-field { +.new-profanity-word .mat-form-field + .mat-form-field { margin-left: 8px; } 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 681ea9fa30915ca475e72b55bae74a2779fe02c8..ce541d61ea34269c4cbd2e4c09d4a5133d4ea721 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 @@ -23,15 +23,15 @@ export class TopicCloudAdministrationComponent implements OnInit, OnDestroy { newKeyword = undefined; edit = false; isCreatorOrMod: boolean; - enterBadword = false; + enterProfanityWord = false; enterBlacklistWord = false; - newBadWord: string = undefined; + newProfanityWord: string = undefined; newBlacklistWord: string = undefined; sortMode = 'alphabetic'; searchedKeyword = undefined; searchMode = false; filteredKeywords: Keyword[] = []; - showBadWordList = false; + showProfanityList = false; showBlacklistWordList = false; showSettingsPanel = false; sentToSpacyChoice = 'keyword'; @@ -145,12 +145,12 @@ export class TopicCloudAdministrationComponent implements OnInit, OnDestroy { return this.topicCloudAdminService.filterProfanityWords(keyword); } - getBadWordList() { - return this.topicCloudAdminService.getBadWordList(); + getProfanityList() { + return this.topicCloudAdminService.getProfanityList(); } getBlacklist() { - return this.topicCloudAdminService.getBlacklistWordList(); + return this.topicCloudAdminService.getBlacklist(); } sortQuestions(sortMode?: string) { @@ -285,9 +285,9 @@ export class TopicCloudAdministrationComponent implements OnInit, OnDestroy { }, 100); } - addBadword() { - this.topicCloudAdminService.addToBadWordList(this.newBadWord); - this.newBadWord = undefined; + addProfanityWord() { + this.topicCloudAdminService.addToProfanityList(this.newProfanityWord); + this.newProfanityWord = undefined; if (this.searchMode){ this.searchKeyword(); } @@ -301,8 +301,8 @@ export class TopicCloudAdministrationComponent implements OnInit, OnDestroy { } } - removeWordFromBadWords(word: string) { - this.topicCloudAdminService.removeFromBadWordList(word); + removeWordFromProfanityList(word: string) { + this.topicCloudAdminService.removeFromProfanityList(word); } removeWordFromBlacklist(word: string) { diff --git a/src/app/services/util/topic-cloud-admin.service.ts b/src/app/services/util/topic-cloud-admin.service.ts index 956cedee535329b22d2c23ba612d195412b1ea74..92b844a5bfbfc394fb08248056be4590a695849f 100644 --- a/src/app/services/util/topic-cloud-admin.service.ts +++ b/src/app/services/util/topic-cloud-admin.service.ts @@ -26,7 +26,7 @@ export class TopicCloudAdminService { let words = []; if (profanityFilter) { // TODO: send only words that are contained in keywords - words = words.concat(this.profanityWords).concat(this.getBadWordList()); + words = words.concat(this.profanityWords).concat(this.getProfanityList()); } if (blacklistFilter && this.blacklist.length > 0) { words = words.concat(this.blacklist); @@ -54,7 +54,7 @@ export class TopicCloudAdminService { filterProfanityWords(str: string): string { let questionWithProfanity = str; - this.profanityWords.concat(this.getBadWordList()).map((word) => { + this.profanityWords.concat(this.getProfanityList()).map((word) => { questionWithProfanity = questionWithProfanity .toLowerCase() .includes(word.toLowerCase()) @@ -68,14 +68,14 @@ export class TopicCloudAdminService { return questionWithProfanity; } - getBadWordList(): string[] { + getProfanityList(): string[] { const list = localStorage.getItem(this.profanityKey); return list ? list.split(',') : []; } - addToBadWordList(word: string) { + addToProfanityList(word: string) { if (word !== undefined) { - const newList = this.getBadWordList(); + const newList = this.getProfanityList(); if (newList.includes(word)){ return; } @@ -84,21 +84,21 @@ export class TopicCloudAdminService { } } - removeFromBadWordList(badword: string) { - const list = this.getBadWordList(); + removeFromProfanityList(profanityWord: string) { + const list = this.getProfanityList(); list.map(word => { - if (word === badword){ + if (word === profanityWord){ list.splice(list.indexOf(word, 0), 1); } }); localStorage.setItem(this.profanityKey, list.toString()); } - removeBadwordList(){ + removeProfanityList(){ localStorage.removeItem(this.profanityKey); } - getBlacklistWordList(): string[] { + getBlacklist(): string[] { return this.blacklist; }