Watching a page with a journal block

Bug #1401210 reported by Stéphane
22
This bug affects 4 people
Affects Status Importance Assigned to Milestone
Mahara
Fix Released
Wishlist
Aaron Wells

Bug Description

A page of user A is on the watchlist of user B.

The page contains a journal block. When user A updates is journal by adding a new article, the new article is displayed in the page but there is no notification to user B that user A has updated is journal.

This situation is the same with a journal block, a recent journal entry block and tagged journal entry block.

It would be nice either to have the option to add the block to the watchlist, specifically or to make sure that when a page is on a watchlist all modifications including a new journal entry in a block trigger a notification.

Aaron Wells (u-aaronw)
tags: added: blog watchlist
Changed in mahara:
status: New → Confirmed
Revision history for this message
Aaron Wells (u-aaronw) wrote :

Thanks for the bug report!

I think I've identified the coding issue that causes this problem. Whenever an artefact (including a blog post) gets updated, it calls PluginArtefact::commit(), which fires off a "saveartefact" event handler, which in turn fires off the "watchlist_record_changes()" method in lib/activity.php

It then identifies all the pages that the artefact is in, according to the view_artefact table. The view_artefact table gets populated by the PluginBlocktype::rebuild_artefact_list() function whenever a block instance is saved, and it tells the block to look at which artefact's it's using, which view it's in, and fill that into the table.

Crucially, the "blog" artefact has its own extra code that invokes rebuild_artefact_list() whenever a blog entry artefact is committed. But, judging by the comments in the code, it was only written to look at "journal post" and "journal" blocks, and not to consider the other journal blocks (recent journal entry, tagged journal entry). And apparently it's not handling the "journal" block correctly either.

The place this happens is in the blog artefact's own commit() method (which extends the PluginArtefact::commit() method). So, it should be a fairly simple matter to fix it there.

tags: added: snack-sized
Changed in mahara:
importance: Undecided → Wishlist
Aaron Wells (u-aaronw)
tags: removed: snack-sized
Revision history for this message
Jim Judges (j-judges) wrote :

Using 1.9.3 I have found that we do get Watchlist notification for a standard Journal block and any new entries but NOT for changes or new entries for the "Tagged journal entries" block or "Recent journal entries".

We are encouraging users to make use of these blocks and have tutors adding them to watchlists, however there is some disappointment that this feature does not work with all added blocks.

Please vote by indicating if this bug affects you (green link above).

We would really appreciate this issue being worked on and resolved.

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/4224

Revision history for this message
Mahara Bot (dev-mahara) wrote :

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

Revision history for this message
Mahara Bot (dev-mahara) wrote :

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

Revision history for this message
Mahara Bot (dev-mahara) wrote :

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

Revision history for this message
Mahara Bot (dev-mahara) wrote :

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

Revision history for this message
Aaron Wells (u-aaronw) wrote :

Testing instructions for these patches:

Basically, what these should do is ensure that you will receive a watchlist notification if you are following a page containing a "Journal", "Recent journal entries", or "Tagged journal entries" block, and a journal entry displayed in one of those blocks is edited or a new journal entry is published.

Here's what I did for testing:

1. In your config.php file, set "$CFG->watchlistnotification_delay=0;". Otherwise, you'll have to wait 15 minutes for any watchlist notifications to go out. (This was part of the bug fix to consolidate multiple watchlist for the same page.)

2. Create an "author" user account, and a "watcher" user account. For ease of testing, I like to log in as the "author" user and then launch a Firefox "private" window to log in simultaneously as the "watcher" account.

3. In the "watcher" user account, set Watchlist notifications to "Inbox" instead of the default "Email". This will make them show up as "new" in your inbox, which makes testing easier.

4. Log in as the author. Create 2 or 3 journals, each with 2 or 3 journal entries. Give the journal entries some overlapping tags as well. This will provide data for testing the blocks.

5. Create a page with a "Journal" block. Create another page with a "Recent journal entries" block, and another page with a "Tagged journal entries" block.

6. Share these three pages with the "watcher" user.

7. Log in as the watcher. Add all three pages to your watchlist.

8. As the author, write a new blog entry which will show up in one or more of the pages.

