Skip to content
Snippets Groups Projects
Verified Commit 15e3057b authored by Alex ORLUC's avatar Alex ORLUC
Browse files

FIX #11277 TIME 0:15 add can manage tag privilege

parent 2ea379a8
No related branches found
No related tags found
No related merge requests found
......@@ -5,7 +5,7 @@
<input type="text" #autoCompleteInput [placeholder]="lang.searchTag" matInput [formControl]="myControl"
[matAutocomplete]="auto" (click)="$event.stopPropagation()" (focus)="resetAutocomplete()">
<button [disabled]="!canAdd" type="button" matSuffix mat-icon-button (click)="addItem()">
<mat-icon class="fa fa-plus" [title]="lang.add" [style.visibility]="canAdd ? 'visible' : 'hidden'"></mat-icon>
<mat-icon class="fa fa-plus" [title]="lang.add" [style.visibility]="canAdd && myControl.value.length > 0 ? 'visible' : 'hidden'"></mat-icon>
</button>
<mat-autocomplete #auto="matAutocomplete" (optionSelected)="selectOpt($event)">
<ng-container *ngIf="options.length > 0 && !loading">
......
......@@ -60,6 +60,11 @@ export class TagInputComponent implements OnInit {
ngOnInit() {
this.controlAutocomplete.setValue(this.controlAutocomplete.value === null || this.controlAutocomplete.value === '' ? [] : this.controlAutocomplete.value);
this.http.get('../../rest/currentUser/privileges').pipe(
tap((data: any) => {
this.canAdd = data.privileges.canManageTags;
})
).subscribe();
this.initFormValue();
this.initAutocompleteRoute();
}
......@@ -69,7 +74,7 @@ export class TagInputComponent implements OnInit {
this.options = [];
this.myControl.valueChanges
.pipe(
tap((value) => this.canAdd = value.length === 0 ? false : true),
//tap((value) => this.canAdd = value.length === 0 ? false : true),
debounceTime(300),
filter(value => value.length > 2),
distinctUntilChanged(),
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment