* @ingroup SpecialPage
*/
abstract class ChangesListSpecialPage extends SpecialPage {
+ /**
+ * Preference name for saved queries. Subclasses that use saved queries should override this.
+ * @var string
+ */
+ protected static $savedQueriesPreferenceName;
+
/** @var string */
protected $rcSubpage;
public function __construct( $name, $restriction ) {
parent::__construct( $name, $restriction );
+ $nonRevisionTypes = [ RC_LOG ];
+ Hooks::run( 'SpecialWatchlistGetNonRevisionTypes', [ &$nonRevisionTypes ] );
+
$this->filterGroupDefinitions = [
[
'name' => 'registration',
'description' => 'rcfilters-filter-lastrevision-description',
'default' => false,
'queryCallable' => function ( $specialClassName, $ctx, $dbr, &$tables, &$fields, &$conds,
- &$query_options, &$join_conds ) {
- $conds[] = 'rc_this_oldid <> page_latest';
+ &$query_options, &$join_conds ) use ( $nonRevisionTypes ) {
+ $conds[] = $dbr->makeList(
+ [
+ 'rc_this_oldid <> page_latest',
+ 'rc_type' => $nonRevisionTypes,
+ ],
+ LIST_OR
+ );
},
'cssClassSuffix' => 'last',
'isRowApplicableCallable' => function ( $ctx, $rc ) {
'description' => 'rcfilters-filter-previousrevision-description',
'default' => false,
'queryCallable' => function ( $specialClassName, $ctx, $dbr, &$tables, &$fields, &$conds,
- &$query_options, &$join_conds ) {
- $conds[] = 'rc_this_oldid = page_latest';
+ &$query_options, &$join_conds ) use ( $nonRevisionTypes ) {
+ $conds[] = $dbr->makeList(
+ [
+ 'rc_this_oldid = page_latest',
+ 'rc_type' => $nonRevisionTypes,
+ ],
+ LIST_OR
+ );
},
'cssClassSuffix' => 'previous',
'isRowApplicableCallable' => function ( $ctx, $rc ) {
// Used by "live update" and "view newest" to check
// if there's new changes with minimal data transfer
if ( $this->getRequest()->getBool( 'peek' ) ) {
- $code = $rows->numRows() > 0 ? 200 : 304;
+ $code = $rows->numRows() > 0 ? 200 : 204;
$this->getOutput()->setStatusCode( $code );
return;
}
)
);
- $experimentalStructuredChangeFilters =
- $this->getConfig()->get( 'StructuredChangeFiltersEnableExperimentalViews' );
-
$out->addJsConfigVars( 'wgStructuredChangeFilters', $jsData['groups'] );
- $out->addJsConfigVars(
- 'wgStructuredChangeFiltersEnableExperimentalViews',
- $experimentalStructuredChangeFilters
- );
+
$out->addJsConfigVars(
'wgRCFiltersChangeTags',
$this->buildChangeTagList()
'daysDefault' => $this->getDefaultDays(),
]
);
+
+ $out->addJsConfigVars(
+ 'StructuredChangeFiltersLiveUpdatePollingRate',
+ $this->getConfig()->get( 'StructuredChangeFiltersLiveUpdatePollingRate' )
+ );
+
+ if ( static::$savedQueriesPreferenceName ) {
+ $savedQueries = FormatJson::decode(
+ $this->getUser()->getOption( static::$savedQueriesPreferenceName )
+ );
+ if ( $savedQueries && isset( $savedQueries->default ) ) {
+ // If there is a default saved query, show a loading spinner,
+ // since the frontend is going to reload the results
+ $out->addBodyClasses( 'mw-rcfilters-ui-loading' );
+ }
+ $out->addJsConfigVars(
+ 'wgStructuredChangeFiltersSavedQueriesPreferenceName',
+ static::$savedQueriesPreferenceName
+ );
+ }
} else {
$out->addBodyClasses( 'mw-rcfilters-disabled' );
}
abstract function getDefaultLimit();
+ /**
+ * Get the default value of the number of days to display when loading
+ * the result set.
+ * Supports fractional values, and should be cast to a float.
+ *
+ * @return float
+ */
abstract function getDefaultDays();
}