Fix bug start a task without assignee (#4204)

This commit is contained in:
Maurizio Vitale
2019-01-24 09:13:30 +00:00
committed by GitHub
parent e63aa9a684
commit 87d973d8d2
3 changed files with 10 additions and 6 deletions

View File

@@ -136,6 +136,7 @@ export class StartTaskCloudComponent implements OnInit, OnDestroy {
private loadCurrentUser() {
this.currentUser = this.identityUserService.getCurrentUserInfo();
this.assigneeName = this.currentUser.username;
}
public saveTask() {
@@ -143,7 +144,7 @@ export class StartTaskCloudComponent implements OnInit, OnDestroy {
const newTask = Object.assign(this.taskForm.value);
newTask.appName = this.getAppName();
newTask.dueDate = this.getDueDate();
newTask.assignee = this.getAssigneeName();
newTask.assignee = this.assigneeName;
this.createNewTask(new TaskDetailsCloudModel(newTask));
}
@@ -173,10 +174,6 @@ export class StartTaskCloudComponent implements OnInit, OnDestroy {
return this.appName ? this.appName : '';
}
private getAssigneeName(): string {
return this.assigneeName ? this.assigneeName : this.currentUser.username;
}
onDateChanged(newDateValue) {
this.dateError = false;
@@ -192,6 +189,10 @@ export class StartTaskCloudComponent implements OnInit, OnDestroy {
this.assigneeName = assignee ? assignee.username : '';
}
onRemoveUser() {
this.assigneeName = null;
}
public whitespaceValidator(control: FormControl) {
const isWhitespace = (control.value || '').trim().length === 0;
const isValid = !isWhitespace;