Contents

Image safety mode

In order to protect users As a site owner I'd like to control which comments can include images

Scenario Outline: Images are embedded in comments when image safety mode is off.

  • Given the setup for testing image safety mode on <commentable>
  • And image safety mode is disabled for comments
  • When I view <commentable> with comments
  • Then I should see the image "src" text "https://example.com/image.jpg"
  • And I should not see "OMG! img src="
  • And I should see "Plain text with limited HTML" within ".new_comment"
  • But I should not see "Embedded images (<img> tags) will be displayed as HTML" within ".new_comment"
  • When I go to the homepage
  • Then I should see the image "src" text "https://example.com/image.jpg"
  • And I should not see "OMG! img src="
  • When I go to commentrecip's inbox page
  • Then I should see the image "src" text "https://example.com/image.jpg"
  • When image safety mode is enabled for comments on a "<parent_type>"
  • And I view <commentable> with comments
  • Then I should not see the image "src" text "https://example.com/image.jpg"
  • But I should see "OMG! img src="
  • And I should see "https://example.com/image.jpg"
  • And I should see "Embedded images (<img> tags) will be displayed as HTML" within ".new_comment"
  • When I go to the homepage
  • Then I should not see the image "src" text "https://example.com/image.jpg"
  • But I should see "OMG! img src="
  • And I should see "https://example.com/image.jpg"
  • When I go to commentrecip's inbox page
  • Then I should not see the image "src" text "https://example.com/image.jpg"
  • But I should see "OMG! img src="
  • And I should see "https://example.com/image.jpg"

Examples:

commentableparent_type
the admin post "Change Log"AdminPost
the work "My Opus"Chapter
the tag "No Fandom"Tag

Scenario Outline: Embedded images in comments are replaced with their URLs when image safety mode is enabled.

  • Given the setup for testing image safety mode on <commentable>
  • And image safety mode is enabled for comments on a "<parent_type>"
  • When I view <commentable> with comments
  • Then I should not see the image "src" text "https://example.com/image.jpg"
  • But I should see "OMG! img src="
  • And I should see "https://example.com/image.jpg"
  • And I should see "Embedded images (<img> tags) will be displayed as HTML" within ".new_comment"
  • When I go to the homepage
  • Then I should not see the image "src" text "https://example.com/image.jpg"
  • But I should see "OMG! img src="
  • And I should see "https://example.com/image.jpg"
  • When I go to commentrecip's inbox page
  • Then I should not see the image "src" text "https://example.com/image.jpg"
  • But I should see "OMG! img src="
  • And I should see "https://example.com/image.jpg"
  • When image safety mode is disabled for comments
  • And I view <commentable> with comments
  • Then I should see the image "src" text "https://example.com/image.jpg"
  • And I should not see "OMG! img src="
  • And I should see "Plain text with limited HTML" within ".new_comment"
  • But I should not see "Embedded images (<img> tags) will be displayed as HTML" within ".new_comment"
  • When I go to the homepage
  • Then I should see the image "src" text "https://example.com/image.jpg"
  • And I should not see "OMG! img src="
  • When I go to commentrecip's inbox page
  • Then I should see the image "src" text "https://example.com/image.jpg"
  • And I should not see "OMG! img src="

Examples:

parent_typecommentable
AdminPostthe admin post "Change Log"
Chapterthe work "My Opus"
Tagthe tag "No Fandom"

Source: features/comments_and_kudos/image_safety_mode.feature at commit f09caa86, Otwarchive (GPL license).