Skip to content

Commit

Permalink
Merge branch 'main' into dina/update-logo-styling-for-advertising-par…
Browse files Browse the repository at this point in the history
…tner
  • Loading branch information
deedeeh authored May 16, 2024
2 parents 351b420 + a5282ac commit e29b978
Show file tree
Hide file tree
Showing 18 changed files with 716 additions and 895 deletions.
16 changes: 0 additions & 16 deletions .github/workflows/snyk-pr.yml

This file was deleted.

100 changes: 0 additions & 100 deletions .sass-lint.yml

This file was deleted.

69 changes: 69 additions & 0 deletions .stylelintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
{
"extends": "stylelint-config-standard-scss",
"ignoreFiles": [
"static/src/stylesheets/icons/**/*.scss",
"static/src/stylesheets/email/foundation-emails/**/*.scss",
"static/src/stylesheets/atoms/vars.scss"
],
"rules": {
"selector-class-pattern": null,
"at-rule-empty-line-before": null,
"selector-pseudo-element-colon-notation": null,
"scss/dollar-variable-pattern": null,
"selector-id-pattern": null,
"scss/no-global-function-names": null,
"scss/at-rule-conditional-no-parentheses": null,
"value-keyword-case": null,
"scss/load-no-partial-leading-underscore": null,
"scss/at-mixin-pattern": null,
"scss/at-mixin-argumentless-call-parentheses": null,
"no-descending-specificity": null,
"scss/operator-no-unspaced": null,
"rule-empty-line-before": null,
"scss/dollar-variable-colon-space-after": null,
"no-duplicate-selectors": null,
"length-zero-no-unit": null,
"comment-whitespace-inside": null,
"font-family-no-missing-generic-family-keyword": null,
"scss/percent-placeholder-pattern": null,
"alpha-value-notation": null,
"block-no-empty": null,
"color-function-notation": null,
"color-hex-length": null,
"comment-empty-line-before": null,
"declaration-block-no-redundant-longhand-properties": null,
"declaration-block-no-shorthand-property-overrides": null,
"declaration-block-single-line-max-declarations": null,
"declaration-empty-line-before": null,
"font-family-name-quotes": null,
"font-family-no-duplicate-names": null,
"function-linear-gradient-no-nonstandard-direction": null,
"function-url-quotes": null,
"hue-degree-notation": null,
"keyframes-name-pattern": null,
"media-feature-name-no-vendor-prefix": null,
"media-feature-range-notation": null,
"named-grid-areas-no-invalid": null,
"no-empty-source": null,
"no-invalid-position-at-import-rule": null,
"number-max-precision": null,
"property-no-unknown": null,
"property-no-vendor-prefix": null,
"scss/at-else-closing-brace-newline-after": null,
"scss/at-else-closing-brace-space-after": null,
"scss/at-else-empty-line-before": null,
"scss/at-if-closing-brace-newline-after": null,
"scss/at-if-closing-brace-space-after": null,
"scss/at-mixin-parentheses-space-before": null,
"scss/comment-no-empty": null,
"scss/dollar-variable-empty-line-before": null,
"scss/double-slash-comment-empty-line-before": null,
"scss/double-slash-comment-whitespace-inside": null,
"scss/operator-no-newline-after": null,
"selector-attribute-quotes": null,
"selector-not-notation": null,
"selector-type-no-unknown": null,
"unit-no-unknown": null,
"value-no-vendor-prefix": null
}
}
2 changes: 1 addition & 1 deletion article/app/pages/StoryHtmlPage.scala
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ object StoryHtmlPage {
if (pageWithStoryPackage.item.tags.isLiveBlog) {
Html(s"<script>window.guardian.config.page.dcrCouldRender = true</script>")
} else {
val thisDcrCouldRender: Boolean = dcrChecks(pageWithStoryPackage, request).values.forall(identity)
val thisDcrCouldRender: Boolean = dcrChecks(pageWithStoryPackage).values.forall(identity)
Html(s"<script>window.guardian.config.page.dcrCouldRender = $thisDcrCouldRender</script>")
}
}
Expand Down
10 changes: 5 additions & 5 deletions article/app/services/dotcomrendering/ArticlePicker.scala
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,15 @@ object ArticlePageChecks {

object ArticlePicker {

def dcrChecks(page: PageWithStoryPackage, request: RequestHeader): Map[String, Boolean] = {
def dcrChecks(page: PageWithStoryPackage): Map[String, Boolean] = {
Map(
("isSupportedType", ArticlePageChecks.isSupportedType(page)),
("isNotAGallery", ArticlePageChecks.isNotAGallery(page)),
)
}

private[this] def dcrArticle100PercentPage(page: PageWithStoryPackage, request: RequestHeader): Boolean = {
val allowListFeatures = dcrChecks(page, request)
private[this] def dcrArticle100PercentPage(page: PageWithStoryPackage): Boolean = {
val allowListFeatures = dcrChecks(page)
val article100PercentPageFeatures = allowListFeatures.view.filterKeys(
Set(
"isSupportedType",
Expand All @@ -45,14 +45,14 @@ object ArticlePicker {
def getTier(page: PageWithStoryPackage, path: String)(implicit
request: RequestHeader,
): RenderType = {
val checks = dcrChecks(page, request)
val checks = dcrChecks(page)
val dcrCanRender = checks.values.forall(identity)
val isNotPaidContent = ArticlePageChecks.isNotPaidContent(page)
val shouldServePressed = PressedContent.isPressed(ensureStartingForwardSlash(path)) && isNotPaidContent

val tier: RenderType = decideTier(shouldServePressed, dcrCanRender)

val isArticle100PercentPage = dcrArticle100PercentPage(page, request);
val isArticle100PercentPage = dcrArticle100PercentPage(page)
val pageTones = page.article.tags.tones.map(_.id).mkString(", ")

// include features that we wish to log but not allow-list against
Expand Down
1 change: 1 addition & 0 deletions common/app/common/configuration.scala
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ class GuardianConfiguration extends GuLogging {
lazy val baseURL = configuration.getMandatoryStringProperty("rendering.baseURL")
lazy val articleBaseURL = configuration.getMandatoryStringProperty("article-rendering.baseURL")
lazy val faciaBaseURL = configuration.getMandatoryStringProperty("facia-rendering.baseURL")
lazy val tagPageBaseURL = configuration.getMandatoryStringProperty("tag-page-rendering.baseURL")
lazy val interactiveBaseURL = configuration.getMandatoryStringProperty("interactive-rendering.baseURL")
lazy val sentryHost = configuration.getMandatoryStringProperty("rendering.sentryHost")
lazy val sentryPublicApiKey = configuration.getMandatoryStringProperty("rendering.sentryPublicApiKey")
Expand Down
10 changes: 10 additions & 0 deletions common/app/conf/switches/ABTestSwitches.scala
Original file line number Diff line number Diff line change
Expand Up @@ -64,4 +64,14 @@ trait ABTestSwitches {
sellByDate = Some(LocalDate.of(2024, 6, 7)),
exposeClientSide = true,
)

Switch(
ABTests,
"ab-deeply-read-right-column",
"Add deeply read component to the right hand column",
owners = Seq(Owner.withEmail("[email protected]")),
safeState = Off,
sellByDate = Some(LocalDate.of(2024, 7, 31)),
exposeClientSide = true,
)
}
10 changes: 10 additions & 0 deletions common/app/conf/switches/PerformanceSwitches.scala
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,16 @@ trait PerformanceSwitches {
exposeClientSide = false,
)

val CircuitBreakerDcrSwitch = Switch(
SwitchGroup.Performance,
"circuit-breaker-dcr",
"If this switch is switched on then the DCR API circuit breaker will be operational",
owners = Seq(Owner.withEmail("[email protected]")),
safeState = Off,
sellByDate = never,
exposeClientSide = false,
)

val AutoRefreshSwitch = Switch(
SwitchGroup.Performance,
"auto-refresh",
Expand Down
51 changes: 20 additions & 31 deletions common/app/experiments/Experiments.scala
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import java.time.LocalDate
object ActiveExperiments extends ExperimentsDefinition {
override val allExperiments: Set[Experiment] =
Set(
CommercialMegaTest,
DarkModeWeb,
DCRTagPages,
DCRVideoPages,
Expand All @@ -22,36 +21,6 @@ object ActiveExperiments extends ExperimentsDefinition {
implicit val canCheckExperiment: CanCheckExperiment = new CanCheckExperiment(this)
}

object CommercialMegaTest
extends Experiment(
name = "commercial-mega-test",
description = "Test the revenue effect of changes made during Q4",
owners = Seq(Owner.withEmail("[email protected]")),
sellByDate = LocalDate.of(2024, 8, 8),
participationGroup = Perc5A,
)

object DCRTagPages
extends Experiment(
name = "dcr-tag-pages",
description = "Render tag pages with DCR",
owners = Seq(Owner.withGithub("[email protected]")),
sellByDate = LocalDate.of(2024, 5, 31),
participationGroup = Perc20A,
)

object DCRVideoPages
extends Experiment(
name = "dcr-video-pages",
description = "Render video pages with DCR",
owners = Seq(
Owner.withGithub("[email protected]"),
Owner.withGithub("[email protected]"),
),
sellByDate = LocalDate.of(2024, 5, 30),
participationGroup = Perc10A,
)

object UpdatedHeaderDesign
extends Experiment(
name = "updated-header-design",
Expand Down Expand Up @@ -87,4 +56,24 @@ object UpdateLogoAdPartner
owners = Seq(Owner.withGithub("[email protected]")),
sellByDate = LocalDate.of(2024, 7, 30),
participationGroup = Perc0A,

object DCRVideoPages
extends Experiment(
name = "dcr-video-pages",
description = "Render video pages with DCR",
owners = Seq(
Owner.withGithub("[email protected]"),
Owner.withGithub("[email protected]"),
),
sellByDate = LocalDate.of(2024, 5, 30),
participationGroup = Perc10A,
)

object DCRTagPages
extends Experiment(
name = "dcr-tag-pages",
description = "Render tag pages with DCR",
owners = Seq(Owner.withGithub("[email protected]")),
sellByDate = LocalDate.of(2024, 5, 31),
participationGroup = Perc20A,
)
6 changes: 3 additions & 3 deletions common/app/renderers/DotcomRenderingService.scala
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import com.gu.contentapi.client.model.v1.{Block, Blocks, Content}
import common.{DCRMetrics, GuLogging}
import concurrent.CircuitBreakerRegistry
import conf.Configuration
import conf.switches.Switches.CircuitBreakerSwitch
import conf.switches.Switches.CircuitBreakerDcrSwitch
import crosswords.CrosswordPageWithContent
import http.{HttpPreconnections, ResultWithPreconnectPreload}
import model.Cached.{RevalidatableResult, WithoutRevalidationResult}
Expand Down Expand Up @@ -133,7 +133,7 @@ class DotcomRenderingService extends GuLogging with ResultWithPreconnectPreload
}
}

if (CircuitBreakerSwitch.isSwitchedOn) {
if (CircuitBreakerDcrSwitch.isSwitchedOn) {
circuitBreaker.withCircuitBreaker(postWithoutHandler(ws, payload, endpoint, timeout)).map(handler)
} else {
postWithoutHandler(ws, payload, endpoint, timeout).map(handler)
Expand Down Expand Up @@ -292,7 +292,7 @@ class DotcomRenderingService extends GuLogging with ResultWithPreconnectPreload
)

val json = DotcomTagPagesRenderingDataModel.toJson(dataModel)
post(ws, json, Configuration.rendering.faciaBaseURL + "/TagPage", CacheTime.Facia)
post(ws, json, Configuration.rendering.tagPageBaseURL + "/TagPage", CacheTime.Facia)
}

def getInteractive(
Expand Down
1 change: 1 addition & 0 deletions common/conf/env/DEVINFRA.properties
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ rendering.endpoint=http://localhost:3030
rendering.baseURL=http://localhost:3030
article-rendering.baseURL=http://localhost:3030
facia-rendering.baseURL=http://localhost:3030
tag-page-rendering.baseURL=http://localhost:3030
interactive-rendering.baseURL=http://localhost:3030
misc-rendering.baseURL=http://localhost:3030

Expand Down
Loading

0 comments on commit e29b978

Please sign in to comment.