Skip to content

Commit

Permalink
Merge pull request #27280 from guardian/ab/remove-message-us
Browse files Browse the repository at this point in the history
Remove `Message Us` feature
  • Loading branch information
abeddow91 authored Jul 8, 2024
2 parents 167dce2 + 88377e5 commit 261ac31
Show file tree
Hide file tree
Showing 17 changed files with 17 additions and 485 deletions.
21 changes: 4 additions & 17 deletions article/app/AppLoader.scala
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ import contentapi.{CapiHttpClient, ContentApiClient, HttpClient}
import controllers.{ArticleControllers, HealthCheck}
import dev.{DevAssetsController, DevParametersHttpRequestHandler}
import http.{CommonFilters, CorsHttpErrorHandler}
import jobs.{MessageUsLifecycle, StoreNavigationLifecycleComponent, TopicLifecycle}
import model.{ApplicationIdentity, MessageUsConfigData, TopicsApiResponse}
import jobs.{StoreNavigationLifecycleComponent, TopicLifecycle}
import model.{ApplicationIdentity, TopicsApiResponse}
import play.api.ApplicationLoader.Context
import play.api.BuiltInComponentsFromContext
import play.api.http.{HttpErrorHandler, HttpRequestHandler}
Expand All @@ -24,14 +24,7 @@ import router.Routes
import services.fronts.FrontJsonFapiLive
import services.newsletters.{NewsletterApi, NewsletterSignupAgent, NewsletterSignupLifecycle}
import services.ophan.SurgingContentAgentLifecycle
import services.{
MessageUsService,
NewspaperBooksAndSectionsAutoRefresh,
OphanApi,
S3Client,
S3ClientImpl,
SkimLinksCacheLifeCycle,
}
import services.{NewspaperBooksAndSectionsAutoRefresh, OphanApi, S3Client, S3ClientImpl, SkimLinksCacheLifeCycle}
import topics.TopicService

