Add banner opencollective.com/$slug/financial-contributors.svg #502
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.
Following this route entry:
opencollective-images/src/server/routes.js
Line 72 in f2ca296
the controller method will render users by fetching them from the api:
opencollective-images/src/server/controllers/banner.js
Line 39 in f2ca296
In the
fetchMembers
method thebackerType
param will be handled if its value iscontributors
:opencollective-images/src/server/lib/graphql.js
Line 185 in f2ca296
or if its value is
sponsor[s]
,organization[s]
orindividual[s]
andbacker[s]
(which theelse
branch does not check for these two values, so I guess there is some other routing/proxy going on beforeopencollective-images
processes the url?)opencollective-images/src/server/lib/graphql.js
Lines 204 to 209 in f2ca296
Now that allows us to build following urls:
These 4 generate the same svg:
These 4 generate the same svg:
Finally a svg for contributors:
s
, becausematching
wasn't used)Now with this pull request we would also have:
which would display all financial contributors, bascially a sum of the above individuals + organizations.
This is bascially the same concept you use in the badge when you render
https://opencollective.com/playframework/all/badge.svg
which renders:
Looking at the
badge.js
source:opencollective-images/src/server/controllers/badge.js
Lines 21 to 30 in f2ca296
where you label
all
backers asfinancial contributors
by default.And even more important that's what you do in the graphql query as well, you just fetch "all" "backers" and define them as "financial contributors" in the last
else
here:opencollective-images/src/server/lib/graphql.js
Lines 110 to 119 in f2ca296
So that's what I do in the pull request as well to render
financial-contributor.svg
:I just pass
null
astype
, to fetch all organizations, users, etc. and therole = 'BACKER';
line makes sure they are all backers.What do you think?
I think it makes sense 😉