Added more filter options to $wgRCFeeds
authorTyler Anthony Romeo <tylerromeo@gmail.com>
Thu, 6 Feb 2014 08:20:27 +0000 (03:20 -0500)
committerLegoktm <legoktm.wikipedia@gmail.com>
Mon, 7 Apr 2014 23:36:36 +0000 (23:36 +0000)
Changed RecentChange::notifyRCFeeds() to allow more
filter options than just omit_bots. In order to mirror
the on-wiki Special:RecentChanges UI, the options
omit_anon, omit_user, omit_minor, omit_patrolled were added,
which omits anonymous, registered, minor, and patrolled
edits, respectively.

Bug: 60941
Change-Id: I716c741f1f7d42b6506a97e9a5733beac23ac16c

includes/DefaultSettings.php
includes/changes/RecentChange.php

index eb8ba5c..8f3de1a 100644 (file)
@@ -5637,6 +5637,10 @@ $wgRC2UDPOmitBots = false;
  *   * 'formatter' -- the class name (implementing RCFeedFormatter) which will
  *     produce the text to send.
  *   * 'omit_bots' -- whether the bot edits should be in the feed
+ *   * 'omit_anon' -- whether anonymous edits should be in the feed
+ *   * 'omit_user' -- whether edits by registered users should be in the feed
+ *   * 'omit_minor' -- whether minor edits should be in the feed
+ *   * 'omit_patrolled' -- whether patrolled edits should be in the feed
  *  The IRC-specific options are:
  *   * 'add_interwiki_prefix' -- whether the titles should be prefixed with
  *     the first entry in the $wgLocalInterwikis array (or the value of
index 072aa12..7705c10 100644 (file)
@@ -331,11 +331,23 @@ class RecentChange {
        public function notifyRCFeeds() {
                global $wgRCFeeds;
 
+               $performer = $this->getPerformer();
+
                foreach ( $wgRCFeeds as $feed ) {
-                       $omitBots = isset( $feed['omit_bots'] ) ? $feed['omit_bots'] : false;
+                       $feed += array(
+                               'omit_bots' => false,
+                               'omit_anon' => false,
+                               'omit_user' => false,
+                               'omit_minor' => false,
+                               'omit_patrolled' => false,
+                       );
 
                        if (
-                               ( $omitBots && $this->mAttribs['rc_bot'] ) ||
+                               ( $feed['omit_bots'] && $this->mAttribs['rc_bot'] ) ||
+                               ( $feed['omit_anon'] && $performer->isAnon() ) ||
+                               ( $feed['omit_user'] && !$performer->isAnon() ) ||
+                               ( $feed['omit_minor'] && $this->mAttribs['rc_minor'] ) ||
+                               ( $feed['omit_patrolled'] && $this->mAttribs['rc_patrolled'] ) ||
                                $this->mAttribs['rc_type'] == RC_EXTERNAL
                        ) {
                                continue;