diff --git a/src/app/components/shared/dialog/topic-dialog-comment/topic-dialog-comment.component.ts b/src/app/components/shared/dialog/topic-dialog-comment/topic-dialog-comment.component.ts index 362f14f03a834c24e570e3db73776f3c0ec0d45a..2777191bd92d7026278f8a99d62451218800c04b 100644 --- a/src/app/components/shared/dialog/topic-dialog-comment/topic-dialog-comment.component.ts +++ b/src/app/components/shared/dialog/topic-dialog-comment/topic-dialog-comment.component.ts @@ -1,7 +1,6 @@ import { Component, Input, OnInit } from '@angular/core'; -//import * as BadWordsList from 'badwords-list/lib/index.js'; -import { TopicCloudAdminServiceService } from '../../../../services/util/topic-cloud-admin-service.service' -import { TopicCloudAdministrationComponent } from '../../_dialogs/topic-cloud-administration/topic-cloud-administration.component'; +import { TopicCloudAdminService } from '../../../../services/util/topic-cloud-admin.service'; + @Component({ selector: 'app-topic-dialog-comment', templateUrl: './topic-dialog-comment.component.html', @@ -21,9 +20,9 @@ export class TopicDialogCommentComponent implements OnInit { public shortQuestion: string; - constructor(private topicCloudAdminServiceService: TopicCloudAdminServiceService) { } + constructor(private topicCloudAdminService: TopicCloudAdminService) { } - get partsOfQuestion() { + get partsOfQuestion() { const q = this.profanityFilter ? this.questionWithProfinity.slice(0,this.isCollapsed? this.question.length: this.maxShowedCharachters) : this.question.slice(0,this.isCollapsed? this.question.length: this.maxShowedCharachters); const q2 = q.split(' '); @@ -31,7 +30,6 @@ export class TopicDialogCommentComponent implements OnInit { } ngOnInit(): void { - //this.badWords = BadWordsList.array; - this.questionWithProfinity = this.topicCloudAdminServiceService.filterProfanityWords(this.question); + this.questionWithProfinity = this.topicCloudAdminService.filterProfanityWords(this.question); } } diff --git a/src/app/services/util/topic-cloud-admin-service.service.spec.ts b/src/app/services/util/topic-cloud-admin.service.spec.ts similarity index 56% rename from src/app/services/util/topic-cloud-admin-service.service.spec.ts rename to src/app/services/util/topic-cloud-admin.service.spec.ts index e898c426adef120774336f65dd96e9b977917a2e..fbe2c18a7e57eec0d171276efccb2aa232588ac5 100644 --- a/src/app/services/util/topic-cloud-admin-service.service.spec.ts +++ b/src/app/services/util/topic-cloud-admin.service.spec.ts @@ -1,13 +1,13 @@ import { TestBed } from '@angular/core/testing'; -import { TopicCloudAdminServiceService } from './topic-cloud-admin-service.service'; +import { TopicCloudAdminService } from './topic-cloud-admin.service'; describe('TopicCloudAdminServiceService', () => { - let service: TopicCloudAdminServiceService; + let service: TopicCloudAdminService; beforeEach(() => { TestBed.configureTestingModule({}); - service = TestBed.inject(TopicCloudAdminServiceService); + service = TestBed.inject(TopicCloudAdminService); }); it('should be created', () => { diff --git a/src/app/services/util/topic-cloud-admin-service.service.ts b/src/app/services/util/topic-cloud-admin.service.ts similarity index 87% rename from src/app/services/util/topic-cloud-admin-service.service.ts rename to src/app/services/util/topic-cloud-admin.service.ts index 51b7c0f1bbfecf56eca5737c2bfea835dd8d3566..1dc8e0aed917bcfda04c9314865a525cd2ec2ea9 100644 --- a/src/app/services/util/topic-cloud-admin-service.service.ts +++ b/src/app/services/util/topic-cloud-admin.service.ts @@ -4,7 +4,7 @@ import * as BadWordsList from 'badwords-list/lib/index.js'; @Injectable({ providedIn: 'root' }) -export class TopicCloudAdminServiceService { +export class TopicCloudAdminService { private badWords: string[] = []; @@ -12,7 +12,7 @@ export class TopicCloudAdminServiceService { return this.badWords; } - constructor() { + constructor() { this.badWords = BadWordsList.array; } @@ -23,7 +23,13 @@ export class TopicCloudAdminServiceService { this.replaceString(questionWithProfinity.toLowerCase(), word, this.generateXWord(word.length)) : questionWithProfinity; }); - return questionWithProfinity; + return questionWithProfinity; + } + + addToBadwordList(word: string){ + if (word !== undefined) { + this.badWords.push(word); + } } private replaceString(str: string, search: string, replace: string){ @@ -37,9 +43,4 @@ export class TopicCloudAdminServiceService { } return res; } - - addToBadwordList(word: string){ - if (word !== undefined) - this.badWords.push(word); - } }