guardian / guardian/notifications-tooling
US-37 — Replace the article thumbnail image for an App Alert
- Dominant language
- TypeScript
- Stars
- 3
- Forks
- 0
- Avg merge
- 1d 9h
- Merged PRs (30d)
- 109
Description
### User story
_As an App Alert notification author, I want to replace the thumbnail image imported from the main article so that I can choose a more appropriate image for the App Alert._
### Acceptance scenarios
```gherkin
Feature: Replace the article thumbnail image for an App Alert
Background:
Given the author is creating an App Alert
And a valid Guardian article has been imported
And the article thumbnail image is enabled
Scenario: Display the Replace image option
Given the imported article has a thumbnail image
When the App Alert form is displayed
Then a "Replace image" option should be displayed beneath the article thumbnail image control
And the Replace image section should be collapsed by default
And the section should be visually presented as secondary to the main App Alert form
Scenario: Open the Replace image section
Given the Replace image section is collapsed
When the author selects "Replace image"
Then the Replace image accordion should expand
And guidance explaining how to replace the image should be displayed
And a replacement image URL field should be displayed
And an "Update" action should be displayed
Scenario: Close the Replace image section
Given the Replace image section is expanded
When the author selects "Replace image" again
Then the Replace image accordion should collapse
Scenario: Replace the imported thumbnail image
Given the Replace image section is expanded
And the author has entered a valid Guardian image URL
When the author selects "Update"
Then the replacement image should be associated with the App Alert
And the replacement image should be used instead of the originally imported article thumbnail
And a success message should confirm that the image has been updated
Scenario: Reflect the replacement image in the App Alert preview
Given the author has successfully replaced the article thumbnail image
When the App Alert preview is displayed
Then the preview should use the replacement image
And the originally imported article thumbnail should no longer be shown in the preview
Scenario: Send an App Alert using the replacement image
Given the author has successfully replaced the article thumbnail image
And the App Alert is otherwise valid for sending
When the author sends the App Alert
Then the App Alert delivery request should use the replacement image
And the originally imported article thumbnail should not be used for that App Alert
Scenario: Hide Replace image when the article thumbnail is disabled
Given the "Show article thumbnail image" control is enabled
And the Replace image option is visible
When the author disables "Show article thumbnail image"
Then the article thumbnail should be suppressed
And the "Replace image" option should no longer be displayed
Scenario: Show Replace image when the article thumbnail is enabled
Given the "Show article thumbnail image" control is disabled
When the author enables "Show article thumbnail image"
Then the "Replace image" option should be displayed
Scenario: Attempt to update without a replacement image URL
Given the Replace image section is expanded
And the replacement image URL field is empty
When the author attempts to update the image
Then the existing article thumbnail should remain unchanged
And the image should not be reported as successfully updated
Scenario: Attempt to use an invalid replacement image
Given the Replace image section is expanded
And the author has entered an invalid or unsupported image URL
When the author selects "Update"
Then the existing article thumbnail should remain unchanged
And an error should indicate that the replacement image could not be used
Scenario: Replacement image update fails
Given the author has entered a valid replacement image URL
And the image update cannot be completed
When the author selects "Update"
Then the existing article thumbnail should remain unchanged
And the author should be informed that the image could not be updated
And a success message should not be displayed
```
### Checklist
- [x] Add a "Replace image" accordion beneath the article thumbnail image control.
- [x] Keep the Replace image accordion collapsed by default.
- [x] Indent/style the section so that it is clearly secondary and optional.
- [x] Add explanatory copy for replacing the existing image.
- [x] Provide a field for entering a Guardian image URL.
- [x] Provide an "Update" action.
- [x] Validate the replacement image before replacing the existing thumbnail.
- [x] Display a success message after a successful image update.
- [ ] Display an appropriate error state when an image cannot be updated.
- [ ] Keep the existing thumbnail unchanged when replacement fails.
- [x] Update the App Alert preview to use the replacement image.
- [x] Ensure the final App Alert delivery uses the replacement image.
- [x] Hide the Replace image functionality when "Show article thumbnail image" is disabled.
- [x] Make the Replace image option available when "Show article thumbnail image" is enabled.
- [x] Ensure replacing an image is optional and does not prevent an author from sending an App Alert with the originally imported thumbnail.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.