diff --git a/src/lib/ng-noosfero-api/interfaces/article.ts b/src/lib/ng-noosfero-api/interfaces/article.ts index 740b654..7c318ea 100644 --- a/src/lib/ng-noosfero-api/interfaces/article.ts +++ b/src/lib/ng-noosfero-api/interfaces/article.ts @@ -13,5 +13,6 @@ namespace noosfero { setting: any; start_date: string; end_date: string; + accept_comments: boolean; } } diff --git a/src/plugins/comment_paragraph/allow-comment/allow-comment.component.spec.ts b/src/plugins/comment_paragraph/allow-comment/allow-comment.component.spec.ts index a394338..55e3bf4 100644 --- a/src/plugins/comment_paragraph/allow-comment/allow-comment.component.spec.ts +++ b/src/plugins/comment_paragraph/allow-comment/allow-comment.component.spec.ts @@ -74,5 +74,17 @@ describe("Components", () => { functionToggleCommentParagraph({ id: 2 }); expect(helper.component.article.id).toEqual(2); }); + + it('not display button to side comments when comments was closed and there is no comment paragraph', () => { + helper.component.article.accept_comments = false; + helper.component.commentsCount = 0; + expect(helper.component.isActivated()).toBeFalsy(); + }); + + it('display button to side comments when comments was closed and there is some comments to display', () => { + helper.component.article.accept_comments = false; + helper.component.commentsCount = 2; + expect(helper.component.isActivated()).toBeTruthy(); + }); }); }); diff --git a/src/plugins/comment_paragraph/allow-comment/allow-comment.component.ts b/src/plugins/comment_paragraph/allow-comment/allow-comment.component.ts index 556d8c3..f6f99b1 100644 --- a/src/plugins/comment_paragraph/allow-comment/allow-comment.component.ts +++ b/src/plugins/comment_paragraph/allow-comment/allow-comment.component.ts @@ -32,7 +32,9 @@ export class AllowCommentComponent { } isActivated() { - return this.article && this.article.setting && this.article.setting.comment_paragraph_plugin_activate; + return this.article && this.article.setting && + this.article.setting.comment_paragraph_plugin_activate && + (this.article.accept_comments || this.commentsCount > 0); } showParagraphComments() { -- libgit2 0.21.2