Merge "Disable (instead of hiding) preferences that would have no effect"

This commit is contained in:
jenkins-bot 2022-06-02 09:29:14 +00:00 committed by Gerrit Code Review
commit 5e6583428f

View file

@ -90,17 +90,17 @@ class PreferenceHooks implements
isset( $preferences['discussiontools-' . HookUtils::REPLYTOOL] ) || isset( $preferences['discussiontools-' . HookUtils::REPLYTOOL] ) ||
isset( $preferences['discussiontools-' . HookUtils::NEWTOPICTOOL] ) isset( $preferences['discussiontools-' . HookUtils::NEWTOPICTOOL] )
) ) { ) ) {
// Hide this option when it would have no effect // Disable this option when it would have no effect
// (both reply tool and new topic tool are disabled) // (both reply tool and new topic tool are disabled)
$preferences['discussiontools-' . HookUtils::SOURCEMODETOOLBAR]['hide-if'] = [ 'AND' ]; $preferences['discussiontools-' . HookUtils::SOURCEMODETOOLBAR]['disable-if'] = [ 'AND' ];
if ( isset( $preferences['discussiontools-' . HookUtils::REPLYTOOL] ) ) { if ( isset( $preferences['discussiontools-' . HookUtils::REPLYTOOL] ) ) {
$preferences['discussiontools-' . HookUtils::SOURCEMODETOOLBAR]['hide-if'][] = [ $preferences['discussiontools-' . HookUtils::SOURCEMODETOOLBAR]['disable-if'][] = [
'===', 'discussiontools-' . HookUtils::REPLYTOOL, '' '===', 'discussiontools-' . HookUtils::REPLYTOOL, ''
]; ];
} }
if ( isset( $preferences['discussiontools-' . HookUtils::NEWTOPICTOOL] ) ) { if ( isset( $preferences['discussiontools-' . HookUtils::NEWTOPICTOOL] ) ) {
$preferences['discussiontools-' . HookUtils::SOURCEMODETOOLBAR]['hide-if'][] = [ $preferences['discussiontools-' . HookUtils::SOURCEMODETOOLBAR]['disable-if'][] = [
'===', 'discussiontools-' . HookUtils::NEWTOPICTOOL, '' '===', 'discussiontools-' . HookUtils::NEWTOPICTOOL, ''
]; ];
} }
@ -109,8 +109,8 @@ class PreferenceHooks implements
if ( isset( $preferences['discussiontools-' . HookUtils::AUTOTOPICSUB] ) && if ( isset( $preferences['discussiontools-' . HookUtils::AUTOTOPICSUB] ) &&
isset( $preferences['discussiontools-' . HookUtils::TOPICSUBSCRIPTION] ) isset( $preferences['discussiontools-' . HookUtils::TOPICSUBSCRIPTION] )
) { ) {
// Hide automatic subscriptions when subscriptions are disabled // Disable automatic subscriptions when subscriptions are disabled
$preferences['discussiontools-' . HookUtils::AUTOTOPICSUB]['hide-if'] = [ $preferences['discussiontools-' . HookUtils::AUTOTOPICSUB]['disable-if'] = [
'===', 'discussiontools-' . HookUtils::TOPICSUBSCRIPTION, '' '===', 'discussiontools-' . HookUtils::TOPICSUBSCRIPTION, ''
]; ];
} }