CategoryMembershipChange is great, but it doesn't have a
machine-readable way to see if the category has been added or removed
from the page. We could parse the comments, but that would rely on
reading the comments and matching the message against the translated
strings.
This patch adds a couple of parameters and notes whether the change
was an addition or removal in rc_params.
Also, puts the evaluation of the AbortEmailNotification hook before
the check of rc_type in the hopes that the extension CatWatch can send
out emails at the right time.
Bug: T175052
Change-Id: I3e2ac0cc148b9d618e2f8b7853b14bff827ee443
),
$this->pageTitle,
$this->getPreviousRevisionTimestamp(),
),
$this->pageTitle,
$this->getPreviousRevisionTimestamp(),
+ $this->revision,
+ $type === self::CATEGORY_ADDITION
* @param Title $pageTitle Title of the page that is being added or removed
* @param string $lastTimestamp Parent revision timestamp of this change in TS_MW format
* @param Revision|null $revision
* @param Title $pageTitle Title of the page that is being added or removed
* @param string $lastTimestamp Parent revision timestamp of this change in TS_MW format
* @param Revision|null $revision
+ * @param bool $added true, if the category was added, false for removed
*
* @throws MWException
*/
*
* @throws MWException
*/
$comment,
Title $pageTitle,
$lastTimestamp,
$comment,
Title $pageTitle,
$lastTimestamp,
) {
$deleted = $revision ? $revision->getVisibility() & Revision::SUPPRESSED_USER : 0;
$newRevId = $revision ? $revision->getId() : 0;
) {
$deleted = $revision ? $revision->getVisibility() & Revision::SUPPRESSED_USER : 0;
$newRevId = $revision ? $revision->getId() : 0;
$lastTimestamp,
$bot,
$ip,
$lastTimestamp,
$bot,
$ip,
// Never send an RC notification email about categorization changes
if (
// Never send an RC notification email about categorization changes
if (
- $this->mAttribs['rc_type'] != RC_CATEGORIZE &&
- Hooks::run( 'AbortEmailNotification', [ $editor, $title, $this ] )
+ Hooks::run( 'AbortEmailNotification', [ $editor, $title, $this ] ) &&
+ $this->mAttribs['rc_type'] != RC_CATEGORIZE
) {
// @FIXME: This would be better as an extension hook
// Send emails or email jobs once this row is safely committed
) {
// @FIXME: This would be better as an extension hook
// Send emails or email jobs once this row is safely committed
* @param bool $bot true, if the change was made by a bot
* @param string $ip IP address of the user, if the change was made anonymously
* @param int $deleted Indicates whether the change has been deleted
* @param bool $bot true, if the change was made by a bot
* @param string $ip IP address of the user, if the change was made anonymously
* @param int $deleted Indicates whether the change has been deleted
+ * @param bool $added true, if the category was added, false for removed
*
* @return RecentChange
*/
*
* @return RecentChange
*/
$lastTimestamp,
$bot,
$ip = '',
$lastTimestamp,
$bot,
$ip = '',
+ $deleted = 0,
+ $added = null
+ // Done in a backwards compatible way.
+ $params = [
+ 'hidden-cat' => WikiCategoryPage::factory( $categoryTitle )->isHidden()
+ ];
+ if ( $added !== null ) {
+ $params['added'] = $added;
+ }
+
$rc = new RecentChange;
$rc->mTitle = $categoryTitle;
$rc->mPerformer = $user;
$rc = new RecentChange;
$rc->mTitle = $categoryTitle;
$rc->mPerformer = $user;
'rc_logid' => 0,
'rc_log_type' => null,
'rc_log_action' => '',
'rc_logid' => 0,
'rc_log_type' => null,
'rc_log_action' => '',
- 'rc_params' => serialize( [
- 'hidden-cat' => WikiCategoryPage::factory( $categoryTitle )->isHidden()
- ] )
+ 'rc_params' => serialize( $params )