Skip to content

Commit

Permalink
Merge pull request #4348 from guardian/remove-feature-flag-for-crop-g…
Browse files Browse the repository at this point in the history
…utters

remove the feature switch `show-cropping-gutters-switch` (still GNM only)
  • Loading branch information
twrichards authored Nov 18, 2024
2 parents e0dbf8f + a7e4b8d commit 765651e
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 23 deletions.
11 changes: 2 additions & 9 deletions kahuna/app/controllers/KahunaController.scala
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package controllers
import com.gu.mediaservice.lib.argo.ArgoHelpers
import com.gu.mediaservice.lib.auth.Authentication.Principal
import com.gu.mediaservice.lib.auth.{Authentication, Authorisation, BaseControllerWithLoginRedirects}
import lib.{ExampleSwitch, FeatureSwitches, KahunaConfig, ShowCroppingGuttersSwitch}
import lib.{ExampleSwitch, FeatureSwitches, KahunaConfig}
import play.api.mvc.ControllerComponents
import play.api.libs.json._

Expand Down Expand Up @@ -38,14 +38,7 @@ class KahunaController(

val isIFramed = request.headers.get("Sec-Fetch-Dest").contains("iframe")
val featureSwitches = new FeatureSwitches(
List(
if (maybeUser.map(_.accessor.identity).exists(config.displayCropGutterByDefaultTo.contains))
ShowCroppingGuttersSwitch.copy(default = true)
else if(config.staffPhotographerOrganisation == "GNM")
ShowCroppingGuttersSwitch
else
ExampleSwitch
)
List(ExampleSwitch)
)
val featureSwitchesWithClientValues = featureSwitches.getClientSwitchValues(featureSwitches.getFeatureSwitchCookies(request.cookies.get))
val featureSwitchesJson = Json.stringify(Json.toJson(featureSwitches.getFeatureSwitchesToStringify(featureSwitchesWithClientValues)))
Expand Down
6 changes: 0 additions & 6 deletions kahuna/app/lib/FeatureSwitch.scala
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,6 @@ object ExampleSwitch extends FeatureSwitch(
default = false
)

object ShowCroppingGuttersSwitch extends FeatureSwitch(
key = "show-cropping-gutters-switch",
title = "Display gutters on 5:3 crops to show what would be clipped if used in a 5:4 space",
default = false
)

class FeatureSwitches(featureSwitches: List[FeatureSwitch]){
// Feature switches are defined here, but updated by setting a cookie following the pattern e.g. "feature-switch-my-key"
// for a switch called "my-key".
Expand Down
2 changes: 0 additions & 2 deletions kahuna/app/lib/KahunaConfig.scala
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,5 @@ class KahunaConfig(resources: GridConfigResources) extends CommonConfig(resource
.getOrElse("Not configured")

val shouldUploadStraightToBucket: Boolean = maybeIngestBucket.isDefined

val displayCropGutterByDefaultTo: Set[String] = getStringSet("displayCropGutterByDefaultTo")
}

2 changes: 0 additions & 2 deletions kahuna/public/js/crop/controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import '../components/gr-keyboard-shortcut/gr-keyboard-shortcut';
import {radioList} from '../components/gr-radio-list/gr-radio-list';
import {cropUtil} from "../util/crop";
import {cropOptions} from "../util/constants/cropOptions";
import {getFeatureSwitchActive} from "../components/gr-feature-switch-panel/gr-feature-switch-panel";

const crop = angular.module('kahuna.crop.controller', [
'gr.keyboardShortcut',
Expand Down Expand Up @@ -185,7 +184,6 @@ crop.controller('ImageCropCtrl', [
ctrl.shouldShowVerticalWarningGutters =
window._clientConfig.staffPhotographerOrganisation === "GNM"
&& cropSettings.shouldShowCropGuttersIfApplicable()
&& getFeatureSwitchActive("show-cropping-gutters-switch")
&& maybeCropRatioIfStandard === "5:3";

if (isCropTypeDisabled) {
Expand Down
5 changes: 3 additions & 2 deletions kahuna/public/js/crop/view.html
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,10 @@
Please try to use a larger crop or an alternative image.
</div>

<div class="warning status--info" ng-if="ctrl.shouldShowVerticalWarningGutters">
<div class="warning warning--multiline status--info" ng-if="ctrl.shouldShowVerticalWarningGutters">
Although this is a 5:3 crop, it might be used in a 5:4 space, so please ensure
there is nothing important in the striped sides as these might be clipped.
there is nothing important in the striped sides as these might be clipped.<br/>
You can also suggest alternative crops for the trail image back in Composer.
</div>

<div class="easel" role="main" aria-label="Image cropper"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,5 +66,5 @@
background: repeating-linear-gradient(45deg, transparent, white 1px, transparent 3px, transparent 6px);
}
.easel.vertical-warning-gutters .easel__canvas {
height: calc(100vh - 115px);
height: calc(100vh - 138px);
}
8 changes: 7 additions & 1 deletion kahuna/public/stylesheets/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -882,7 +882,13 @@ textarea.ng-invalid {
text-align: center;
}
.warning--small {
padding: 5px 10px;
padding: 5px 10px;
}
.warning--multiline {
min-height: 48px;
display: flex;
align-items: center;
justify-content: space-around;
}

.full-error {
Expand Down

0 comments on commit 765651e

Please sign in to comment.