Skip to content

Commit

Permalink
Merge pull request #4189 from guardian/graphic/default-to-on-with-too…
Browse files Browse the repository at this point in the history
…ltip
  • Loading branch information
twrichards authored Nov 9, 2023
2 parents 9195efe + ce39716 commit ce8e801
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion kahuna/public/js/services/graphic-image-blur.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@ import angular from "angular";
import 'angular-cookies';

const COOKIE_SHOULD_BLUR_GRAPHIC_IMAGES = 'SHOULD_BLUR_GRAPHIC_IMAGES';
const cookieOptions = {domain: `.${window.location.host}`, path: '/'};
const cookieOptions = {
domain: `.${window.location.host}`,
path: '/',
expires: new Date(Date.now() + 34473600000) //399 days from now (max cookie expiry time)
};

export const graphicImageBlurService = angular.module("kahuna.services.graphicImageBlur", ['ngCookies']).factory(
"graphicImageBlurService",
Expand All @@ -11,6 +15,9 @@ export const graphicImageBlurService = angular.module("kahuna.services.graphicIm
const shouldBlurGraphicImagesCookieValue = $cookies.get(COOKIE_SHOULD_BLUR_GRAPHIC_IMAGES);
const isYetToAcknowledgeBlurGraphicImages = defaultShouldBlurGraphicImages && !shouldBlurGraphicImagesCookieValue; // i.e. cookie not set, one way or the other
const shouldBlurGraphicImages = (shouldBlurGraphicImagesCookieValue || defaultShouldBlurGraphicImages.toString()) === "true";
if (!!shouldBlurGraphicImagesCookieValue){
$cookies.put(COOKIE_SHOULD_BLUR_GRAPHIC_IMAGES, shouldBlurGraphicImages.toString(), cookieOptions); // extend cookie expiry
}
return {
shouldBlurGraphicImages,
isYetToAcknowledgeBlurGraphicImages,
Expand Down

0 comments on commit ce8e801

Please sign in to comment.