Add description meta tag to transition page #610
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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:
Tests
Refer to the changes related to tests in this commit.
Deploy Notes
Monitor for backward compatibility in case anything goes wrong unexpectedly.