Page MenuHomePhabricator

Not possible to disable/enable footer behaviour on RelatedArticles on a desktop site on a per wiki basis
Closed, ResolvedPublic

Description

To ensure this is recorded and explicit for anyone who might want to roll out RelatedArticles to the desktop site:

Imagine the following currently impossible scenarios:

  • French Wikinews want to have related articles in stable on the desktop site (but all other wikis do not)
  • We want to run an A/B test on a wiki project's desktop site to see if the engagement rate is higher when the audience includes anonymous readers
  • We want to disable related pages on the desktop site in beta features but keep it running on the mobile site for all users.

We currently have no mechanism to do either of these things.

Acceptance critera

  • I have BetaFeatures extension installed, wgRelatedArticlesFooterBlacklistedSkins = [], wgRelatedArticlesShowInFooter = true, wgRelatedArticlesEnabledSamplingRate = 1

When I visit the Vector desktop skin I should see the related pages widget.

  • I do not have BetaFeatures extension installed, wgRelatedArticlesFooterBlacklistedSkins = [], wgRelatedArticlesShowInFooter = true, wgRelatedArticlesEnabledSamplingRate = 1

When I visit the Vector desktop skin I should see the related pages widget.

Event Timeline

Jdlrobson renamed this task from Not possible to enable RelatedArticles on a desktop site on a per wiki basis to Not possible to enable footer behaviour on RelatedArticles on a desktop site on a per wiki basis.Sep 27 2016, 5:10 PM
ovasileva triaged this task as Medium priority.Sep 27 2016, 5:14 PM
ovasileva added a project: Web-Team-Backlog.
ovasileva moved this task from Incoming to Triaged but Future on the Web-Team-Backlog board.

We want to run an A/B test on a wiki project's desktop site to see if the engagement rate is higher when the audience includes anonymous readers.

I suggest that we create a task for exactly this when we want to do it, otherwise we run the risk of creating tasks enumerating the myriad things our software doesn't do /cc @ovasileva

^ The above being said, thanks for taking the time to highlight this.

I wrote the task as I found it confusing during the code review process. I would have preferred for us to fix it at the time it was highlighted as now I worry this will never get fixed, which is a shame that we've built something that is not easy for 3rd parties to use. I see this as technical debt that we've acquired for ourselves.

Hopefully, we will be forced to tackle this when disabling on beta on various projects. When that happens the extension will only show cards at the bottom of the Minerva skin at which point we might question why it's in its own extension at all.

Change 326238 had a related patch set uploaded (by Phuedx):
Do not disable footer feature when BetaFeatures is not installed

https://gerrit.wikimedia.org/r/326238

Change 326238 merged by jenkins-bot:
Do not disable footer feature when BetaFeatures is not installed

https://gerrit.wikimedia.org/r/326238

@Jdlrobson: With my answer to T146436#2673202 and rERAR3cf6d638f7bb: Do not disable footer feature when BetaFeatures is not installed having been merged – thanks again @Tgr! – I think that this task can be resolved.

@phuedx nope.
It's still not possible to enable RelatedPages on desktop if you have the BetaFeatures extension installed.

return !class_exists( 'BetaFeatures' ) || BetaFeatures::isFeatureEnabled( $user, 'read-more' );

If BetaFeatures is not installed this evaluates as
!false ||

If BetaFeatures is not installed this will evaluate as:
!true || <true or false>

I've updated the acceptance criteria and https://www.mediawiki.org/wiki/Extension:RelatedArticles#Configuration to explain better.

Change 335864 had a related patch set uploaded (by Jdlrobson):
Allow more control for skins should show Related pages as beta feature

https://gerrit.wikimedia.org/r/335864

^ and there's an attempt to try and clean this up.

Jdlrobson renamed this task from Not possible to enable footer behaviour on RelatedArticles on a desktop site on a per wiki basis to Not possible to disable/enable footer behaviour on RelatedArticles on a desktop site on a per wiki basis.Feb 6 2017, 7:40 PM
Jdlrobson updated the task description. (Show Details)

Both the current config variables and those proposed in rERARfdb9cac2e409: Allow more control for skins should show Related pages as beta feature suffer from the same issue: they couple whether or not the feature should be enabled with when it can be shown. AFAICT the feature is enabled by default unless the Beta Features extension is installed, in which case it's enabled if the user has enabled it via the Special:Preferences page.

Strawman Config Variables

  • wgRelatedArticlesFooterBetaFeature – whether the footer feature is enabled as a beta feature. If this is true and the Beta Features extension isn't installed, then an exception should be thrown.

FooterHooks::isFeatureEnabled now becomes something like:

includes/FooterHooks.php
private static function isFeatureEnabled( User $user ) {
  $config = self::getConfig();
  $isBetaFeature = $config->get( 'RelatedArticlesFooterBetaFeature' );

  if ( !$isBetaFeature ) {
    return true; // Enabled by default.
  }

  self::assertBetaFeaturesExtensionInstalled(); // Or whatever...

  return BetaFeatures::isFeatureEnabled( $user, 'read-more' );
}

This isn't the cleanest it could be IMO but refactoring FooterHooks is out of scope for this task.

  • wgRelatedArticlesFooterSkinWhitelist – skins that are allowed to display the footer feature.

FooterHooks::shouldShowFeature now becomes something like:

includes/FooterHooks.php
private static function isFeatureAllowed( Skin $skin ) {
  $config = self::getConfig();
  
  return in_array( $skin->getName(), $config->get( 'RelatedArticlesFooterSkinWhitelist' ) );
}

private static function shouldShowFeature( User $user, Skin $skin ) {
  if ( !self::isFeatureEnabled( $user ) || !self::isFeatureAllowed( $skin ) ) {
    return false;
  }

  // ...
}

I've moved this to Needs Analysis to reflect that we need to talk about how we're intending on deploying the footer feature on desktop and mobile before we start making changes to how it's configured /cc @ovasileva

Jdlrobson changed the task status from Open to Stalled.Feb 8 2017, 5:05 PM

This is no longer blocking T157372 so I've pulled it out of the sprint, but this is a real problem that we should address sooner rather than later. Regardless of our plans on rolling out RelatedArticles, we should support related articles across all skins. The existing code is hacky it includes an explicit test for the minerva skin.

There are 2 ways I can see us removing this issue

  1. We remove it as a desktop beta feature and enforce the blacklist as a blacklist should work. A wiki can either enable it or disable it on a skin but they cannot try it out as a beta feature.
  2. We add additional logic to support skins we want this to be available as a beta feature on (what the attached patch does)
  3. We add a beta flag which enables it as a beta feature on mobile and desktop, but doesn't allow you to beta it on one of these platforms.

Change 335864 abandoned by Jdlrobson:
Allow more control for skins should show Related pages as beta feature

Reason:
Pending discussion on task.

https://gerrit.wikimedia.org/r/335864

due to no immediate plans for graduating related pages from beta on mobile, we will be removing the feature . See T160076: Disable related pages on desktop beta mode

I should note T136228 exists (ht wiki apparently wanted this on desktop) so let's talk about this along with the discussion on T146436.

Jdlrobson changed the task status from Open to Stalled.Mar 17 2017, 4:58 PM
Jdlrobson removed a project: Patch-For-Review.

Change 344723 had a related patch set uploaded (by Jdlrobson):
[mediawiki/extensions/RelatedArticles@master] Remove Related Articles form desktop beta features

https://gerrit.wikimedia.org/r/344723

Change 344723 merged by jenkins-bot:
[mediawiki/extensions/RelatedArticles@master] Remove Related Articles from desktop beta features

https://gerrit.wikimedia.org/r/344723