Skip to content

Commit

Permalink
Show only last 5 contributors in thread-preview (close #411)
Browse files Browse the repository at this point in the history
  • Loading branch information
tschaffter committed Aug 25, 2019
1 parent 94872d4 commit 321e36d
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
{{ numReplies }} replies
</div>
<div class="app-thread-header-metadata">
<user-avatar *ngFor="let contributor of thread.contributors | slice: 1" [user]="contributor" [size]="contributorAvatarSize"></user-avatar>
<user-avatar *ngFor="let contributor of thread.contributors | slice: 1 | takeRight: 5" [user]="contributor" [size]="contributorAvatarSize"></user-avatar>
</div>
<div class="app-thread-header-open-thread">
<a mat-icon-button (click)="showThread()" matTooltip="Show thread" [matTooltipPosition]="tooltipPosition">
Expand Down
7 changes: 5 additions & 2 deletions client/components/pipes/pipes.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { DateAndTimePipe } from './date/date-and-time.pipe';
import { DateLongPipe } from './date/date-long.pipe';
import { LastUpdatedPipe } from './date/last-updated.pipe';
import { SameDayPipe } from './date/same-day.pipe';
import { TakeRightPipe } from './take-right.pipe';

@NgModule({
imports: [
Expand All @@ -13,13 +14,15 @@ import { SameDayPipe } from './date/same-day.pipe';
DateAndTimePipe,
DateLongPipe,
LastUpdatedPipe,
SameDayPipe
SameDayPipe,
TakeRightPipe
],
exports: [
DateAndTimePipe,
DateLongPipe,
LastUpdatedPipe,
SameDayPipe
SameDayPipe,
TakeRightPipe
]
})
export class PipesModule { }
11 changes: 11 additions & 0 deletions client/components/pipes/take-right.pipe.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { Pipe, PipeTransform } from '@angular/core';
import { takeRight } from 'lodash/fp';

@Pipe({
name: 'takeRight'
})
export class TakeRightPipe implements PipeTransform {
transform(items: any[], n = 1): any[] {
return takeRight(n, items);
}
}

0 comments on commit 321e36d

Please sign in to comment.