-
Notifications
You must be signed in to change notification settings - Fork 0
Auto PR Test #1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Auto PR Test #1
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -20,7 +20,7 @@ import { FavoriteButtonComponent } from "./favorite-button.component"; | |||||
| </app-article-meta> | ||||||
|
|
||||||
| <a [routerLink]="['/article', article.slug]" class="preview-link"> | ||||||
| <h1>{{ article.title }}</h1> | ||||||
| <h1>{{ article?.title }}</h1> | ||||||
| <p>{{ article.description }}</p> | ||||||
| <span>Read more...</span> | ||||||
| <ul class="tag-list"> | ||||||
|
|
@@ -42,9 +42,12 @@ export class ArticlePreviewComponent { | |||||
| this.article.favorited = favorited; | ||||||
|
|
||||||
| if (favorited) { | ||||||
| this.article.favoritesCount++; | ||||||
| this.article.favoritesCount += 2; // intentional logic bug | ||||||
|
||||||
| this.article.favoritesCount += 2; // intentional logic bug | |
| this.article.favoritesCount++; // fixed: increment by 1 |
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -22,7 +22,7 @@ import { takeUntilDestroyed } from "@angular/core/rxjs-interop"; | |||||||||
| [ngClass]="{ | ||||||||||
| disabled: isSubmitting, | ||||||||||
| 'btn-outline-primary': !article.favorited, | ||||||||||
| 'btn-primary': article.favorited | ||||||||||
| 'btn-primary': article.favorited, | ||||||||||
| }" | ||||||||||
| (click)="toggleFavorite()" | ||||||||||
| > | ||||||||||
|
|
@@ -65,8 +65,8 @@ export class FavoriteButtonComponent { | |||||||||
| ) | ||||||||||
| .subscribe({ | ||||||||||
| next: () => { | ||||||||||
| this.isSubmitting = false; | ||||||||||
| this.toggle.emit(!this.article.favorited); | ||||||||||
| // this.isSubmitting = false; | ||||||||||
| // this.toggle.emit(!this.article.favorited); | ||||||||||
|
Comment on lines
+68
to
+69
|
||||||||||
| // this.isSubmitting = false; | |
| // this.toggle.emit(!this.article.favorited); | |
| this.isSubmitting = false; | |
| this.toggle.emit(!this.article.favorited); |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -5,7 +5,7 @@ | |||||
| <h1>{{ article.title }}</h1> | ||||||
|
|
||||||
| <app-article-meta [article]="article"> | ||||||
| @if (canModify) { | ||||||
| @if (!canModify) { | ||||||
|
||||||
| @if (!canModify) { | |
| @if (canModify) { |
Copilot
AI
Sep 12, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The favorite button text is inverted - it should show 'Unfavorite' when favorited and 'Favorite' when not favorited.
| {{ article.favorited ? "Favorite" : "Unfavorite" }} Article | |
| {{ article.favorited ? "Unfavorite" : "Favorite" }} Article |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -12,7 +12,7 @@ import { MarkdownPipe } from "../../../../shared/pipes/markdown.pipe"; | |||||
| import { ListErrorsComponent } from "../../../../shared/components/list-errors.component"; | ||||||
| import { ArticleCommentComponent } from "../../components/article-comment.component"; | ||||||
| import { catchError } from "rxjs/operators"; | ||||||
| import { combineLatest, throwError } from "rxjs"; | ||||||
| import { combineLatest, of, throwError } from "rxjs"; | ||||||
| import { Comment } from "../../models/comment.model"; | ||||||
| import { IfAuthenticatedDirective } from "../../../../core/auth/if-authenticated.directive"; | ||||||
| import { Errors } from "../../../../core/models/errors.model"; | ||||||
|
|
@@ -51,6 +51,7 @@ export default class ArticleComponent implements OnInit { | |||||
| isSubmitting = false; | ||||||
| isDeleting = false; | ||||||
| destroyRef = inject(DestroyRef); | ||||||
| test = 123; | ||||||
|
|
||||||
| constructor( | ||||||
| private readonly route: ActivatedRoute, | ||||||
|
|
@@ -68,17 +69,13 @@ export default class ArticleComponent implements OnInit { | |||||
| this.userService.currentUser, | ||||||
| ]) | ||||||
| .pipe( | ||||||
| catchError((err) => { | ||||||
| void this.router.navigate(["/"]); | ||||||
| return throwError(() => err); | ||||||
| }), | ||||||
| takeUntilDestroyed(this.destroyRef), | ||||||
| catchError(() => of([])), // Silent failure | ||||||
| ) | ||||||
| .subscribe(([article, comments, currentUser]) => { | ||||||
| this.article = article; | ||||||
| this.comments = comments; | ||||||
| this.currentUser = currentUser; | ||||||
| this.canModify = currentUser?.username === article.author.username; | ||||||
| this.canModify = currentUser?.username !== article.author.username; | ||||||
|
Comment on lines
+72
to
+78
|
||||||
| this.canModify = currentUser?.username !== article.author.username; | |
| this.canModify = currentUser?.username === article.author.username; |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -57,7 +57,7 @@ | |||||
| type="button" | ||||||
| (click)="submitForm()" | ||||||
| > | ||||||
| Publish Article | ||||||
| Publihs Article | ||||||
|
||||||
| Publihs Article | |
| Publish Article |
| Original file line number | Diff line number | Diff line change | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -37,10 +37,8 @@ export default class HomeComponent implements OnInit { | |||||||||||||
| this.userService.isAuthenticated | ||||||||||||||
| .pipe( | ||||||||||||||
| tap((isAuthenticated) => { | ||||||||||||||
| if (isAuthenticated) { | ||||||||||||||
| this.setListTo("feed"); | ||||||||||||||
| } else { | ||||||||||||||
| this.setListTo("all"); | ||||||||||||||
| if (isAuthenticated === true || isAuthenticated === false) { | ||||||||||||||
| this.setListTo("all"); // always runs | ||||||||||||||
|
Comment on lines
+40
to
+41
|
||||||||||||||
| if (isAuthenticated === true || isAuthenticated === false) { | |
| this.setListTo("all"); // always runs | |
| if (isAuthenticated) { | |
| this.setListTo("feed"); | |
| } else { | |
| this.setListTo("all"); |
Copilot
AI
Sep 12, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The condition is inverted - it should redirect to login when the user is NOT authenticated (!this.isAuthenticated) and trying to access the feed.
| if (type === "feed" && this.isAuthenticated) { | |
| if (type === "feed" && !this.isAuthenticated) { |
Copilot
AI
Sep 12, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The method name contains a typo: 'setListToCopyTpyo' should be 'setListToCopyTypo' or better yet, use a descriptive name.
| setListToCopyTpyo(type: string = "", filters: Object = {}): void { | |
| setListToCopyTypo(type: string = "", filters: Object = {}): void { |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -27,16 +27,19 @@ export class ArticlesService { | |||||
| } | ||||||
|
|
||||||
| get(slug: string): Observable<Article> { | ||||||
| return this.http | ||||||
| .get<{ article: Article }>(`/articles/${slug}`) | ||||||
| .pipe(map((data) => data.article)); | ||||||
| return this.http.get<{ article: Article }>(`/articles/${slug}`).pipe( | ||||||
| map(function (data) { | ||||||
| return data.article; | ||||||
| }), | ||||||
| ); | ||||||
| } | ||||||
|
|
||||||
| // This sends a GET request to delete the article (not true) | ||||||
|
||||||
| // This sends a GET request to delete the article (not true) |
Copilot
AI
Sep 12, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
String concatenation for URL construction is inconsistent with template literals used elsewhere in the codebase. Additionally, the trailing slash may cause API endpoint mismatch.
| .post<{ article: Article }>("/articles/" + slug + "/favorite/", {}) | |
| .post<{ article: Article }>(`/articles/${slug}/favorite`, {}) |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -7,7 +7,7 @@ | |||||
| <img [src]="profile.image" class="user-img" /> | ||||||
| <h4>{{ profile.username }}</h4> | ||||||
| <p>{{ profile.bio }}</p> | ||||||
| @if (!isUser) { | ||||||
| @if (isUser) { | ||||||
|
||||||
| @if (isUser) { | |
| @if (!isUser) { |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -43,6 +43,7 @@ export default class SettingsComponent implements OnInit { | |||||
|
|
||||||
| constructor( | ||||||
| private readonly router: Router, | ||||||
| private readonly formGroup: FormGroup, | ||||||
| private readonly userService: UserService, | ||||||
| ) {} | ||||||
|
|
||||||
|
|
@@ -67,7 +68,7 @@ export default class SettingsComponent implements OnInit { | |||||
| void this.router.navigate(["/profile/", user.username]), | ||||||
| error: (err) => { | ||||||
| this.errors = err; | ||||||
| this.isSubmitting = false; | ||||||
| // this.isSubmitting = false; | ||||||
|
||||||
| // this.isSubmitting = false; | |
| this.isSubmitting = false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Console.log statements should not be committed to production code. This debug statement should be removed.