Commit adad53f006d27d7636f9d98ac7a3b47d48ff633d
1 parent
c623e86c
Exists in
master
and in
26 other branches
Hide button to side comments when there is no comments to display
Showing
3 changed files
with
16 additions
and
1 deletions
Show diff stats
src/lib/ng-noosfero-api/interfaces/article.ts
src/plugins/comment_paragraph/allow-comment/allow-comment.component.spec.ts
... | ... | @@ -74,5 +74,17 @@ describe("Components", () => { |
74 | 74 | functionToggleCommentParagraph({ id: 2 }); |
75 | 75 | expect(helper.component.article.id).toEqual(2); |
76 | 76 | }); |
77 | + | |
78 | + it('not display button to side comments when comments was closed and there is no comment paragraph', () => { | |
79 | + helper.component.article.accept_comments = false; | |
80 | + helper.component.commentsCount = 0; | |
81 | + expect(helper.component.isActivated()).toBeFalsy(); | |
82 | + }); | |
83 | + | |
84 | + it('display button to side comments when comments was closed and there is some comments to display', () => { | |
85 | + helper.component.article.accept_comments = false; | |
86 | + helper.component.commentsCount = 2; | |
87 | + expect(helper.component.isActivated()).toBeTruthy(); | |
88 | + }); | |
77 | 89 | }); |
78 | 90 | }); | ... | ... |
src/plugins/comment_paragraph/allow-comment/allow-comment.component.ts
... | ... | @@ -32,7 +32,9 @@ export class AllowCommentComponent { |
32 | 32 | } |
33 | 33 | |
34 | 34 | isActivated() { |
35 | - return this.article && this.article.setting && this.article.setting.comment_paragraph_plugin_activate; | |
35 | + return this.article && this.article.setting && | |
36 | + this.article.setting.comment_paragraph_plugin_activate && | |
37 | + (this.article.accept_comments || this.commentsCount > 0); | |
36 | 38 | } |
37 | 39 | |
38 | 40 | showParagraphComments() { | ... | ... |