Extension talk:CategoryWatch

From Organic Design wiki

A feature that's missing from the MediaWiki Watchlist functionality is that if you watch a category page, you will only be notified when the content of the category page text changes. You won't be notified when pages are added to or removed from that category though which is probably the main information you were wanting.

It would be nice if, in addition to the normal behaviour, a message could be sent to the user listing the added and/or removed member articles.

This functionality would need to be added to the ArticleSaveComplete hook. The category links should be recorded at the start of the request if action is "submit", and then checked against that original state after the article is saved, if its changed, the notification message is sent (preferably using the same code as the normal Watchlist functionality).

Development notes

The notifyOnPageChange method in the EmailNotification class (in UserMailer.php), handles the mailing out of the notifications to all watching users, it takes $editor, $title, $timestamp, $summary and $minor parameters. The composeCommonMailtext method sets the EmailNotification object's from, replyto, subject and body properties using the enotif_body and enotif_subject messages.

So the simplest implementation would be to hook in to ArticleSaveComplete where it creates a list of affected categories with a message for each, then changes the enotif_body and enotif_subject messages, calls notifyOnPageChange, then restores the messages again. To assess the affected categories, it needs to know the content of the previous revision, or perhaps it can record the category links before and after being updated.

Error in mediaWiki-1.13.2

Fatal error: Cannot redeclare wfsetupcategorywatch() (previously declared in /var/www/extensions/CategoryWatch /CategoryWatch.php:163) in /var/www/extensions/CategoryWatch/CategoryWatch.php on line 179(http://setup.organicdesign.co.nz/wiki/index.php)

Resolved, this extension was declared twice as it is in general extensions --Sven 21:49, 22 October 2008 (NZDT)

This could be due to an old versionbeing run on OD which currently contains a bug --Sven 21:39, 22 October 2008 (NZDT)

User friendly message

Make a better message with more information in it using a lot of the same code as EmailNotification::composeCommonMailtext() in includes/UserMailer.php.

The normal watched article notification content is as follows:

Dear $WATCHINGUSERNAME,

$PAGEINTRO $NEWPAGE

Editor's summary: $PAGESUMMARY $PAGEMINOREDIT

Contact the editor:
mail: $PAGEEDITOR_EMAIL
wiki: $PAGEEDITOR_WIKI

There will be no other notifications in case of further activity unless you visit this page while logged in. You could also reset the notification flags for all your watched pages on your watchlist.

Your friendly Organic Design wiki notification system

--
To change your email notification settings, visit
https://organicdesign.nz/Special:Preferences

To change your watchlist settings, visit
https://organicdesign.nz/Special:EditWatchlist

To delete the page from your watchlist, visit
$UNWATCHURL

Feedback and further assistance:
$HELPPAGE

CategoryWatch could just use Enotif_body and set relevant info in $PAGESUMMARY and $NEWPAGE.

Salutation Wrong

I noticed that the source code was modified on Apr 24 09:48:21 2009 [49810] to add $WATCHINGUSERNAME in the emailed message.

$WATCHINGUSERNAME was assigned $name. Should it be assigned $watchingUser->getName(). $name is the person who edited the page not the person who is watching the page.

I also modified my version of the code so that an email is not sent if the editor and watcher are the same person. This mimics how the normal watch works. Wolcott 12:53, 29 May 2009 (UTC)