Preserve a user's beta preference when not in beta

The tool may go in and out of beta as new features
are release/graduated to opt-out. Users should only
need to opt in to the beta feature once to get all
future sub-features.

Bug: T272071
Change-Id: If6834b7fc07fc7e84757dc5fdcea814cd0d65936
This commit is contained in:
Ed Sanders 2021-01-14 23:44:33 +00:00
parent c42e86f0f6
commit 1c741d3450

View file

@ -393,6 +393,19 @@ class Hooks {
'type' => 'api',
];
$dtConfig = MediaWikiServices::getInstance()->getConfigFactory()
->makeConfig( 'discussiontools' );
if (
!$dtConfig->get( 'DiscussionToolsEnable' ) ||
!$dtConfig->get( 'DiscussionToolsBeta' )
) {
// When out of beta, preserve the user preference in case we
// bring back the beta feature for a new sub-feature. (T272071)
$preferences['discussiontools-betaenable'] = [
'type' => 'api'
];
}
$preferences['discussiontools-editmode'] = [
'type' => 'api',
'validation-callback' => function ( $value ) {