class AppLoader extends FrontendApplicationLoader {
Expand All @@ -44,12 +37,7 @@ trait TopicServices {
lazy val topicService = wire[TopicService]
}

trait MessageUsServices {
lazy val messageUsS3Client: S3Client[MessageUsConfigData] = new S3ClientImpl(Configuration.aws.messageUsStoreBucket)
lazy val messageUsService = wire[MessageUsService]
}

trait AppComponents extends FrontendComponents with ArticleControllers with TopicServices with MessageUsServices {
trait AppComponents extends FrontendComponents with ArticleControllers with TopicServices {

lazy val newsletterApi = wire[NewsletterApi]
lazy val newsletterSignupAgent = wire[NewsletterSignupAgent]
Expand Down Expand Up @@ -77,7 +65,6 @@ trait AppComponents extends FrontendComponents with ArticleControllers with Topi
wire[StoreNavigationLifecycleComponent],
wire[TopicLifecycle],
wire[NewsletterSignupLifecycle],
wire[MessageUsLifecycle],
)

lazy val router: Router = wire[Routes]
Expand Down
1 change: 0 additions & 1 deletion article/app/controllers/ArticleController.scala
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,6 @@ class ArticleController(
blocks,
pageType,
newsletter,
messageUs = None,
)
case HtmlFormat | AmpFormat =>
Future.successful(common.renderHtml(ArticleHtmlPage.html(article), article))
Expand Down
3 changes: 1 addition & 2 deletions article/app/controllers/ArticleControllers.scala
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import model.{ApplicationContext, TopicsApiResponse}
import play.api.libs.ws.WSClient
import play.api.mvc.ControllerComponents
import renderers.DotcomRenderingService
import services.{NewsletterService, NewspaperBookSectionTagAgent, NewspaperBookTagAgent, S3Client, MessageUsService}
import services.{NewsletterService, NewspaperBookSectionTagAgent, NewspaperBookTagAgent, S3Client}
import services.newsletters.NewsletterSignupAgent
import topics.TopicService

Expand All @@ -17,7 +17,6 @@ trait ArticleControllers {
def remoteRender: DotcomRenderingService
def topicS3Client: S3Client[TopicsApiResponse]
def topicService: TopicService
def messageUsService: MessageUsService
def newsletterSignupAgent: NewsletterSignupAgent

implicit def appContext: ApplicationContext
Expand Down
14 changes: 2 additions & 12 deletions article/app/controllers/LiveBlogController.scala
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import play.api.libs.ws.WSClient
import play.api.mvc._
import play.twirl.api.Html
import renderers.DotcomRenderingService
import services.{CAPILookup, NewsletterService, MessageUsService}
import services.{CAPILookup, NewsletterService}
import topics.TopicService
import utils.DotcomponentsLogger
import views.support.RenderOtherStatus
Expand All @@ -33,7 +33,6 @@ class LiveBlogController(
remoteRenderer: renderers.DotcomRenderingService = DotcomRenderingService(),
newsletterService: NewsletterService,
topicService: TopicService,
messageUsService: MessageUsService,
)(implicit context: ApplicationContext)
extends BaseController
with GuLogging
Expand Down Expand Up @@ -67,7 +66,6 @@ class LiveBlogController(
val filter = shouldFilter(filterKeyEvents)
val topicResult = if (filter) None else getTopicResult(path, topics)
val availableTopics = topicService.getAvailableTopics(path)
val messageUs = messageUsService.getBlogMessageUsData(path)

page.map(ParseBlockId.fromPageParam) match {
case Some(ParsedBlockId(id)) =>
Expand All @@ -77,7 +75,6 @@ class LiveBlogController(
filter,
topicResult,
availableTopics,
messageUs,
) // we know the id of a block
case Some(InvalidFormat) =>
Future.successful(
Expand All @@ -92,7 +89,6 @@ class LiveBlogController(
filter,
Some(value),
availableTopics,
messageUs,
) // no page param
case None =>
renderWithRange(
Expand All @@ -101,7 +97,6 @@ class LiveBlogController(
filter,
None,
availableTopics,
messageUs,
) // no page param
}
}
Expand All @@ -123,7 +118,6 @@ class LiveBlogController(
val topicResult = getTopicResult(path, topics)
val range = getRange(lastUpdate, page, topicResult)
val availableTopics = topicService.getAvailableTopics(path)
val messageUs = messageUsService.getBlogMessageUsData(path)

mapModel(path, range, filter, topicResult) {
case (blog: LiveBlogPage, _) if rendered.contains(false) => getJsonForFronts(blog)
Expand All @@ -134,7 +128,7 @@ class LiveBlogController(
* payload that would be sent to DCR when initially server side rendering the LiveBlog page.
*/
case (blog: LiveBlogPage, blocks) if request.forceDCR && lastUpdate.isEmpty =>
Future.successful(renderDCRJson(blog, blocks, filter, availableTopics, topicResult, messageUs))
Future.successful(renderDCRJson(blog, blocks, filter, availableTopics, topicResult))
case (blog: LiveBlogPage, blocks) =>
getJson(
blog,
Expand All @@ -160,7 +154,6 @@ class LiveBlogController(
filterKeyEvents: Boolean,
topicResult: Option[TopicResult],
availableTopics: Option[Seq[Topic]],
messageUs: Option[MessageUsData],
)(implicit
request: RequestHeader,
): Future[Result] = {
Expand Down Expand Up @@ -203,7 +196,6 @@ class LiveBlogController(
request.forceLive,
availableTopics,
topicResult,
messageUs,
)
} else {
DotcomponentsLogger.logger.logRequest(s"liveblog executing in web", properties, page.article)
Expand Down Expand Up @@ -377,7 +369,6 @@ class LiveBlogController(
filterKeyEvents: Boolean,
availableTopics: Option[Seq[Topic]],
topicResult: Option[TopicResult],
messageUs: Option[MessageUsData],
)(implicit request: RequestHeader): Result = {
val pageType: PageType = PageType(blog, request, context)
val newsletter = newsletterService.getNewsletterForLiveBlog(blog)
Expand All @@ -393,7 +384,6 @@ class LiveBlogController(
availableTopics,
newsletter,
topicResult,
messageUs,
)
val json = DotcomRenderingDataModel.toJson(model)
common.renderJson(json, blog).as("application/json")
Expand Down
46 changes: 0 additions & 46 deletions article/app/jobs/MessageUsLifecycle.scala

This file was deleted.

50 changes: 0 additions & 50 deletions article/app/services/MessageUsService.scala

This file was deleted.

3 changes: 1 addition & 2 deletions article/test/DCRFake.scala
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package test
import com.gu.contentapi.client.model.v1.{Block, Blocks}
import model.Cached.RevalidatableResult
import model.dotcomrendering.{OnwardCollectionResponse, PageType}
import model.{ApplicationContext, Cached, LiveBlogPage, PageWithStoryPackage, Topic, TopicResult, MessageUsData}
import model.{ApplicationContext, Cached, LiveBlogPage, PageWithStoryPackage, Topic, TopicResult}
import play.api.libs.ws.WSClient
import play.api.mvc.{RequestHeader, Result}
import play.twirl.api.Html
Expand All @@ -28,7 +28,6 @@ class DCRFake(implicit context: ApplicationContext) extends renderers.DotcomRend
forceLive: Boolean,
availableTopics: Option[Seq[Topic]],
topicResult: Option[TopicResult],
messageUs: Option[MessageUsData],
)(implicit request: RequestHeader): Future[Result] = {
implicit val ec = ExecutionContext.global
requestedBlogs.enqueue(article)
Expand Down
Loading

0 comments on commit 261ac31

Please sign in to comment.