Giveth / giveth-dapps-v2

This project is the aggregation of GIVeconomy and Giveth.io DApps in a single repo
https://staging.giveth.io
GNU General Public License v3.0
63 stars 33 forks source link

prevent project owners from making donations to their own project on donate page #4612

Closed divine-comedian closed 1 month ago

divine-comedian commented 2 months ago

@LatifatAbdullahi found a flaw in our UX

Currently project owners are not allowed to make donations to their own project. If they try to the back-end will throw an error and the UI will show a non-descriptive error to the user.

Image

Through the navigation of the website normally the user cannot get to the donate page for a project they own. HOWEVER if they use the direct url donate/{projectSlug} it is possible for them to attempt making a donation to their project.

When a user connects to the donate page with a wallet address that matches the project owner address we should show a modal that cannot be closed as long as the same wallet address remains connected to the app.

Similar to what was done with the #4449 modal we should check this at the same point and show the modal with the following copy

Project Owner Address Detected

You cannot donate to a project you are the owner of. There are thousands of projects on Giveth looking for your support! Please choose another project to donate to.

BUTTON -> View All Projects

Requirements

maryjaf commented 2 months ago

Since we have a deploy today or tomorrow and the implementation of this new logic isn't completed, I think we should be sure that this changed will not be deployed on prod in this release. @HrithikSampson @MoeNick

MoeNick commented 2 months ago

Please simply ignore these checks if the user clicks on donating with Stellar. As far as we don;t have sign-in with Stellar, there's no way we detect the ownership of the donor to the sender address. @HrithikSampson @divine-comedian FYI

HrithikSampson commented 2 months ago

Hi @maryjaf , this issue is ready to be tested

maryjaf commented 2 months ago
  • the warning modal cannot be closed as long as the same wallet address is connected
  • [ ] switching the connected wallet address closes the modal

When this modal is shown, there is no way to switch user in donate page @HrithikSampson @divine-comedian

https://github.com/user-attachments/assets/e32292dd-2318-41c2-9417-4eea8ef4c0c3

HrithikSampson commented 2 months ago

Hi @maryjaf ,

The description also said that the modal cannot be closed,

That is why it is not allowing it to switch address in the same page

maryjaf commented 2 months ago
  • [x] switching the connected wallet address closes the modal

Yeah, you're right But I don't understand this AC and there is no way for switching user that the modal be closed Let's wait for @divine-comedian to give his opinion about this item

MoeNick commented 2 months ago

The AC is saying, if user changes the address in his wallet (like MM) DApp should detect and close it. @HrithikSampson

maryjaf commented 2 months ago

The AC is saying, if user changes the address in his wallet (like MM) DApp should detect and close it. @HrithikSampson

Thanks @HrithikSampson @MoeNick It works as expected

maryjaf commented 2 months ago

In a scenario that the project doesn't support the network, two modal is shown concurrently, is this accepted ? or some fixes should be made?

@HrithikSampson @divine-comedian If this is accepted behavior we can close this issue

image

divine-comedian commented 2 months ago

@HrithikSampson - can we modify this so the modals don't overlap - we should only show 1 modal at a time the priority for modals:

  1. project owner address modal
  2. the switch network modal

to clarify the flow should be like

HrithikSampson commented 2 months ago

@divine-comedian - I will try to fix this now.

HrithikSampson commented 1 month ago

@maryjaf , this issue is ready to be tested

maryjaf commented 1 month ago

Thanks @HrithikSampson This problem has been fixed