diff --git a/src/main/java/uk/ac/cam/cl/dtg/isaac/dos/content/Media.java b/src/main/java/uk/ac/cam/cl/dtg/isaac/dos/content/Media.java index 64be4fcdd3..b8812ae3b9 100644 --- a/src/main/java/uk/ac/cam/cl/dtg/isaac/dos/content/Media.java +++ b/src/main/java/uk/ac/cam/cl/dtg/isaac/dos/content/Media.java @@ -26,6 +26,7 @@ public abstract class Media extends Content { protected String src; protected String altText; + protected Boolean decorative; /** * Gets the src. @@ -65,4 +66,23 @@ public void setAltText(final String altText) { this.altText = altText; } + /** + * Gets whether the media is decorative. + * + * @return whether the media is decorative + */ + public Boolean getDecorative() { + return decorative; + } + + /** + * Sets whether the media is decorative. + * + * @param decorative + * whether the media is decorative + */ + public void setDecorative(final Boolean decorative) { + this.decorative = decorative; + } + } diff --git a/src/main/java/uk/ac/cam/cl/dtg/segue/etl/ContentIndexer.java b/src/main/java/uk/ac/cam/cl/dtg/segue/etl/ContentIndexer.java index 749e470ce3..f8759d210f 100644 --- a/src/main/java/uk/ac/cam/cl/dtg/segue/etl/ContentIndexer.java +++ b/src/main/java/uk/ac/cam/cl/dtg/segue/etl/ContentIndexer.java @@ -977,8 +977,9 @@ public void recordContentTypeSpecificError(final String sha, final Content conte } } - // check that there is some alt text. - if (f.getAltText() == null || f.getAltText().isEmpty()) { + // Check that there is some alt text. Decorative images should have empty alt text. + boolean isDecorative = null != f.getDecorative() && f.getDecorative(); + if (f.getAltText() == null || (f.getAltText().isEmpty() && !isDecorative)) { if (!(f instanceof Video) && !f.getId().equals("eventThumbnail")) { // Videos probably don't need alt text unless there is a good reason. It's not important that event // thumbnails have alt text, so we don't record errors for those either.