Closed twrichards closed 9 months ago
Seen on cropper (merged by @twrichards 9 minutes ago) Please check your changes!
Seen on auth, image-loader (merged by @twrichards 9 minutes and 4 seconds ago) Please check your changes!
Seen on metadata-editor, collections, usage (merged by @twrichards 9 minutes and 48 seconds ago) Please check your changes!
With so many graphic images coming through as a result of the war, understandably there have been numerous requests for some mechanism to limit the effect on staff.
Preference is for blurring rather than filtering to avoid the chance of pictures being missed. Identifying graphic images is very challenging given the inconsistent ways the agencies flag such images... so this PR is to deliver the basic functionality sooner rather than later (to benefit Grid users), but we expect to further refine the criteria/heuristics for flagging such images.
Changes
Initially the 'potentially graphic image' detection was implemented via an ES Script Field (as this has access to the entire ES document, including all the original metadata where we hoping agencies would flag such images in a structured/consistent manner - alas, they do not). To aid with rapid iteration of the detection criteria/heuristics/logic the ability to control the 'painless' script was essential. There was a default, which could be overridden from the client (no build/deploy delay) via the value of a new cookie
IS_POTENTIALLY_GRAPHIC_SCRIPT
(on the parent domain, somedia-api
can see it).We also chose to have this feature 'opt-in' (at least for now), which can be done via a checkbox in the menu in the top right...
... which sets a new
SHOULD_BLUR_GRAPHIC_IMAGES
cookie (on the parent domain, somedia-api
can see it).After lots of experimentation with @paperboyo, we concluded we could actually identify the vast majority of such images by searching for a list of strings (words/phrases) within the
description
,title
,special instructions
andkeywords
- all of which is available in themedia-api
search response data - which meant this could be done purely client-side (thanks to @andrew-nowak for this nudge, after we struggled to get the OR logic working in the painless script). So I've removed the ability to edit the detection script from the client-side (via theIS_POTENTIALLY_GRAPHIC_SCRIPT
cookie) but have added logic to the server-side to detectpur:adultContentWarning
XMP field as we've observed this be used.The actual blurring is achieved via simple CSS filter with some hover behaviour to reveal and a pseudo![graphic_blur_off_by_default](https://github.com/guardian/grid/assets/19289579/0cdcc58d-db70-486e-96b9-37c865bbe7ad)
after
element to add the explanation text...In a follow-up PR, I'll look to make the list of strings configurable.