Deleting a private comment problem

Bug #1844748 reported by Robert Lyon
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Mahara
Fix Released
Medium
Robert Lyon

Bug Description

When you have the following set up:

1) Have a group set up that you can submit pages to
2) Create a page and submit it to that group
3) View the page and leave a private comment on it
4) Now delete the comment and refresh the page

You see "Trying to get property of non-object" error similar to:

  Call stack (most recent first):
   * log_message("Trying to get property of non-object", 8, true, true, "/home/robertl/code/mahara-devel/mahara/htdocs/arte...", 803) at /home/robertl/code/mahara-devel/mahara/htdocs/lib/errors.php:521
   * error(8, "Trying to get property of non-object", "/home/robertl/code/mahara-devel/mahara/htdocs/arte...", 803, array(size 15)) at /home/robertl/code/mahara-devel/mahara/htdocs/artefact/comment/lib.php:803
   * ArtefactTypeComment::build_html(object(stdClass), false) at /home/robertl/code/mahara-devel/mahara/htdocs/artefact/comment/lib.php:553
   * ArtefactTypeComment::get_comments(object(stdClass)) at /home/robertl/code/mahara-devel/mahara/htdocs/view/view.php:288

This is because we fetch $lastcomment and try to access it's 'id' value - but that is only for public comments

Revision history for this message
Mahara Bot (dev-mahara) wrote : A patch has been submitted for review

Patch for "master" branch: https://reviews.mahara.org/10365

Changed in mahara:
status: New → In Progress
importance: Undecided → Medium
milestone: none → 19.10.0
Revision history for this message
Rangi Daymond (rangid) wrote :

**Gerrit/Patchset: https://reviews.mahara.org/mahara refs/changes/65/10365/2
**Browser tested: Chrome
**Theme used: Default (Raw)

**DESCRIPTION/SUMMARY:
An error is generated when a user deletes a private (i.e. NOT public) comment that they made on a page shared with a group.

**PRECONDITIONS:
1. Logged in user1 is a member of group1 that they have shared a page with.
2. User2 is also a member of group1.

**TEST STEPS:
Step 1: Logged in user1 views the group page that they shared.
Step 2: User1 makes a private comment on the page
Step 3: User1 deletes the page comment
Expected result: the page is refreshed and the comment is gone.
Actual result: as expected ✔

Step 4: User1 makes a public comment on the page
Step 5: User2 views the page then makes their own private comment then deletes it successfully as expected ✔

Step 6: User2 makes a public comment
Step 7: User1 views the page then successfully deletes both public comments successfully as expected ✔

Changed in mahara:
assignee: nobody → Robert Lyon (robertl-9)
Revision history for this message
Mahara Bot (dev-mahara) wrote : A change has been merged

Reviewed: https://reviews.mahara.org/10365
Committed: https://git.mahara.org/mahara/mahara/commit/44cc873c4e6392d390f5d8ad33044af748a906b7
Submitter: Robert Lyon (<email address hidden>)
Branch: master

commit 44cc873c4e6392d390f5d8ad33044af748a906b7
Author: Robert Lyon <email address hidden>
Date: Fri Sep 20 12:57:40 2019 +1200

Bug 1844748: Trying to get property of non-object on comment delete

To test - see bug report

Also should fix the error
DOMDocument::loadHTML(): Misplaced DOCTYPE declaration in Entity, line: 1

When deleting a comment on someone elses page

behatnotneeded

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

Robert Lyon (robertl-9)
Changed in mahara:
status: In Progress → Fix Committed
Revision history for this message
Mahara Bot (dev-mahara) wrote :

Patch for "19.10_STABLE" branch: https://reviews.mahara.org/10456

Revision history for this message
Mahara Bot (dev-mahara) wrote : A change has been merged

Reviewed: https://reviews.mahara.org/10456
Committed: https://git.mahara.org/mahara/mahara/commit/bb5812918d05d6a7ff2a5a73822cf286c22201b0
Submitter: Cecilia Vela Gurovic (<email address hidden>)
Branch: 19.10_STABLE

commit bb5812918d05d6a7ff2a5a73822cf286c22201b0
Author: Robert Lyon <email address hidden>
Date: Fri Sep 20 12:57:40 2019 +1200

Bug 1844748: Trying to get property of non-object on comment delete

To test - see bug report

Also should fix the error
DOMDocument::loadHTML(): Misplaced DOCTYPE declaration in Entity, line: 1

When deleting a comment on someone elses page

behatnotneeded

Change-Id: I5bdbcb239d0f8f887355238bf89eb04facc85420
Signed-off-by: Robert Lyon <email address hidden>
(cherry picked from commit 44cc873c4e6392d390f5d8ad33044af748a906b7)

Changed in mahara:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.