mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
fix random test failing part 2 (#3395)
* fix random failing test core search/comment/auth/user * fix node delete directive * fix lint issues * node restore fix * fix comment test * remove fdescribe * fix tests and tslint * fix upload test * unsubscribe success event task test * copy comment object during test * use the data pipe performance improvement and standard usage * uncomment random test * fix comment date random failing test * disposable unsubscribe * fix start process * remove fdescribe * change start process test and remove commented code * fix error event check double click * clone object form test * refactor date time test * fix service mock * fix test dropdown and context * git hook lint * fix language test * unsubscribe documentlist event test * fix disposable error * fix console log service error document list * unusbscribe search test * clear input field * remove wrong test
This commit is contained in:
committed by
Denys Vuika
parent
22006395c7
commit
eb0f91c5db
@@ -19,7 +19,7 @@ import { Component, EventEmitter, Input, Output, ViewEncapsulation } from '@angu
|
||||
import { CommentModel } from '../models/comment.model';
|
||||
import { EcmUserService } from '../userinfo/services/ecm-user.service';
|
||||
import { PeopleProcessService } from '../services/people-process.service';
|
||||
import { DatePipe } from '@angular/common';
|
||||
import { UserPreferencesService, UserPreferenceValues } from '../services/user-preferences.service';
|
||||
|
||||
@Component({
|
||||
selector: 'adf-comment-list',
|
||||
@@ -40,8 +40,14 @@ export class CommentListComponent {
|
||||
|
||||
selectedComment: CommentModel;
|
||||
|
||||
constructor(private datePipe: DatePipe, public peopleProcessService: PeopleProcessService,
|
||||
public ecmUserService: EcmUserService) {
|
||||
currentLocale;
|
||||
|
||||
constructor(public peopleProcessService: PeopleProcessService,
|
||||
public ecmUserService: EcmUserService,
|
||||
public userPreferenceService: UserPreferencesService) {
|
||||
userPreferenceService.select(UserPreferenceValues.Locale).subscribe((locale) => {
|
||||
this.currentLocale = locale;
|
||||
});
|
||||
}
|
||||
|
||||
selectComment(comment: CommentModel): void {
|
||||
@@ -78,23 +84,6 @@ export class CommentListComponent {
|
||||
}
|
||||
}
|
||||
|
||||
transformDate(aDate: string): string {
|
||||
let formattedDate: string;
|
||||
let givenDate = Number.parseInt(this.datePipe.transform(aDate, 'yMMdd'));
|
||||
let today = Number.parseInt(this.datePipe.transform(Date.now(), 'yMMdd'));
|
||||
if (givenDate === today) {
|
||||
formattedDate = 'Today, ' + this.datePipe.transform(aDate, 'hh:mm a');
|
||||
} else {
|
||||
let yesterday = Number.parseInt(this.datePipe.transform(Date.now() - 24 * 3600 * 1000, 'yMMdd'));
|
||||
if (givenDate === yesterday) {
|
||||
formattedDate = 'Yesterday, ' + this.datePipe.transform(aDate, 'hh:mm a');
|
||||
} else {
|
||||
formattedDate = this.datePipe.transform(aDate, 'MMM dd y, hh:mm a');
|
||||
}
|
||||
}
|
||||
return formattedDate;
|
||||
}
|
||||
|
||||
private isAContentUsers(user: any): boolean {
|
||||
return user.avatarId;
|
||||
}
|
||||
|
Reference in New Issue
Block a user