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

Add description meta tag to transition page #610

Merged
merged 5 commits into from
Sep 21, 2020

Conversation

xming13
Copy link
Contributor

@xming13 xming13 commented Sep 19, 2020

Problem

Closes #546

Solution

Implement getLongUrlAndDescription to retrieve long url and description for a given short url. It tries to fetch from redis cache first before falling back to fetching from database.
Injecting description meta tag to transition page is done in transition-page template.

Note:
Changes to the format of existing cache value

Old
cache key: short url
cache value: long url

New
cache key: short url
cache value: JSON.stringify({ longUrl: longUrl, description: description })

This change is backward compatible. Old cache value (ie. long url) will fail when it is parsed as json string, throwing InvalidFormatError. System will then read from database and update the cache value to the new format. Subsequent read from redis will be parsed successfully based on the new format.

Before & After Screenshots

AFTER:
image

Tests

Refer to the changes related to tests in this commit.

Deploy Notes

Monitor for backward compatibility in case anything goes wrong unexpectedly.

Copy link
Contributor

@LoneRifle LoneRifle left a comment

Choose a reason for hiding this comment

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

lgtm

@LoneRifle LoneRifle merged commit 86d65b8 into opengovsg:develop Sep 21, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add description meta tag to transition page
2 participants