Removing feed experiment for non-logged in user (#15733)

Related to #15240
This commit is contained in:
Jeremy Friesen 2021-12-13 15:18:26 -05:00 committed by GitHub
parent ae8d78c571
commit 509b162cd7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -241,27 +241,9 @@ class StoriesController < ApplicationController
@stories = Articles::Feeds::Latest.call
else
@default_home_feed = true
strategy = AbExperiment.get(experiment: :feed_strategy, controller: self, user: current_user,
default_value: "original")
feed = if strategy.weighted_query_strategy?
# I'm uncertain why we don't pass a user here, but it mimics
# the behavior of the original LargeForemExperimental.
Articles::Feeds::WeightedQueryStrategy.new(user: nil, page: @page, tags: params[:tag])
else
Articles::Feeds::LargeForemExperimental.new(page: @page, tag: params[:tag])
end
Datadog.tracer.trace("feed.query",
span_type: "db",
resource: "#{self.class}.#{__method__}",
tags: { feed_class: feed.class.to_s.dasherize }) do
# Hey, why the to_a you say? Because the
# LargeForemExperimental has already done this. But the
# weighted strategy has not. I also don't want to alter the
# weighted query implementation as it returns a lovely
# ActiveRecord::Relation. So this is a concession.
@featured_story, @stories = feed.featured_story_and_default_home_feed(user_signed_in: user_signed_in?)
@stories = @stories.to_a
end
feed = Articles::Feeds::LargeForemExperimental.new(page: @page, tag: params[:tag])
@featured_story, @stories = feed.featured_story_and_default_home_feed(user_signed_in: user_signed_in?)
@stories = @stories.to_a
end
@pinned_article = pinned_article&.decorate