ORES extension should not modify $wgHiddenPrefs at runtime
Closed, ResolvedPublic

Description

In PreferencesHookHandler::onGetPreferences():

		// Hide RC/wL prefs if enhanced filters are enabled
		$context = new DerivativeContext( RequestContext::getMain() );
		$context->setUser( $user );
		$context->setRequest( new DerivativeRequest( $context->getRequest(), [] ) );
		$rcFiltersEnabled = Hooks::isRCStructuredUiEnabled( $context );
		// HACK: Note that this only hides the preferences on the preferences page,
		// it does not cause them to behave as if they're set to their default value,
		// because this hook only runs on the preferences page.
		if ( $rcFiltersEnabled ) {
			$wgHiddenPrefs[] = 'ores-damaging-flag-rc';
		}

That's really evil. There has to be a better way to do this.

Legoktm created this task.Nov 21 2017, 1:03 AM
Restricted Application added a subscriber: Aklapper. · View Herald Transcript

It would be great if there was. We tried to find a better way of doing this when doing a similar thing in core(!), but couldn't really figure anything out there either: https://gerrit.wikimedia.org/r/#/c/388264/13..14/includes/Preferences.php

Maybe this is a feature that we should add to the preferences system? Or can it already be done and are we missing something?

It would be great if there was. We tried to find a better way of doing this when doing a similar thing in core(!), but couldn't really figure anything out there either: https://gerrit.wikimedia.org/r/#/c/388264/13..14/includes/Preferences.php

This is definitely not acceptable for core :/

Maybe this is a feature that we should add to the preferences system? Or can it already be done and are we missing something?

Can this be done with HTMLForm's hide-if functionality? Or maybe just some JavaScript that hides it from the UI depending upon the other value kinda like HTMLSelectOrOther.

jmatazzoni added a subscriber: jmatazzoni.

I see this is about hiding the ORES prefs when the New Filters are active. I just filed a ticket—which @Petar.petkovic is working on—that ends the practice of hiding and showing preferences based on the New Filters status: T180866. So does that resolve this?

It might? I'm not sure tbh. We can keep this one open since it's a specific tech debt issue, and if fixing that bug happens to fix this one as well, that's great :)

In T181015#3778532, @Legoktm wrote:

It might? I'm not sure tbh. ...

@Petar.petkovic, will it?

In T181015#3778532, @Legoktm wrote:

It might? I'm not sure tbh. ...

@Petar.petkovic, will it?

I just checked and his WIP patch does in fact remove all $wgHiddenPrefs usage.

In T181015#3778680, @Catrope wrote:

I just checked and his WIP patch does in fact remove all $wgHiddenPrefs usage.

So should we resolve this?

Petar.petkovic closed this task as Resolved.Nov 21 2017, 10:36 PM
Petar.petkovic claimed this task.

Yes, I did remove this piece of code in my WIP patch. Reopen the ticket if you deem necessary.

Thank you @Catrope for answering.