diff --git a/src/app/components/creator/_dialogs/room-edit/room-edit.component.ts b/src/app/components/creator/_dialogs/room-edit/room-edit.component.ts index 8a1222d4cc5cb81029e35432c29dccdc3214c451..31a193b860dfe03f5ad5e95668fd38948ed6d82c 100644 --- a/src/app/components/creator/_dialogs/room-edit/room-edit.component.ts +++ b/src/app/components/creator/_dialogs/room-edit/room-edit.component.ts @@ -34,6 +34,7 @@ export class RoomEditComponent implements OnInit { } ngOnInit() { + this.check = this.editRoom.questionsBlocked; } openDeleteRoomDialog(): void { @@ -70,7 +71,7 @@ export class RoomEditComponent implements OnInit { } save(): void { - this.editRoom.closed = this.check; + this.editRoom.questionsBlocked = this.check; this.roomService.updateRoom(this.editRoom).subscribe(r => this.editRoom = r); if (!this.roomNameFormControl.hasError('required') && !this.roomNameFormControl.hasError('minlength') diff --git a/src/app/components/shared/_dialogs/create-comment/create-comment.component.html b/src/app/components/shared/_dialogs/create-comment/create-comment.component.html index 1c94986def026458b15144bc5e4b223bcaac346f..cf8f157b1449251c64d16c7981461751a3dda21d 100644 --- a/src/app/components/shared/_dialogs/create-comment/create-comment.component.html +++ b/src/app/components/shared/_dialogs/create-comment/create-comment.component.html @@ -95,7 +95,7 @@ <ars-row style="margin-top:8px"> <mat-divider></mat-divider> </ars-row> - <ars-row ars-flex-box> + <ars-row ars-flex-box class="spellcheck"> <ars-col> <button mat-button class="spell-button" (click)="grammarCheck(commentBody)"> {{ 'comment-page.grammar-check' | translate}} diff --git a/src/app/components/shared/_dialogs/create-comment/create-comment.component.scss b/src/app/components/shared/_dialogs/create-comment/create-comment.component.scss index d7ea6685b22ad2d3dc4a1996b1d2e7335a0be616..ed1f61edb7ff37e8a7fcb65d761bfdf70601f4db 100644 --- a/src/app/components/shared/_dialogs/create-comment/create-comment.component.scss +++ b/src/app/components/shared/_dialogs/create-comment/create-comment.component.scss @@ -132,3 +132,14 @@ mat-hint { ::ng-deep .mat-spinner circle { stroke: var(--on-primary); } + +.spellcheck { + @media screen and (max-width:500px) { + overflow: auto; + display: flex; + justify-content: space-between; + flex-direction: column !important; + flex-wrap: wrap; + align-items: flex-end; + } +} \ No newline at end of file diff --git a/src/app/components/shared/_dialogs/create-comment/create-comment.component.ts b/src/app/components/shared/_dialogs/create-comment/create-comment.component.ts index 0aed919adc5dbe57e5d190deffd2785a309e04be..67f9248b287491da191136b9d0d129c5c6d3f3cd 100644 --- a/src/app/components/shared/_dialogs/create-comment/create-comment.component.ts +++ b/src/app/components/shared/_dialogs/create-comment/create-comment.component.ts @@ -34,7 +34,7 @@ export class CreateCommentComponent implements OnInit, OnDestroy { isSpellchecking = false; hasSpellcheckConfidence = true; - @ViewChild('commentBody', {static: true}) commentBody: HTMLDivElement; + @ViewChild('commentBody', { static: true }) commentBody: HTMLDivElement; constructor( private notification: NotificationService, @@ -102,9 +102,16 @@ export class CreateCommentComponent implements OnInit, OnDestroy { } } + checkUTFEmoji(body: string): string{ + var regex = /(?:\:.*?\:|[\u2700-\u27bf]|(?:\ud83c[\udde6-\uddff]){2}|[\ud800-\udbff][\udc00-\udfff]|[\u0023-\u0039]\ufe0f?\u20e3|\u3299|\u3297|\u303d|\u3030|\u24c2|\ud83c[\udd70-\udd71]|\ud83c[\udd7e-\udd7f]|\ud83c\udd8e|\ud83c[\udd91-\udd9a]|\ud83c[\udde6-\uddff]|\ud83c[\ude01-\ude02]|\ud83c\ude1a|\ud83c\ude2f|\ud83c[\ude32-\ude3a]|\ud83c[\ude50-\ude51]|\u203c|\u2049|[\u25aa-\u25ab]|\u25b6|\u25c0|[\u25fb-\u25fe]|\u00a9|\u00ae|\u2122|\u2139|\ud83c\udc04|[\u2600-\u26FF]|\u2b05|\u2b06|\u2b07|\u2b1b|\u2b1c|\u2b50|\u2b55|\u231a|\u231b|\u2328|\u23cf|[\u23e9-\u23f3]|[\u23f8-\u23fa]|\ud83c\udccf|\u2934|\u2935|[\u2190-\u21ff])/g; + + return body.replace(regex, ''); + } + openSpacyDialog(comment: Comment): void { - this.checkSpellings(this.inputText).subscribe((res) => { - const words: string[] = this.inputText.trim().split(' '); + let filteredInputText = this.checkUTFEmoji(this.inputText); + this.checkSpellings(filteredInputText).subscribe((res) => { + const words: string[] = filteredInputText.trim().split(' '); const errorQuotient = (res.matches.length * 100) / words.length; const hasSpellcheckConfidence = this.checkLanguageConfidence(res); @@ -115,7 +122,7 @@ export class CreateCommentComponent implements OnInit, OnDestroy { data: { comment, commentLang, - commentBodyChecked: this.inputText + commentBodyChecked: filteredInputText } }); @@ -131,7 +138,6 @@ export class CreateCommentComponent implements OnInit, OnDestroy { }); }; - /** * Returns a lambda which closes the dialog on call. */ @@ -139,7 +145,6 @@ export class CreateCommentComponent implements OnInit, OnDestroy { return () => this.onNoClick(); } - /** * Returns a lambda which executes the dialog dedicated action on call. */ @@ -205,14 +210,14 @@ export class CreateCommentComponent implements OnInit, OnDestroy { } const replacement = - '<div class="markUp" data-id="' + i + '" style="position: relative; display: inline-block; border-bottom: 1px dotted black">' + - '<span data-id="' + i + '" style="text-decoration: underline wavy red; cursor: pointer;">' + - wrongWord + - '</span>' + - // eslint-disable-next-line max-len - '<div class="dropdownBlock" style="display: none; width: 160px; background-color: white; border-style: solid; border-color: var(--primary); color: #fff; text-align: center; border-radius: 6px; padding: 5px 0; position: absolute; z-index: 1000; bottom: 100%;">' + - suggestionsHTML + - '</div>' + + '<div class="markUp" data-id="'+i+'" style="position: relative; display: inline-block; border-bottom: 1px dotted black">' + + '<span data-id="' + i + '" style="text-decoration: underline wavy red; cursor: pointer;">' + + wrongWord + + '</span>' + + // eslint-disable-next-line max-len + '<div class="dropdownBlock" style="display: none; width: 160px; background-color: white; border-style: solid; border-color: var(--primary); color: #fff; text-align: center; border-radius: 6px; padding: 5px 0; position: absolute; z-index: 1000; bottom: 100%;">' + + suggestionsHTML + + '</div>' + '</div>'; commentBody.innerHTML = commentBody.innerHTML.substr(0, res.matches[i].offset) + @@ -250,8 +255,7 @@ export class CreateCommentComponent implements OnInit, OnDestroy { }, 500); }); } - }, () => { - }, () => { + }, () => {}, () => { this.isSpellchecking = false; }); } diff --git a/src/app/components/shared/_dialogs/room-create/room-create.component.ts b/src/app/components/shared/_dialogs/room-create/room-create.component.ts index 1e49b428fcd067fe53775b70b635676eac133457..f685059543da915911e26b3eb191d643d7c334cd 100644 --- a/src/app/components/shared/_dialogs/room-create/room-create.component.ts +++ b/src/app/components/shared/_dialogs/room-create/room-create.component.ts @@ -75,6 +75,7 @@ export class RoomCreateComponent implements OnInit { newRoom.abbreviation = '00000000'; newRoom.description = ''; newRoom.blacklist = '[]'; + newRoom.questionsBlocked = false; if (this.hasCustomShortId && this.customShortIdName && this.customShortIdName.length > 0) { if (!new RegExp('[1-9a-z,A-Z,\s,\-,\.,\_,\~]+').test(this.customShortIdName) || this.customShortIdName.startsWith(' ') || this.customShortIdName.endsWith(' ')) { 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 d1e5756904aa02809fb953506f86cf83ef7b7e75..35c0f0bf072e914cff48b411e4e84c62bfeaf805 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 @@ -162,7 +162,7 @@ </div> <div fxLayoutAlign="center center" style="margin-left: auto; font-weight: bold;"> - <mat-icon svgIcon="comment_tag" + <mat-icon svgIcon="hashtag" [ngClass]="{'animation-blink': searchMode}" class="oldtypo-h2 comment_tag-icon"></mat-icon> <p [ngClass]="{'animation-blink': searchMode}">{{searchMode ? filteredKeywords.length : diff --git a/src/app/components/shared/_dialogs/topic-cloud-filter/topic-cloud-filter.component.scss b/src/app/components/shared/_dialogs/topic-cloud-filter/topic-cloud-filter.component.scss index 2a514ac55d792d2202bb1c70ac45847d2f594f61..0be1bd332d4b00af790b066d8e8b8bab9d36be04 100644 --- a/src/app/components/shared/_dialogs/topic-cloud-filter/topic-cloud-filter.component.scss +++ b/src/app/components/shared/_dialogs/topic-cloud-filter/topic-cloud-filter.component.scss @@ -28,5 +28,5 @@ mat-radio-group { } .comment_tag-icon { - height: 16px !important; + height: 18px !important; } \ No newline at end of file diff --git a/src/app/components/shared/_dialogs/topic-cloud-filter/topic-cloud-filter.component.ts b/src/app/components/shared/_dialogs/topic-cloud-filter/topic-cloud-filter.component.ts index 1947f59790d21fa08eb9d9084eebf891d00c0be1..99a9210b3852d7888d784d835406831659c901bf 100644 --- a/src/app/components/shared/_dialogs/topic-cloud-filter/topic-cloud-filter.component.ts +++ b/src/app/components/shared/_dialogs/topic-cloud-filter/topic-cloud-filter.component.ts @@ -38,7 +38,7 @@ export class TopicCloudFilterComponent implements OnInit { filteredCommentsCount : number; filteredCommentsUsers : number; filteredCommentsKeywords : number; - + disableCurrentFiltersOptions : boolean = false; commentsLoaded : boolean = false; @@ -74,7 +74,7 @@ export class TopicCloudFilterComponent implements OnInit { this.filteredCommentsUsers = counts.users; this.filteredCommentsKeywords = counts.keywords; this.commentsLoadedCallback(); - }); + }); }); } diff --git a/src/app/components/shared/comment-list/comment-list.component.ts b/src/app/components/shared/comment-list/comment-list.component.ts index 9c3ef6cf85eca46ec4d7f812f56a19f6f8fdcb99..42d5f63448b67f6c3f56751050755f33b2f8a573 100644 --- a/src/app/components/shared/comment-list/comment-list.component.ts +++ b/src/app/components/shared/comment-list/comment-list.component.ts @@ -228,7 +228,7 @@ export class CommentListComponent implements OnInit, OnDestroy { this.roomId = room.id; this.moderationEnabled = this.room.moderated; this.directSend = this.room.directSend; - this.commentsEnabled = (this.userRole > 0) || !this.room.closed; + this.commentsEnabled = (this.userRole > 0) || !this.room.questionsBlocked; this.createCommentWrapper = new CreateCommentWrapper(this.translateService, this.notificationService, this.commentService, this.dialog, this.room); localStorage.setItem('moderationEnabled', JSON.stringify(this.moderationEnabled)); diff --git a/src/app/components/shared/comment/comment.component.html b/src/app/components/shared/comment/comment.component.html index 647ea69f0394223b9b5231cd8f3ae17c3de2f8cc..28b32866bffbaa6609e1b81e55a1144e4e661b3c 100644 --- a/src/app/components/shared/comment/comment.component.html +++ b/src/app/components/shared/comment/comment.component.html @@ -325,8 +325,8 @@ *ngIf="(comment.keywordsFromQuestioner != undefined && comment.keywordsFromQuestioner.length > 0)" class="comment-keywords"> <mat-icon svgIcon="hashtag" class="keyword-icon"></mat-icon> - <span> - {{ this.selectedKeyword === '' ? ('comment-page.keywords' | translate ) : this.selectedKeyword}} + <span matBadge="{{comment.keywordsFromQuestioner.length}}" matBadgeSize="small" matBadgeOverlap="false"> + {{ this.selectedKeyword === '' ? ('comment-page.keywords' | translate ) : this.selectedKeyword}} </span> <mat-menu #keywordsMenu> diff --git a/src/app/components/shared/header/header.component.html b/src/app/components/shared/header/header.component.html index d2796cc07bd7e703a7eb6d8749cac7cdca2385aa..c72627dae7d5d85aa9cb766bcb3d2dc65d28a9ac 100644 --- a/src/app/components/shared/header/header.component.html +++ b/src/app/components/shared/header/header.component.html @@ -17,7 +17,7 @@ </h2> - <ng-container *ngIf="room && room.closed && !router.url.includes('/room-list/')"> + <ng-container *ngIf="room && room.questionsBlocked && !router.url.includes('/room-list/')"> <mat-icon>block</mat-icon><h1>{{'header.questions-blocked'|translate}}</h1> </ng-container> @@ -125,7 +125,7 @@ <ng-container *ngIf="router.url.endsWith('/comments')"> <button mat-menu-item - *ngIf="user && !router.url.endsWith('moderator/comments') && ((user.role > 0) || ((user.role == 0) && room && !room.closed))" + *ngIf="user && !router.url.endsWith('moderator/comments') && ((user.role > 0) || ((user.role == 0) && room && !room.questionsBlocked))" tabindex="0" (click)="navigateCreateQuestion();"> <mat-icon> @@ -364,7 +364,7 @@ <ng-container *ngIf="router.url.includes('/creator') || router.url.includes('/moderator')"> <button mat-menu-item (click)="blockQuestions()" - [ngClass]="{'color-warn': room && room.closed}" + [ngClass]="{'color-warn': room && room.questionsBlocked}" tabindex="0"> <mat-icon class="color-warn">block</mat-icon> <span>{{'header.block' | translate}}</span> diff --git a/src/app/components/shared/header/header.component.ts b/src/app/components/shared/header/header.component.ts index 566319123b281c4032eb259f5b9d5c0e5ef5fdcd..c1833463728d0935e42124c3dd42c0cd7f4c3550 100644 --- a/src/app/components/shared/header/header.component.ts +++ b/src/app/components/shared/header/header.component.ts @@ -320,7 +320,7 @@ export class HeaderComponent implements OnInit { public blockQuestions() { // flip state if clicked - this.room.closed = !this.room.closed; + this.room.questionsBlocked = !this.room.questionsBlocked; this.roomService.updateRoom(this.room).subscribe(r => this.room = r); } diff --git a/src/app/components/shared/questionwall/question-wall/question-wall.component.html b/src/app/components/shared/questionwall/question-wall/question-wall.component.html index 42e2c51fcc27f36c4daf9965b41d62eb5589da0a..9037f1a4599ba2cc3b0f422aaf8873eafa9e59af 100644 --- a/src/app/components/shared/questionwall/question-wall/question-wall.component.html +++ b/src/app/components/shared/questionwall/question-wall/question-wall.component.html @@ -6,7 +6,7 @@ <button ars-btn (click)="leave()" matRipple aria-labelledby="back-lbl"><i>arrow_back</i></button> </ars-col> </ars-fill> - <ng-container *ngIf="room && room.closed && !router.url.includes('/room-list/')"> + <ng-container *ngIf="room && room.questionsBlocked && !router.url.includes('/room-list/')"> <mat-icon>block</mat-icon> <h2>{{'question-wall.questions-blocked'|translate}}</h2> </ng-container> diff --git a/src/app/components/shared/room-list/room-list.component.html b/src/app/components/shared/room-list/room-list.component.html index 56ffe83f6637c6bd4a03b1a46b387e68ccb97f3c..93477f2238d67db2480b6ecaf46f98c60b6c7db7 100644 --- a/src/app/components/shared/room-list/room-list.component.html +++ b/src/app/components/shared/room-list/room-list.component.html @@ -46,7 +46,7 @@ <td mat-cell class="clickable" *matCellDef="let room" (click)="setCurrentRoom(room.shortId)" routerLink="/{{ roleToString((room.role)) }}/room/{{ room.shortId }}"> {{ room.shortId }} - <mat-icon *ngIf="room.closed" class="warn" [inline]="true">block</mat-icon> + <mat-icon *ngIf="room.questionsBlocked" class="warn" [inline]="true">block</mat-icon> </td> </ng-container> diff --git a/src/app/models/room.ts b/src/app/models/room.ts index 1eaaa39ff1471e370993f4eaf2d317e8a86e953b..426a324e8c87d4902f78d67894b3e7908cde51ef 100644 --- a/src/app/models/room.ts +++ b/src/app/models/room.ts @@ -14,6 +14,7 @@ export class Room { directSend: boolean; threshold: number; tags: string[]; + questionsBlocked: boolean; constructor( ownerId: string = '', @@ -27,6 +28,7 @@ export class Room { directSend: boolean = true, threshold: number = null, tags: string[] = [], + questionsBlocked: boolean = false, ) { this.id = ''; this.ownerId = ownerId; @@ -40,5 +42,6 @@ export class Room { this.directSend = directSend; this.threshold = threshold; this.tags = tags; + this.questionsBlocked = questionsBlocked; } } diff --git a/src/assets/icons/hashtag.svg b/src/assets/icons/hashtag.svg index c309d2fc26484ac3b3a85dc928463cc13f0fd8fc..430432bf99b6471dce98b2e8cf87fd5cefebda05 100644 --- a/src/assets/icons/hashtag.svg +++ b/src/assets/icons/hashtag.svg @@ -1,8 +1 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- Generator: Adobe Illustrator 19.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) --> -<svg version="1.1" id="Capa_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" - width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve"> -<path d="M64.333,490h58.401l33.878-137.69h122.259L245.39,490h58.401l33.878-137.69h119.92v-48.162h-108.24l29.2-117.324h79.04 - v-48.162H390.23L424.108,0H365.31l-33.878,138.661H208.79L242.668,0h-58.415l-33.864,138.661H32.411v48.162h106.298l-28.818,117.324 - h-77.48v48.162h65.8L64.333,490z M197.11,186.824h122.642l-29.2,117.324H168.292L197.11,186.824z"/> -</svg> +<svg xmlns="http://www.w3.org/2000/svg" enable-background="new 0 0 24 24" height="24px" viewBox="0 0 24 24" width="24px"><g><rect fill="none" height="24" width="24"/></g><g><path d="M20,10V8h-4V4h-2v4h-4V4H8v4H4v2h4v4H4v2h4v4h2v-4h4v4h2v-4h4v-2h-4v-4H20z M14,14h-4v-4h4V14z"/></g></svg> \ No newline at end of file