-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Align label
and message
props of coalesceBadge()
with internal makeBadge()
#5719
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
paulmelnikow
added
core
Server, BaseService, GitHub auth, Shared helpers
npm-package
Badge generation and badge templates
labels
Oct 16, 2020
|
paulmelnikow
commented
Oct 16, 2020
@@ -6,10 +6,6 @@ const Joi = require('joi') | |||
const makeBadge = require('../../badge-maker/lib/make-badge') | |||
const BaseSvgScrapingService = require('./base-svg-scraping') | |||
|
|||
function makeExampleSvg({ label, message }) { | |||
return makeBadge({ text: ['this is the label', 'this is the result!'] }) | |||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🙈
paulmelnikow
force-pushed
the
text-to-label-message
branch
from
October 16, 2020 04:16
c8e0c4f
to
356a9a4
Compare
chris48s
approved these changes
Oct 16, 2020
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍
paulmelnikow
added a commit
that referenced
this pull request
Oct 16, 2020
This is an analogous change to #5719 for `’template’` and `’style’`. (See the top comment for more explanation.) The diff is simpler since there are fewer test changes in this one.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
core
Server, BaseService, GitHub auth, Shared helpers
npm-package
Badge generation and badge templates
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.
There is an internal
makeBadge()
function which is called from a few places in the server and from the publicmakeBadge()
function which is a light wrapper. (Eventually we want to dogfood the public API: that's the work of #4950, and this helps with it by aligning the interfaces.)Related to that is #3370, which is about aligning the
serviceData
schema (i.e. the result ofhandle()
) with the publicmakeBadge()
function.A legacy quirk of the private
makeBadge()
function is accepting atext: ['label', 'message']
array instead of separate{ label, message }
props like the rest of the codebase.coalesceBadge()
has to translate from{ label, message }
totext: ['label', message']
. This removes that bit of indirection.It also rewrites most of the tests of
coalesceBadge()
to use.includes()
, providing IMO a slight improvement in readability.This is cherry-picked from #4980 but stops short of the more substantive (and maybe controversial) changes of that PR.