ignore metadata improvements

This commit is contained in:
2021-10-05 08:41:38 +02:00
parent 2ac686824b
commit e225e78639
18 changed files with 373 additions and 84 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
<div class="container">
<page-notfound *ngIf="notfound"></page-notfound>
<ng-container *ngIf="comment">
<ui-comment class="comment" [comment]="comment"></ui-comment>
<ui-comment class="comment" [comment]="comment" [ignore]="ignoreSubcomments" [subcomments]="true"></ui-comment>
</ng-container>
</div>
+1 -5
View File
@@ -15,16 +15,14 @@ export class PageComment implements OnInit {
id: number;
comment: any;
notfound: boolean = false;
ignoreSubcomments : string[] = ['entry'];
constructor(private commentService: CommentService,
private route: ActivatedRoute) { }
ngOnInit(): void {
this.id = +this.route.snapshot.paramMap.get('id');
this.refresh();
}
refresh() {
this.commentService.getComment(this.id).subscribe((data) => {
this.comment = data;
}, (error) => {
@@ -34,6 +32,4 @@ export class PageComment implements OnInit {
})
}
}
+1 -1
View File
@@ -7,6 +7,6 @@
<ui-commentform [target]="entry.id" (replyCommentEvent)="replyCallback($event)"></ui-commentform>
<ui-comments #comments [target]="entry.id"></ui-comments>
<ui-comments #comments [target]="entry.id" [subcomments]="true"></ui-comments>
</ng-container>
</div>
@@ -29,7 +29,7 @@ export class PageUnavailable implements OnInit {
if (!this.targetRoute || this.targetRoute === "unavailable" || this.targetRoute === "/unavailable") {
this.location.back;
} else {
this.router.navigate([ this.targetRoute ], { skipLocationChange: true });
this.router.navigate([ this.targetRoute ]);
}
}
+1 -1
View File
@@ -24,7 +24,7 @@ export class PageUser implements OnInit {
this.userService.getUser(this.username).subscribe((data) => {
this.user = data;
}, (error) => {
if (error.status == 404) {
if (error.status == 422) {
this.notfound = true;
}
})
@@ -6,27 +6,7 @@
<p>{{'user.commentsBy' | i18n}}<a routerLink="/u/{{username}}">{{username}}</a></p>
<ng-container *ngFor="let comment of comments.content; let i = index">
<mat-divider class="divider" *ngIf="i > 0"></mat-divider>
<div class="comment">
<div mat-line>
<small>
<a routerLink="/c/{{comment.id}}" matTooltip="{{comment.created | datef:'LLLL'}}">{{comment.created
| datef}}</a>
<span *ngIf="comment.metadata && comment.metadata.entry">
{{'comment.on' | i18n}} <a routerLink="/e/{{comment.target}}">{{comment.metadata.entry ||
'entry'}}</a>
</span>
</small>
</div>
<div mat-line class="text"
[style.opacity]="comment.metadata && comment.metadata.points && comment.metadata.points < 0 ? 1 + (comment.metadata.points / 10) : '1.0'">
{{comment.text}}</div>
<div mat-line>
<small>
<a *ngIf="moderator" href="javascript:" (click)="deleteComment(comment)">{{'comment.delete' | i18n}}</a>
</small>
</div>
</div>
<ui-comment [comment]="comment" [ignore]="ignore"></ui-comment>
</ng-container>
<mat-list *ngIf="comments.totalElements == 0">
@@ -14,19 +14,20 @@ export class PageUserComments implements OnInit {
username: string;
comments: any = {};
init: boolean = true;
ignore : string[] = ["author"];
constructor(private commentService: CommentService, private router: Router, private route: ActivatedRoute) { }
ngOnInit(): void {
this.username = this.route.snapshot.paramMap.get('username');
this.commentService.getByUser(this.username, this.comments.number || 0, this.comments.size || 30).subscribe((data: any) => {
this.commentService.getByUser(this.username, this.comments.number || 0, this.comments.size || 30, this.ignore).subscribe((data: any) => {
this.comments = data;
}, (error) => { })
}
showMore() {
const oldContent: any[] = this.comments.content;
this.commentService.getByUser(this.username, this.comments.number + 1, this.comments.size).subscribe((data) => {
this.commentService.getByUser(this.username, this.comments.number + 1, this.comments.size, this.ignore).subscribe((data) => {
this.comments = data;
for (let comment of this.comments.content) {
oldContent.push(comment);