Skip to content

Commit

Permalink
feat(api,app): added a FF on the new github stamps, added banner
Browse files Browse the repository at this point in the history
  • Loading branch information
aminah-io authored Jul 5, 2023
2 parents 997a4f2 + 869d64a commit 2da8fcb
Show file tree
Hide file tree
Showing 11 changed files with 571 additions and 69 deletions.
1 change: 1 addition & 0 deletions app/.env-example.env
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ NEXT_PUBLIC_FF_IDENA_STAMP=off
NEXT_PUBLIC_FF_HYPERCERT_STAMP=on
NEXT_PUBLIC_FF_PHI_STAMP=on
NEXT_PUBLIC_FF_HOLONYM_STAMP=on
NEXT_PUBLIC_FF_NEW_GITHUB_STAMPS=on
NEXT_PUBLIC_FF_ONE_CLICK_VERIFICATION=on
NEXT_PUBLIC_FF_LIVE_ALLO_SCORE=on

Expand Down
37 changes: 24 additions & 13 deletions app/__tests__/components/ExpiredStampModal.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,12 @@ describe("ExpiredStampModal", () => {
{
...mockCeramicContext,
expiredProviders: [
"githubAccountCreationGte#90",
"githubAccountCreationGte#180",
"githubAccountCreationGte#365",
"githubContributionActivityGte#30",
"githubContributionActivityGte#60",
"githubContributionActivityGte#120",
"Github",
"FiveOrMoreGithubRepos",
"ForkedGithubRepoProvider",
"StarredGithubRepoProvider",
"TenOrMoreGithubFollowers",
"FiftyOrMoreGithubFollowers",
"FirstEthTxnProvider",
"EthGTEOneTxnProvider",
],
Expand All @@ -51,12 +51,12 @@ describe("ExpiredStampModal", () => {
});
it("should get a list of all PROVIDER_ID for a given platform", () => {
expect(getProviderIdsFromPlatformId("Github")).toEqual([
"githubAccountCreationGte#90",
"githubAccountCreationGte#180",
"githubAccountCreationGte#365",
"githubContributionActivityGte#30",
"githubContributionActivityGte#60",
"githubContributionActivityGte#120",
"Github",
"FiveOrMoreGithubRepos",
"ForkedGithubRepoProvider",
"StarredGithubRepoProvider",
"TenOrMoreGithubFollowers",
"FiftyOrMoreGithubFollowers",
]);
});
it("should delete all stamps within each expired platform", async () => {
Expand All @@ -74,7 +74,18 @@ describe("ExpiredStampModal", () => {
deleteButton.click();
expect(deleteButton.getAttribute("disabled")).not.toBeNull();

expect(handleDeleteStamps).toHaveBeenCalledWith(["Facebook", "FacebookProfilePicture", "Linkedin", "Ens"]);
expect(handleDeleteStamps).toHaveBeenCalledWith([
"Github",
"FiveOrMoreGithubRepos",
"ForkedGithubRepoProvider",
"StarredGithubRepoProvider",
"TenOrMoreGithubFollowers",
"FiftyOrMoreGithubFollowers",
"Facebook",
"FacebookProfilePicture",
"Linkedin",
"Ens",
]);
await waitFor(() => expect(deleteButton.getAttribute("disabled")).toBeNull());
});
});
2 changes: 2 additions & 0 deletions iam/.env-example.env
Original file line number Diff line number Diff line change
Expand Up @@ -52,3 +52,5 @@ SCORER_API_KEY=abc

EAS_GITCOIN_STAMP_SCHEMA=0xd83994d5459162a259c3a18d3db267ca05982f1e1e261d5388a8bfe2a2a2c7f9
EAS_GITCOIN_SCORE_SCHEMA=0xd43bc76510fcedd3ee4cac1a439ed4a130736b8faba0f4a814050e948942cdc0

FF_NEW_GITHUB_STAMPS=on
6 changes: 6 additions & 0 deletions platforms/src/Github/App-Bindings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@ export class GithubPlatform extends Platform {
clientId: string = null;
redirectUri: string = null;

banner = {
heading: "Verifying Contribution Activity",
content:
"For the Contribution Activity credentials, make sure your contribution data is public. Go to Settings > Public Profile > Contributions & Activity and uncheck 'Make profile private and hide activity'. Verify your contribution history with your Gitcoin Passport!",
};

constructor(options: PlatformOptions = {}) {
super();
this.clientId = options.clientId as string;
Expand Down
166 changes: 110 additions & 56 deletions platforms/src/Github/Providers-config.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { PlatformSpec, PlatformGroupSpec, Provider } from "../types";
import { GithubAccountCreationProvider } from "./Providers/githubAccountCreation";
import { GithubContributionActivityProvider } from "./Providers/githubContributionActivity";
import * as legacyProviders from "./Providers/legacy";

export const PlatformDetails: PlatformSpec = {
icon: "./assets/githubWhiteStampIcon.svg",
Expand All @@ -10,60 +11,113 @@ export const PlatformDetails: PlatformSpec = {
connectMessage: "Connect Account",
};

export const ProviderConfig: PlatformGroupSpec[] = [
{
platformGroup: "Account Creation",
providers: [
{
title: "Created at least 90 days ago",
name: "githubAccountCreationGte#90",
},
{
title: "Created at least 180 days ago",
name: "githubAccountCreationGte#180",
},
{
title: "Created at least 365 days ago",
name: "githubAccountCreationGte#365",
},
],
},
{
platformGroup: "Contribution Activity",
providers: [
{
title: "Contributions on at least 30 distinct days",
name: "githubContributionActivityGte#30",
},
{
title: "Contributions on at least 60 distinct days",
name: "githubContributionActivityGte#60",
},
{
title: "Contributions on at least 120 distinct days",
name: "githubContributionActivityGte#120",
},
],
},
];
let providers: Provider[] = [];
let ProviderConfig: PlatformGroupSpec[] = [];

export const providers: Provider[] = [
new GithubAccountCreationProvider({
threshold: "90",
}),
new GithubAccountCreationProvider({
threshold: "180",
}),
new GithubAccountCreationProvider({
threshold: "365",
}),
new GithubContributionActivityProvider({
threshold: "30",
}),
new GithubContributionActivityProvider({
threshold: "60",
}),
new GithubContributionActivityProvider({
threshold: "120",
}),
];
if (process.env.FF_NEW_GITHUB_STAMPS === "on" || process.env.NEXT_PUBLIC_FF_NEW_GITHUB_STAMPS === "on") {
ProviderConfig = [
{
platformGroup: "Account Creation",
providers: [
{
title: "Created at least 90 days ago",
name: "githubAccountCreationGte#90",
},
{
title: "Created at least 180 days ago",
name: "githubAccountCreationGte#180",
},
{
title: "Created at least 365 days ago",
name: "githubAccountCreationGte#365",
},
],
},
{
platformGroup: "Contribution Activity",
providers: [
{
title: "Contributions on at least 30 distinct days",
name: "githubContributionActivityGte#30",
},
{
title: "Contributions on at least 60 distinct days",
name: "githubContributionActivityGte#60",
},
{
title: "Contributions on at least 120 distinct days",
name: "githubContributionActivityGte#120",
},
],
},
];

providers = [
new GithubAccountCreationProvider({
threshold: "90",
}),
new GithubAccountCreationProvider({
threshold: "180",
}),
new GithubAccountCreationProvider({
threshold: "365",
}),
new GithubContributionActivityProvider({
threshold: "30",
}),
new GithubContributionActivityProvider({
threshold: "60",
}),
new GithubContributionActivityProvider({
threshold: "120",
}),
];
} else {
ProviderConfig = [
{
platformGroup: "Account Name",
providers: [{ title: "Encrypted", name: "Github" }],
},
{
platformGroup: "Repositories",
providers: [
{
title: "Five or more Github repos",
name: "FiveOrMoreGithubRepos",
},
{
title: "At least 1 Github repo forked by another user",
name: "ForkedGithubRepoProvider",
},
{
title: "At least 1 Github repo starred by another user",
name: "StarredGithubRepoProvider",
},
],
},
{
platformGroup: "Followers",
providers: [
{
title: "Ten or more Github followers",
name: "TenOrMoreGithubFollowers",
},
{
title: "Fifty or more Github followers",
name: "FiftyOrMoreGithubFollowers",
},
],
},
];

providers = [
new legacyProviders.GithubProvider(),
new legacyProviders.FiveOrMoreGithubRepos(),
new legacyProviders.TenOrMoreGithubFollowers(),
new legacyProviders.FiftyOrMoreGithubFollowers(),
new legacyProviders.ForkedGithubRepoProvider(),
new legacyProviders.StarredGithubRepoProvider(),
];
}

export { providers, ProviderConfig };
Loading

0 comments on commit 2da8fcb

Please sign in to comment.