-
- {{ comment.body }}
-
+ @if (comment.status === 'REMOVED') {
+
+
+
This comment has been deleted.
+
-
+ }
}
`,
+ styles: [
+ `
+ .comment {
+ padding: 12px;
+ border-bottom: 1px solid #e0e0e0;
+ }
+
+ .deleted {
+ font-style: italic;
+ color: #888;
+ }
+
+ .deleted-text {
+ margin: 0;
+ }
+ `,
+ ],
imports: [RouterLink, DatePipe, AsyncPipe],
})
export class ArticleCommentComponent {
diff --git a/src/app/features/article/models/comment.model.ts b/src/app/features/article/models/comment.model.ts
index 6a6350b5b..bab598ccd 100644
--- a/src/app/features/article/models/comment.model.ts
+++ b/src/app/features/article/models/comment.model.ts
@@ -4,5 +4,6 @@ export interface Comment {
id: string;
body: string;
createdAt: string;
+ status: string;
author: Profile;
}
diff --git a/src/app/features/article/pages/article/article.component.ts b/src/app/features/article/pages/article/article.component.ts
index fd3ce2f8c..9a44fb5c7 100644
--- a/src/app/features/article/pages/article/article.component.ts
+++ b/src/app/features/article/pages/article/article.component.ts
@@ -125,7 +125,7 @@ export default class ArticleComponent implements OnInit {
deleteComment(comment: Comment): void {
this.commentsService
- .delete(comment.id, this.article.slug)
+ .softDelete(comment.id, this.article.slug)
.pipe(takeUntilDestroyed(this.destroyRef))
.subscribe(() => {
this.comments = this.comments.filter(item => item !== comment);
diff --git a/src/app/features/article/pages/home/home.component.html b/src/app/features/article/pages/home/home.component.html
index 869fb32c8..4149fbd4e 100644
--- a/src/app/features/article/pages/home/home.component.html
+++ b/src/app/features/article/pages/home/home.component.html
@@ -27,6 +27,19 @@
conduit
Global Feed
+
+
+
+ Trending Feed
+
+
+
{{ listConfig.filters.tag }}
diff --git a/src/app/features/article/pages/home/home.component.ts b/src/app/features/article/pages/home/home.component.ts
index 0f930b2a5..871d88f57 100644
--- a/src/app/features/article/pages/home/home.component.ts
+++ b/src/app/features/article/pages/home/home.component.ts
@@ -42,6 +42,7 @@ export default class HomeComponent implements OnInit {
} else {
this.setListTo('all');
}
+ this.setListTo('trending');
}),
takeUntilDestroyed(this.destroyRef),
)
diff --git a/src/app/features/article/services/articles.service.ts b/src/app/features/article/services/articles.service.ts
index c4b816b98..d65abb1e5 100644
--- a/src/app/features/article/services/articles.service.ts
+++ b/src/app/features/article/services/articles.service.ts
@@ -19,7 +19,7 @@ export class ArticlesService {
});
return this.http.get<{ articles: Article[]; articlesCount: number }>(
- '/articles' + (config.type === 'feed' ? '/feed' : ''),
+ '/articles' + (config.type === 'feed' ? '/feed' : config.type == 'trending' ? '/trending' : ''),
{ params },
);
}
diff --git a/src/app/features/article/services/comments.service.ts b/src/app/features/article/services/comments.service.ts
index 57ab62a42..574f658b0 100644
--- a/src/app/features/article/services/comments.service.ts
+++ b/src/app/features/article/services/comments.service.ts
@@ -23,4 +23,8 @@ export class CommentsService {
delete(commentId: string, slug: string): Observable
{
return this.http.delete(`/articles/${slug}/comments/${commentId}`);
}
+
+ softDelete(commentId: string, slug: string): Observable {
+ return this.http.patch(`/articles/${slug}/comments/${commentId}/remove`, {});
+ }
}