Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bugfix] Use safe nav operator to handle nil descriptions on announcement index page #904

Conversation

samudary
Copy link
Collaborator

@samudary samudary commented Mar 16, 2021

Why

Prior to introducing the presence validation on Announcement#description, several announcements were created in production without a description. This broke the announcement index page because there were a couple references that depend on a description present.

What

Fixes #888

  • Uses safe navigation operator when referencing a description on the announcement index page
  • Casts the description length to an integer to conditionally render a truncated description and more link

How

N/A

Testing

N/A

Next Steps

N/A

Outstanding Questions, Concerns and Other Notes

N/A

Accessibility

Security

Meta

Pre-Merge Checklist

  • Security & accessibility have been considered
  • Tests have been added, or an explanation has been given why the features cannot be tested
  • Documentation and comments have been added to the codebase where required
  • Entry added to CHANGELOG.md if appropriate
  • Outstanding questions and concerns have been resolved
  • Any next steps have been turned into Issues or Discussions as appropriate

Prior to introducing the presence validation on Announcement.description, several announcements were created in production without a description. This broke nil description references and this approach returns nil as a fallback and facilitates type casting
@samudary
Copy link
Collaborator Author

@maebeale Ready for review

Copy link
Collaborator

@maebeale maebeale left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Thanks! :)

@solebared solebared merged commit 70455bc into rubyforgood:main Mar 16, 2021
@samudary samudary deleted the 888/bugfix/render-announcements-nil-description branch March 16, 2021 14:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

/announcements breaks if any announcement has no description
3 participants