impact-graph
impact-graph copied to clipboard
Dont allow owner of project to donate to his/her own project
Now we dont allow it in UI, but it's better to restrict it in backend as well

@HrithikSampson Please implement this issue, it's a good task for start contributing
You need to change createDonation
in donationResolver.ts
and also please add appropriate test case in donationResolver.test.ts
to make sure your code works properly.
(For just running tests related to donation resolver you can use test:donationResolver
instead of npm run test
)
Hi @mohammadranjbarz ,I have made the changes in this pull request: https://github.com/Giveth/impact-graph/pull/1756
@maryjaf It's ready for testing now ( If you had problem to how test it DM me please)
After confirming transaction in metamask I got this error I think before this step the error message should be shown, am I right? @mohammadranjbarz
https://github.com/user-attachments/assets/e0705c2c-30a3-474f-afe7-9456b51b3d60
After confirming transaction in metamask I got this error I think before this step the error message should be shown, am I right? @mohammadranjbarz
Screen.Recording.2024-08-12.at.2.02.29.PM.mov
Thanks @maryjaf
@HrithikSampson You should do same restriction and write test cases for createDraftDonation
as well
Hi @maryjaf , I have merged the branch to staging with the restrictions added for createDraftDonation
Thanks @HrithikSampson
- [ ] 1- I think it would be good if this message in console log also be shown in UI instead of "transaction rejected"
- [ ] 2- This limitation doesn't exist in recurring donation and I could set a recurring donation for my project
https://github.com/user-attachments/assets/e4ece612-6bd0-4ca5-a2fe-6b0d585d62fb
- [ ] 3- we will have a new model for donation, donate with stellar ; this new logic also should be applied for stellar ? cc: @MoeNick @mohammadranjbarz
Thanks @HrithikSampson
- [ ] 1- I think it would be good if this message in console log also be shown in UI instead of "transaction rejected"
- [ ] 2- This limitation doesn't exist in recurring donation and I could set a recurring donation for my project
Screen.Recording.2024-08-18.at.10.45.57.AM.mov
- [ ] 3- we will have a new model for donation, donate with stellar ; this new logic also should be applied for stellar ? cc: @MoeNick @mohammadranjbarz
- I think we can do it. @HrithikSampson please try to to fix it and if you had problem ask from some FE devs (@MohammadPCh or @RamRamez )
- @HrithikSampson Please add this restriction for recurring donations as well
- @maryjaf I think it's better to add another issue in order to implemen it. @MoeNick WDYT?
Hey guys! look like this hasn't passed QA - please let @maryjaf test this out and approve before moving it to Done @HrithikSampson
We also have https://github.com/Giveth/giveth-dapps-v2/issues/4612 which is to prevent the user from attempting to make a donation directly from the donate page of the project (the back-end still rejects it but we need to handle it on the UI)
Sure @divine-comedian, @maryjaf I thought that Issue 4612(https://github.com/Giveth/giveth-dapps-v2/issues/4612) is the Frontend Version of this issue.
Thanks @HrithikSampson
- [ ] 1- I think it would be good if this message in console log also be shown in UI instead of "transaction rejected"
- [ ] 2- This limitation doesn't exist in recurring donation and I could set a recurring donation for my project
Screen.Recording.2024-08-18.at.10.45.57.AM.mov
- [ ] 3- we will have a new model for donation, donate with stellar ; this new logic also should be applied for stellar ? cc: @MoeNick @mohammadranjbarz
I've tested this issue and reported these items when they are ready for retesting, please let me know
@maryjaf check out the FE implementation of this change - read the issue and understand the proposed changes and we can follow UI changes there. https://github.com/Giveth/giveth-dapps-v2/issues/4612
In terms of preventing it from the back-end it seems this issue is complete.
Have we also tested this for Solana and Stellar addresses?
- [ ] 2- This limitation doesn't exist in recurring donation and I could set a recurring donation for my project
This item hasn't been fixed @divine-comedian @mohammadranjbarz
For Stellar please note that we only have the Stellar recipient address and the project owner does not have any Stellar address as a user-related address like Sol and Eth. So we can only avoid the recipient address as a source of donation in this case.
Have we also tested this for Solana and Stellar addresses?
for stellar @MoeNick added some description above and for solana I got an error when I try to donate, could you please take a look ? @HrithikSampson @mohammadranjbarz
https://github.com/user-attachments/assets/4f27d8d9-f4a6-4a3c-9875-9dd346c37671
Have we also tested this for Solana and Stellar addresses?
I've tested with SOL token and the correct error is shown on backend side
https://github.com/Giveth/impact-graph/issues/743#issuecomment-2324300583
@maryjaf, I have tried to resolve it and merged it to staging.