public function execute( $subpage ) {
$this->rcSubpage = $subpage;
- $this->setHeaders();
- $this->outputHeader();
- $this->addModules();
-
$rows = $this->getRows();
$opts = $this->getOptions();
if ( $rows === false ) {
$rows = new FakeResultWrapper( [] );
}
+ // Used by Structured UI app to get results without MW chrome
+ if ( $this->getRequest()->getVal( 'action' ) === 'render' ) {
+ $this->getOutput()->setArticleBodyOnly( true );
+ }
+
+ // 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 : 204;
+ $this->getOutput()->setStatusCode( $code );
+ return;
+ }
+
$batch = new LinkBatch;
foreach ( $rows as $row ) {
$batch->add( NS_USER, $row->rc_user_text );
}
}
$batch->execute();
+
+ $this->setHeaders();
+ $this->outputHeader();
+ $this->addModules();
$this->webOutput( $rows, $opts );
$rows->free();
/**
* Include the modules and configuration for the RCFilters app.
* Conditional on the user having the feature enabled.
+ *
+ * If it is disabled, add a <body> class marking that
*/
protected function includeRcFiltersApp() {
+ $out = $this->getOutput();
if ( $this->isStructuredFilterUiEnabled() ) {
- $out = $this->getOutput();
$jsData = $this->getStructuredFilterJsData();
$messages = [];
$messages[$key] = $this->msg( $key )->plain();
}
+ $out->addBodyClasses( 'mw-rcfilters-enabled' );
+
$out->addHTML(
ResourceLoader::makeInlineScript(
ResourceLoader::makeMessageSetScript( $messages )
'wgStructuredChangeFiltersEnableExperimentalViews',
$experimentalStructuredChangeFilters
);
- $out->addJsConfigVars(
- 'wgStructuredChangeFiltersEnableLiveUpdate',
- $this->getConfig()->get( 'StructuredChangeFiltersEnableLiveUpdate' )
- );
$out->addJsConfigVars(
'wgRCFiltersChangeTags',
$this->buildChangeTagList()
'daysDefault' => $this->getDefaultDays(),
]
);
+ } else {
+ $out->addBodyClasses( 'mw-rcfilters-disabled' );
}
}
* ChangesListFilterGroup constructors.
*
* There is light processing to simplify core maintenance.
+ * @param array $definition
*/
protected function registerFiltersFromDefinitions( array $definition ) {
$autoFillPriority = -1;
$opts->add( 'invert', false );
$opts->add( 'associated', false );
$opts->add( 'urlversion', 1 );
+ $opts->add( 'tagfilter', '' );
return $opts;
}
*
* @return bool
*/
- protected function isStructuredFilterUiEnabled() {
- return $this->getUser()->getOption( 'rcenhancedfilters' );
+ public function isStructuredFilterUiEnabled() {
+ if ( $this->getRequest()->getBool( 'rcfilters' ) ) {
+ return true;
+ }
+
+ if ( $this->getConfig()->get( 'StructuredChangeFiltersShowPreference' ) ) {
+ return !$this->getUser()->getOption( 'rcenhancedfilters-disable' );
+ } else {
+ return $this->getUser()->getOption( 'rcenhancedfilters' );
+ }
+ }
+
+ /**
+ * Check whether the structured filter UI is enabled by default (regardless of
+ * this particular user's setting)
+ *
+ * @return bool
+ */
+ public function isStructuredFilterUiEnabledByDefault() {
+ if ( $this->getConfig()->get( 'StructuredChangeFiltersShowPreference' ) ) {
+ return !$this->getUser()->getDefaultOption( 'rcenhancedfilters-disable' );
+ } else {
+ return $this->getUser()->getDefaultOption( 'rcenhancedfilters' );
+ }
}
abstract function getDefaultLimit();