9. Run the watchlist_process_notifications cron task. This cron task is scheduled to run once per minute, so if your cron is not actively scheduled, just manually running the cron should do it. (To run it more frequently, you'll need to go into your database and do "update cron set nextrun=null where callfunction='watchlist_process_notification';" before each cron run.)

10. Expected Result: As the watcher, you should see watchlist notifications for the pages where the new blog entry shows up.

11. As the author, write a new blog entry which would show up in one or more of the pages, BUT, make it a draft.

12. Run the watchlist_process_notifications cron task.

13. Expected Result: As the watcher, you should NOT see any new watchlist notifications. Journal entries should not fire watchlist notifications until they are published.

14. As the author, go to your Content -> Journal page, and click the "Publish" button next to the draft journal entry.

15. Run the watchlist_process_notifications cron task

16. Expected Result: As the watcher, you should see watchlist_notifications for the pages where the new blog entry shows up.

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

Reviewed: https://reviews.mahara.org/4225
Committed: http://gitorious.org/mahara/mahara/commit/b88f2b14cc3d9d019af37b6a411fa7fd1ae738d5
Submitter: Robert Lyon (<email address hidden>)
Branch: master

commit b88f2b14cc3d9d019af37b6a411fa7fd1ae738d5
Author: Aaron Wells <email address hidden>
Date: Wed Jan 21 16:22:34 2015 +1300

Fixes to blocktype:blog's listings in view_artefacts table

Bug 1401210. The get_artefacts() method is used by the Blogpost
artefact to find all the blocks that use a particular blogpost,
for storing in the view_artefacts table.

This one was skipping the blogposts themselves, and it was
including content from unpublished blog entries.

Change-Id: I4248be998ba4082722648a1ddbcf1c9334672409

Revision history for this message
Mahara Bot (dev-mahara) wrote :

Reviewed: https://reviews.mahara.org/4223
Committed: http://gitorious.org/mahara/mahara/commit/efb321c370382257e510ca832fc669915472505e
Submitter: Robert Lyon (<email address hidden>)
Branch: master

commit efb321c370382257e510ca832fc669915472505e
Author: Aaron Wells <email address hidden>
Date: Sun Jan 25 22:23:16 2015 +1300

Adding ArtefactType::postcommit_hook function

Bug 1401210. In order for watchlists to properly handle blog
blocks, we need to give the Blog artefact a chance to update
the view_artefacts table before the "saveartefact" event gets
fired at the bottom of ArtefactType::commit().

So I'm adding a postcommit_hook() method which gets called in
the middle of commit(), and shifting ArtefactType's commit()
method into there.

Change-Id: I23986597fd411fa8f93da7cdbfa8d0b577de66fc

Revision history for this message
Mahara Bot (dev-mahara) wrote :

Reviewed: https://reviews.mahara.org/4224
Committed: http://gitorious.org/mahara/mahara/commit/66cff69522e9b005906cbe406609abaaa2c5fb9f
Submitter: Robert Lyon (<email address hidden>)
Branch: master

commit 66cff69522e9b005906cbe406609abaaa2c5fb9f
Author: Aaron Wells <email address hidden>
Date: Wed Jan 28 16:42:03 2015 +1300

Make Publish/Unpublishing a blog entry, fire saveartefact event

Bug 1401210. In order for a newly published blog entry (using the
"publish" button) to be able to trigger a watchlist notification,
it needs to fire a saveartefact event, and update the view_artefact
table, the same as the standard route for editing/creating a blog
entry. So the best way to do that is to use the same commit() method.

Change-Id: I35b93d6f7415ae69ed8eede3e10306b712ea1b68

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

Reviewed: https://reviews.mahara.org/4226
Committed: http://gitorious.org/mahara/mahara/commit/78685b74e35996874c0db98d64f93305b7ed05a7
Submitter: Robert Lyon (<email address hidden>)
Branch: master

commit 78685b74e35996874c0db98d64f93305b7ed05a7
Author: Aaron Wells <email address hidden>
Date: Wed Jan 21 16:23:23 2015 +1300

Make blocktype:recentposts record blog posts in view_artefacts

Bug 1401210. The get_artefacts() method is used by the Blogpost
artefact to find all the blocks that use a particular blogpost,
for storing in the view_artefacts table.

Change-Id: I53d8fd5924ae2ce4d56866efa655424a75f662f7

Revision history for this message
Mahara Bot (dev-mahara) wrote :

Reviewed: https://reviews.mahara.org/4227
Committed: http://gitorious.org/mahara/mahara/commit/669ebe8bf4354a0cb29c8691261a43c050261d1d
Submitter: Robert Lyon (<email address hidden>)
Branch: master

commit 669ebe8bf4354a0cb29c8691261a43c050261d1d
Author: Aaron Wells <email address hidden>
Date: Wed Jan 21 18:33:49 2015 +1300

Make blocktype:taggedposts work with view_artefacts

Bug 1401210. The get_artefacts() method is used by the Blogpost
artefact to find all the blocks that use a particular blogpost,
for storing in the view_artefacts table.

I needed to add a table, blocktype_taggedposts_tags, to store
the tags in a manner that was easier to query than a serialized
blockconfig.

Change-Id: Ieef58715e404689d95848e32ccd4132ea3fbcdc5

Revision history for this message
Aaron Wells (u-aaronw) wrote :

Thanks to SWITCH in Switzerland for sponsoring this bug fix and sharing their code with the community!

Changed in mahara:
milestone: none → 15.04.0
Aaron Wells (u-aaronw)
Changed in mahara:
assignee: nobody → Aaron Wells (u-aaronw)
tags: added: nominatedfeature
Robert Lyon (robertl-9)
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.