comment count is wrong when private comments are in play

Bug #1393223 reported by Robert Lyon on 2014-11-16
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Mahara
High
Robert Lyon

Bug Description

The comment count displayed on a blog block is not correct if there are private comments and the viewer of the page can not see the private comments.

Scenario: A user leaves three comments on a journal entry - 2 public and 1 private

The user should see the comment count as 3 as they can see all the comments.

The journal/page owner should also see the comment count as 3 as they can see all the comments as well.

Another user that can see the page should only see the comment count as 2 - because they cannot see the private comment.

Currently the count_comments() function doesn't take into account the difference between public and private comments and who can/cannot see them.

Will mark this bug as high as it is needed to be fixed for Bug #1037531

Robert Lyon (robertl-9) wrote :

Having taken a look at this the get_comments function contains the comment count in it as well and the comment count here does take into account whether a user can see / not see the private comments.

So I've altered the places in artefact/blog/lib.php and artefact/internal/blocktype/textbox/lib.php to use the get_comments() rather than count_comments().

The count comments look to be better suited to the getting of stats in the lib/registration.php file where it doesn't matter if the comment is private or not.

Reviewed: https://reviews.mahara.org/3978
Committed: http://gitorious.org/mahara/mahara/commit/5e066eca5a842c8d5f4ea0fb8e14e7d01df9d788
Submitter: Son Nguyen (<email address hidden>)
Branch: master

commit 5e066eca5a842c8d5f4ea0fb8e14e7d01df9d788
Author: Robert Lyon <email address hidden>
Date: Mon Nov 17 08:38:53 2014 +1300

Getting correct comment count for blocks (Bug #1393223)

The blog and textbox (notes) blocks return incorrect comment count if
there are private comments and the user is not allowed to see the
private comment.

Change-Id: I20f7f51ec2e948d37a09c5447340aab3bef31a13
Signed-off-by: Robert Lyon <email address hidden>

Son Nguyen (ngson2000) on 2014-11-16
Changed in mahara:
status: In Progress → Fix Committed
Robert Lyon (robertl-9) on 2015-04-17
Changed in mahara:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers