Skip to content
This repository has been archived by the owner on Nov 23, 2023. It is now read-only.

Membership content 404 #1497

Merged
merged 3 commits into from
Feb 13, 2017
Merged

Membership content 404 #1497

merged 3 commits into from
Feb 13, 2017

Conversation

svillafe
Copy link
Contributor

@svillafe svillafe commented Feb 10, 2017

Why are you doing this?

There are several errors in Sentry (here) about requests to /membership-content which are returning 400 Bad Request. The main reason for this is because the request doesn't have the necessary query parameters. At the same time, we spotted that are crawlers that are driven traffic to /membership-content also without the required parameters.
Therefore, in this PR we are deleting one of the parameters and marking the other one as optional and if we don't receive it, we direct that traffic to the supporter landing page.

Trello card: Here and Here

Changes

  • Deleted the unnecessary membershipAccess parameter from membership-content controller.
  • Converted membership-content's parameters to Option
  • Set a redirect as a default case when we receive None.

Screenshots

/membership-content

Before After
before1 after1

/membership-content?referringContent=membership/audio/2017/feb/02/we-need-to-talk-about-climate-change-guardian-members-exclusive-podcast

Before After
before2 after-2

/membership-content?referringContent=membership/audio/2017/feb/02/we-need-to-talk-about-climate-change-guardian-members-exclusive-podcast&membershipAccess=MembersOnly

Before After
before3 after3

Santiago Villa Fernandez added 2 commits February 10, 2017 11:54
…that way we can for-yield over them and set a default behaviour.
… the cases where the query params are Empty.
@svillafe svillafe self-assigned this Feb 10, 2017
@svillafe svillafe requested a review from rtyley February 10, 2017 14:27
@@ -80,7 +80,7 @@ object Joiner extends Controller with ActivityTracking
contentURL <- contentRefererOpt if Uri.parse(contentURL).host.contains("www.theguardian.com")
access <- accessOpt
} yield {
Redirect(routes.MemberOnlyContent.membershipContent(contentURL, access.name))
Redirect(routes.MemberOnlyContent.membershipContent(Some(contentURL)))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably legacy code at this point - is anyone still directing users to /tier-chooser as a content-access handler?

}
}).getOrElse(
Redirect(routes.Joiner.tierChooser())
Future(Redirect(("https://membership.theguardian.com/supporter")))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use the reverse-routing handler!

Ok(views.html.joiner.membershipContent(pageInfo, accessOpt, signInUrl, capiContent, s"Exclusive Members Content: $headline")).
withSession(request.session + (DestinationService.JoinReferrer -> ("https://" + Config.guardianHost +"/" + referringContent)))
} else {
Redirect(("https://theguardian.com/" + referringContent))
}
}).getOrElse(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

import model._
import play.api.libs.concurrent.Execution.Implicits.defaultContext
import play.api.mvc._
import services.{GuardianContentService, _}
import views.support.PageInfo

import scala.concurrent.Future
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unnecessary import?

Copy link
Contributor Author

@svillafe svillafe Feb 13, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am using Future in line 26

@prout-bot
Copy link

Seen on PROD (merged by @svillafe 11 minutes and 39 seconds ago) Please check your changes!

@svillafe
Copy link
Contributor Author

It is working on PROD.

@prout-bot
Copy link

✅ Testing in PROD passed! Details

@svillafe svillafe deleted the membership-content-404 branch February 13, 2017 11:43
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants