Skip to content
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

[Bugfix] #7773 when editing comment and not changing the content and clicking save it gives error #3458

Merged
merged 1 commit into from
Nov 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,12 @@ describe('CommentsListComponent', () => {
});

it('should send data when user save edited content', () => {
component.content.setValue('some test text');
component.content.setValue('Updated comment text');

component['commentHtml'] = 'Updated comment text';

const spy = spyOn((component as any).commentsService, 'editComment').and.returnValue(of());

component.saveEditedComment(commentData);
expect(spy).toHaveBeenCalled();
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,12 @@ export class CommentsListComponent {
}

saveEditedComment(element: CommentsDTO): void {
if (!this.commentHtml.trim() || this.commentHtml === element.text) {
element.isEdit = false;
this.content.reset();
return;
}

this.commentsService
.editComment(element.id, this.commentHtml)
.pipe(take(1))
Expand Down
Loading