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

Release Verification Emails and Admin Improvements #1884

Merged
merged 118 commits into from
Dec 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
118 commits
Select commit Hold shift + click to select a range
25f5cd5
fix: remove memo for project verification managing funds
Meriem-BM Aug 28, 2024
4f2dce1
fix: remove memo for project verification managing funds
Meriem-BM Aug 28, 2024
23bdade
add projectId and qfRoundId to qf data export
CarlosQ96 Aug 29, 2024
44488a9
fix: getDraftDonationById bug (toWalletMemo can be null)
Meriem-BM Aug 29, 2024
8128e7a
fix: add memo for stellar project address uniqueness
Meriem-BM Aug 31, 2024
ddb9d4e
fix: add memo for manage address validation
Meriem-BM Sep 1, 2024
3fe1966
fix: add duplicate address error message for stellar
Meriem-BM Sep 1, 2024
924ac42
fix: linter error
Meriem-BM Sep 1, 2024
230cc91
add index for project stellar address
Meriem-BM Sep 1, 2024
553f32b
eslint error
Meriem-BM Sep 1, 2024
ce6713e
Merge pull request #1790 from Giveth/feat/stellar_integration
Meriem-BM Sep 2, 2024
78fb64e
fix: case when owner donate to his own peoject (Stellar chain)
Meriem-BM Sep 2, 2024
0927d62
Merge pull request #1793 from Giveth/feat/stellar_integration
Meriem-BM Sep 3, 2024
6dbdffc
fix: add calculateGivbackFactor to Stellar cron job
Meriem-BM Sep 3, 2024
133f76f
Merge pull request #1795 from Giveth/feat/stellar_integration
Meriem-BM Sep 3, 2024
f77816b
onlyEndaement option added to donationResolvers to get only endaoment…
HrithikSampson Sep 4, 2024
8953798
chore: implementing coderabbitai suggestion to remove string literal
HrithikSampson Sep 4, 2024
6498495
feat: register secondary donation
Meriem-BM Sep 4, 2024
b510db1
Merge pull request #1797 from Giveth/feat/stellar_integration
Meriem-BM Sep 4, 2024
394ef30
running migration to set project banners appropriately for endaoment …
HrithikSampson Sep 4, 2024
66f3d10
Merge branch 'staging' of github.com:Giveth/impact-graph into 13_anal…
HrithikSampson Sep 6, 2024
cc79c2c
improve adminjs to import qfround matching and better filters
CarlosQ96 Sep 6, 2024
4e59a2b
fix eslint
CarlosQ96 Sep 6, 2024
2268d8c
fix: remove adding secondary donation logic
Meriem-BM Sep 7, 2024
751308d
Merge pull request #1800 from Giveth/feat/stellar_integration
Meriem-BM Sep 7, 2024
78e1911
fix minor form issues
CarlosQ96 Sep 8, 2024
84f7cca
order middleware in bootstrap file
CarlosQ96 Sep 8, 2024
d4dbb09
Merge branch 'staging' of github.com:Giveth/impact-graph into 13_anal…
HrithikSampson Sep 9, 2024
f9090c4
test: add test cases to fetch only Endaoment projects
HrithikSampson Sep 9, 2024
779f2b6
chore: change the second Project to first Project
HrithikSampson Sep 9, 2024
bc28379
chore: change the second Project to first Project
HrithikSampson Sep 9, 2024
433858b
chore: change the second Project to first Project
HrithikSampson Sep 9, 2024
1311d39
chore: change the second user to new user since it is interfering wit…
HrithikSampson Sep 10, 2024
bebce89
delete previous_round_rank when deleting a project (#1809)
mohammadranjbarz Sep 11, 2024
f85d8b4
Implement allocatedGivbacks function (#1808)
mohammadranjbarz Sep 11, 2024
9c5ab10
migration: project banners for endaoment projects need to have the co…
HrithikSampson Sep 11, 2024
5037885
Merge branch 'staging' of github.com:Giveth/impact-graph into banner-…
HrithikSampson Sep 11, 2024
1954f6e
chore: underscore before unused variable in add_endaoment_project_ban…
HrithikSampson Sep 11, 2024
52d5afa
Merge pull request #1799 from Giveth/hotfix_improve_qfround_history_m…
CarlosQ96 Sep 11, 2024
492aab4
Use Gnosis giv token for getting price of GIV
mohammadranjbarz Sep 12, 2024
bb780c2
Use superfluid mock adapter for test cases
mohammadranjbarz Sep 12, 2024
4910d7b
Use superfluid adapter on test env again
mohammadranjbarz Sep 12, 2024
b54b825
Feat/separate givback verfied (#1770)
MohammadPCh Sep 12, 2024
ffdda5a
Fix test cases related to isProjectVerified
mohammadranjbarz Sep 12, 2024
8d30b1e
add isImported And categories to project tab
CarlosQ96 Sep 12, 2024
2a564a3
fix isProjectGivbackEligible Migration in wrong folder
CarlosQ96 Sep 12, 2024
2674708
add chaintype and solana networks to tokenTab
CarlosQ96 Sep 17, 2024
bfdc9d8
Merge pull request #1827 from Giveth/hotfix_add_solana_to_adminjs_forms
CarlosQ96 Sep 17, 2024
86e315a
update branch
HrithikSampson Sep 17, 2024
1d33d40
update branch
HrithikSampson Sep 17, 2024
5d70d78
Merge branch 'staging' of github.com:Giveth/impact-graph into banner-…
HrithikSampson Sep 17, 2024
ee8617c
add environment and energy image mapping
HrithikSampson Sep 17, 2024
3d10bbf
add categories to show and edit forms in adminjs for projects
CarlosQ96 Sep 18, 2024
5c61a99
Merge pull request #1796 from Giveth/13_analytics_track_donation_stat…
HrithikSampson Sep 18, 2024
4b8d308
fix eslint
CarlosQ96 Sep 19, 2024
a14c97d
Merge pull request #1822 from Giveth/hotfix_project_additional_attrib…
CarlosQ96 Sep 19, 2024
7007987
add best match sort option
MohammadPCh Sep 19, 2024
61524cd
update addSearchQuery to prioritize the title
MohammadPCh Sep 19, 2024
93f13b6
Add Stellar to QFRound
HrithikSampson Sep 19, 2024
531e98d
Merge branch 'staging' of github.com:Giveth/impact-graph into add_ste…
HrithikSampson Sep 19, 2024
69dd31a
run linter
HrithikSampson Sep 19, 2024
7015264
Merge pull request #1831 from Giveth/add_stellar_to_qf
HrithikSampson Sep 19, 2024
d0728d8
remove eager from project categories in entity
CarlosQ96 Sep 20, 2024
f1d60da
Merge pull request #1830 from Giveth/add-best-match-sorting
MohammadPCh Sep 23, 2024
3ee817a
Add isGivbackEligible filter
mohammadranjbarz Sep 24, 2024
f49fe56
Merge branch 'staging' of github.com:Giveth/impact-graph into banner-…
HrithikSampson Sep 25, 2024
ecf4e19
Merge pull request #1813 from Giveth/banner-image-add-endaoment-project
HrithikSampson Sep 25, 2024
de13f3c
Hotfix automatic model score sync (#1849)
CarlosQ96 Oct 1, 2024
0c0aea2
merge master into staging (fix conflicts)
CarlosQ96 Oct 1, 2024
e4d210f
prevent duplicate tokens being added in adminJS
RamRamez Oct 2, 2024
046b6e8
Merge pull request #1852 from Giveth/prevent-duplicate-tokens-being-a…
RamRamez Oct 2, 2024
9cfdfc5
Ensure correct emails are sent for project status changes related to …
RamRamez Oct 2, 2024
e8a0aaa
fix test
RamRamez Oct 2, 2024
bd7c70e
fix test cases
RamRamez Oct 2, 2024
a4ae088
fix test cases
RamRamez Oct 3, 2024
f06ba5f
Merge pull request #1853 from Giveth/Ensure-correct-emails-are-sent-f…
RamRamez Oct 3, 2024
682de08
move revoke badge to project verification form section in adminJS
RamRamez Oct 6, 2024
3b06038
fix test cases
RamRamez Oct 6, 2024
d4c8068
fix test cases
RamRamez Oct 6, 2024
67b3adb
Merge pull request #1859 from Giveth/move-revoke-badge-to-project-ver…
RamRamez Oct 7, 2024
1afe41c
fix env var for model score sync
CarlosQ96 Oct 7, 2024
c2a18ae
add logs for sync score
CarlosQ96 Oct 8, 2024
e2e4369
add better logs to sync model job
CarlosQ96 Oct 8, 2024
490024e
change insertion query for userQfRoundModelScore
CarlosQ96 Oct 8, 2024
fc9d85a
remove conditional for userscore model sync
CarlosQ96 Oct 8, 2024
5e9e255
Update funding.json
GriffGreen Oct 16, 2024
f6d7b3f
add redirect util function for project custom actions (#1865)
CarlosQ96 Oct 29, 2024
d2b614d
change recurringdonation status to exclude failed (#1869)
CarlosQ96 Nov 6, 2024
be46140
Add date to qf round donation existance condition (#1870)
CarlosQ96 Nov 8, 2024
6dc5c77
fix date filters for recurringdonation stats (#1872)
CarlosQ96 Nov 12, 2024
0c4082d
Feat/User email verification
kkatusic Nov 14, 2024
d8897fa
added confirmation flow for use inputed code
kkatusic Nov 18, 2024
a7b30f6
added restriction for project and solved verification process
kkatusic Nov 19, 2024
d30ad0f
Change recurring donation stat queries totalUSD (#1873)
CarlosQ96 Nov 19, 2024
fc407fa
add distinct to recurring donation count
CarlosQ96 Nov 19, 2024
a006f8a
added tests for verification and bypassing first user update
kkatusic Nov 20, 2024
c432106
fixing project resolver test
kkatusic Nov 20, 2024
f649763
switch back variables
kkatusic Nov 20, 2024
f047276
update jwt token with isEmailVerified
kkatusic Nov 20, 2024
4b5a37d
fixing project resolver test
kkatusic Nov 21, 2024
7708ba1
remove bypassing
kkatusic Nov 21, 2024
105550a
fixing tests
kkatusic Nov 21, 2024
ae87169
fixing project resolver test
kkatusic Nov 21, 2024
ddaef95
fixing user resolver test
kkatusic Nov 21, 2024
5d7a1d0
Merge pull request #1874 from Giveth/feat/add_verify_email
kkatusic Nov 22, 2024
594842f
Fix/Email verification only for verified users
kkatusic Nov 25, 2024
04b3a19
Merge pull request #1875 from Giveth/fix/email_verification_check
kkatusic Nov 25, 2024
b77a500
separated checking for solana and etherium users
kkatusic Nov 26, 2024
4c4ae45
Merge pull request #1876 from Giveth/fix/email_verification_check
kkatusic Nov 26, 2024
9e4f75c
Remove email verification on project verification form
kkatusic Nov 27, 2024
07892ca
fixed email value
kkatusic Nov 28, 2024
97ee557
update comment
kkatusic Nov 28, 2024
b77f184
Fix socials in adminjs (#1881)
CarlosQ96 Dec 2, 2024
0d0a991
Merge branch 'staging' into feat/remove_verify_email_eligible_form
kkatusic Dec 3, 2024
1e69f7e
Merge pull request #1880 from Giveth/feat/remove_verify_email_eligibl…
kkatusic Dec 3, 2024
6850cb9
merge master into staging
CarlosQ96 Dec 3, 2024
a1acae5
revert test merge from master
CarlosQ96 Dec 3, 2024
795e035
revert instant boosting sorts for master version
CarlosQ96 Dec 3, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions config/test.env
Original file line number Diff line number Diff line change
Expand Up @@ -257,3 +257,4 @@ STELLAR_HORIZON_API_URL=https://horizon.stellar.org
STELLAR_SCAN_API_URL=https://stellar.expert/explorer/public

ENDAOMENT_ADMIN_WALLET_ADDRESS=0xfE3524e04E4e564F9935D34bB5e80c5CaB07F5b4
SYNC_USER_MODEL_SCORE_CRONJOB_EXPRESSION=0 0 */3 * *
21 changes: 21 additions & 0 deletions migration/1731071653657-addUserEmailVerificationColumns.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import { MigrationInterface, QueryRunner } from 'typeorm';

export class AddUserEmailVerificationColumns1731071653657
implements MigrationInterface
{
public async up(queryRunner: QueryRunner): Promise<void> {
queryRunner.query(`
ALTER TABLE "user"
ADD COLUMN IF NOT EXISTS "emailVerificationCode" VARCHAR,
ADD COLUMN IF NOT EXISTS "isEmailVerified" BOOLEAN DEFAULT false;
`);
}

public async down(queryRunner: QueryRunner): Promise<void> {
queryRunner.query(`
ALTER TABLE "user"
DROP COLUMN IF EXISTS "emailVerificationCode",
DROP COLUMN IF EXISTS "isEmailVerified";
`);
}
}
8 changes: 8 additions & 0 deletions src/adapters/notifications/MockNotificationAdapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,14 @@ export class MockNotificationAdapter implements NotificationAdapterInterface {
return Promise.resolve(undefined);
}

sendUserEmailConfirmationCodeFlow(params: { email: string }): Promise<void> {
logger.debug(
'MockNotificationAdapter sendUserEmailConfirmationCodeFlow',
params,
);
return Promise.resolve(undefined);
}

userSuperTokensCritical(): Promise<void> {
return Promise.resolve(undefined);
}
Expand Down
5 changes: 5 additions & 0 deletions src/adapters/notifications/NotificationAdapterInterface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,11 @@ export interface NotificationAdapterInterface {
networkName: string;
}): Promise<void>;

sendUserEmailConfirmationCodeFlow(params: {
email: string;
user: User;
}): Promise<void>;

projectVerified(params: { project: Project }): Promise<void>;
projectBoosted(params: { projectId: number; userId: number }): Promise<void>;
projectBoostedBatch(params: {
Expand Down
22 changes: 22 additions & 0 deletions src/adapters/notifications/NotificationCenterAdapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,28 @@ export class NotificationCenterAdapter implements NotificationAdapterInterface {
}
}

async sendUserEmailConfirmationCodeFlow(params: {
email: string;
user: User;
}): Promise<void> {
const { email, user } = params;
try {
await callSendNotification({
eventName:
NOTIFICATIONS_EVENT_NAMES.SEND_USER_EMAIL_CONFIRMATION_CODE_FLOW,
segment: {
payload: {
email,
verificationCode: user.emailVerificationCode,
userId: user.id,
},
},
});
} catch (e) {
logger.error('sendUserEmailConfirmationCodeFlow >> error', e);
}
}

async userSuperTokensCritical(params: {
user: User;
eventName: UserStreamBalanceWarning;
Expand Down
2 changes: 2 additions & 0 deletions src/analytics/analytics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,6 @@ export enum NOTIFICATIONS_EVENT_NAMES {
SUBSCRIBE_ONBOARDING = 'Subscribe onboarding',
CREATE_ORTTO_PROFILE = 'Create Ortto profile',
SEND_EMAIL_CONFIRMATION = 'Send email confirmation',

SEND_USER_EMAIL_CONFIRMATION_CODE_FLOW = 'Send email confirmation code flow',
}
8 changes: 8 additions & 0 deletions src/entities/user.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ export const publicSelectionFields = [
'user.totalReceived',
'user.passportScore',
'user.passportStamps',
'user.isEmailVerified',
];

export enum UserRole {
Expand Down Expand Up @@ -195,6 +196,13 @@ export class User extends BaseEntity {
@Field(_type => Float, { nullable: true })
activeQFMBDScore?: number;

@Field(_type => Boolean, { nullable: true })
@Column('bool', { default: false })
isEmailVerified: boolean;

@Column('varchar', { nullable: true, default: null })
emailVerificationCode?: string | null;

@Field(_type => Int, { nullable: true })
async donationsCount() {
// Count for non-recurring donations
Expand Down
12 changes: 7 additions & 5 deletions src/repositories/donationRepository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -661,12 +661,14 @@ export async function isVerifiedDonationExistsInQfRound(params: {
`
SELECT EXISTS (
SELECT 1
FROM donation
FROM donation as d
INNER JOIN "qf_round" as qr on qr.id = $1
WHERE
status = 'verified' AND
"qfRoundId" = $1 AND
"projectId" = $2 AND
"userId" = $3
d.status = 'verified' AND
d."qfRoundId" = $1 AND
d."projectId" = $2 AND
d."userId" = $3 AND
d."createdAt" >= qr."beginDate" AND d."createdAt" <= qr."endDate"
) AS exists;
`,
[params.qfRoundId, params.projectId, params.userId],
Expand Down
4 changes: 4 additions & 0 deletions src/repositories/projectVerificationRepository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ export const createProjectVerificationForm = async (params: {
return ProjectVerificationForm.create({
project,
user,
// This has been added becasue we are now doing verification of the email on user profile and not on project verification form
email: user?.email ?? '',
emailConfirmed: true,
emailConfirmedAt: new Date(),
} as ProjectVerificationForm).save();
};

Expand Down
2 changes: 1 addition & 1 deletion src/resolvers/donationResolver.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -715,7 +715,7 @@ function doesDonatedToProjectInQfRoundTestCases() {
await saveDonationDirectlyToDb(
createDonationData({
status: DONATION_STATUS.VERIFIED,
createdAt: moment().add(50, 'days').toDate(),
createdAt: moment().add(8, 'days').toDate(),
valueUsd: 20,
qfRoundId: qfRound.id,
}),
Expand Down
2 changes: 2 additions & 0 deletions src/resolvers/projectResolver.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5529,6 +5529,7 @@ function editProjectUpdateTestCases() {
walletAddress: generateRandomEtheriumAddress(),
loginType: 'wallet',
firstName: 'testEditProjectUpdateFateme',
isEmailVerified: true,
}).save();
const accessToken = await generateTestAccessToken(user.id);
const projectUpdateCount = await ProjectUpdate.count();
Expand Down Expand Up @@ -5644,6 +5645,7 @@ function deleteProjectUpdateTestCases() {
walletAddress: generateRandomEtheriumAddress(),
loginType: 'wallet',
firstName: 'testDeleteProjectUpdateFateme',
isEmailVerified: true,
}).save();
const accessToken = await generateTestAccessToken(user.id);
const projectUpdateCount = await ProjectUpdate.count();
Expand Down
40 changes: 40 additions & 0 deletions src/resolvers/projectResolver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1079,6 +1079,14 @@ export class ProjectResolver {
throw new Error(
i18n.__(translationErrorMessagesKeys.AUTHENTICATION_REQUIRED),
);

const dbUser = await findUserById(user.userId);

// Check if user email is verified
if (!dbUser || !dbUser.isEmailVerified) {
throw new Error(i18n.__(translationErrorMessagesKeys.EMAIL_NOT_VERIFIED));
}

const { image } = newProjectData;

// const project = await Project.findOne({ id: projectId });
Expand Down Expand Up @@ -1362,6 +1370,13 @@ export class ProjectResolver {
const user = await getLoggedInUser(ctx);
const { image, description } = projectInput;

const dbUser = await findUserById(user.id);

// Check if user email is verified
if (!dbUser || !dbUser.isEmailVerified) {
throw new Error(i18n.__(translationErrorMessagesKeys.EMAIL_NOT_VERIFIED));
}

const qualityScore = getQualityScore(description, Boolean(image), 0);

if (!projectInput.categories) {
Expand Down Expand Up @@ -1561,6 +1576,11 @@ export class ProjectResolver {
if (!owner)
throw new Error(i18n.__(translationErrorMessagesKeys.USER_NOT_FOUND));

// Check if user email is verified
if (owner && !owner.isEmailVerified) {
throw new Error(i18n.__(translationErrorMessagesKeys.EMAIL_NOT_VERIFIED));
}

const project = await findProjectById(projectId);

if (!project)
Expand Down Expand Up @@ -1616,6 +1636,16 @@ export class ProjectResolver {
);
}

const owner = await findUserById(user.userId);

if (!owner)
throw new Error(i18n.__(translationErrorMessagesKeys.USER_NOT_FOUND));

// Check if user email is verified
if (owner && !owner.isEmailVerified) {
throw new Error(i18n.__(translationErrorMessagesKeys.EMAIL_NOT_VERIFIED));
}

const update = await ProjectUpdate.findOne({ where: { id: updateId } });
if (!update)
throw new Error(
Expand Down Expand Up @@ -1648,6 +1678,16 @@ export class ProjectResolver {
i18n.__(translationErrorMessagesKeys.AUTHENTICATION_REQUIRED),
);

const owner = await findUserById(user.userId);

if (!owner)
throw new Error(i18n.__(translationErrorMessagesKeys.USER_NOT_FOUND));

// Check if user email is verified
if (owner && !owner.isEmailVerified) {
throw new Error(i18n.__(translationErrorMessagesKeys.EMAIL_NOT_VERIFIED));
}

const update = await ProjectUpdate.findOne({ where: { id: updateId } });
if (!update)
throw new Error(
Expand Down
Loading
Loading