-
Notifications
You must be signed in to change notification settings - Fork 15
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
Feat/15886093 reputation cancel #3322
base: master
Are you sure you want to change the base?
Conversation
c0099a8
to
c60c833
Compare
@CzarekDryl looks like it needs another rebase on |
87e902e
to
f782dda
Compare
@jakubcolony @arrenv Branch rebased and ready to review |
4113c5c
to
255d868
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@CzarekDryl Thank you for the work on this, and your patience. I have noticed a couple of things.
-
This translation error appeared when the Advanced payment was created.
-
Two cancelled pills appeared, there should be only one pill in the timeline.
-
The staking decision method does not trigger the transaction to create the payment.
-
Cancelling with Reputation after the Funding step resulted in the following, you should still be able to cancel after funding and the cancel pill should appear after the funding step.
255d868
to
b0a6149
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice start of this, I'm able to get through the entire flow.
There is an issue that if you reject the first motion and start another one, when the cancel step reappears it loads into the first motion rather than the staking stage of the second one, so it looks like it is in a broken state.
And I'm experiencing the same issue as Arren when attempting to cancel after the funding stage.
It also seemed odd that the cancel motion step completely disappears if you reject the motion, I think you should still be able to access the failed motions and the step should remain visible, especially if there are unclaimed stakes / rewards.
957a3a5
to
d01637e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@CzarekDryl Thank you for your hard work on this. I noticed a few things while testing:
-
Canceling with Permissions after the Review stage resulted in the first incomplete action timeline, and if after funding, the second screenshot.
-
Can these have a hover state when there are multiple cancellation requests:
-
In this case I created a motion to cancel the action, then while voting I used Permissions to cancel it right away. It cancelled correctly but stayed in this view. Is it possible to remove all the following steps in the timeline and show a message in this case. Something like this Figma link.
-
It seems if there are any still running motions then the extra steps in the timeline persists, despite a motion already passing and being finalized and the action being cancelled. It should remove all steps if the action has been cancelled.
-
Claiming staked tokens shows this broken pending button, however, is it possible to auto return this stakes when cancelling?
-
Cancelling with permissions with no penalty showed this timeline, it should have the step label be "Cancel", as the stakes have already be returned, the text should be "The action was canceled and cannot be executed."
Figma link showing expected designs
- While testing, I noticed that we a missing the indicator as to whether the cancellation motion is penalising or not, can we add a pill to a motion item like this design? Figma link.
@arrenv Everything should be fixed now, please check it again. Penalty badge added to cancel request item. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your work on this PR @CzarekDryl, generally most of the functionality is there, but I spotted a few issues.
There appears to be regression around how cancel in review step is displayed:
The note in the Cancel modal should display the actual role held by the user instead of hardcoded Payer:
I was able to get into a broken state by quickly funding or releasing a payment while the funding motion was loading. The UI should be disabled during that period:
Screen.Recording.2024-12-11.at.23.02.55.mov
When cancelling a staked expenditure with penalise option, the modal gets stuck in Pending. There are errors in the console which are most likely due to the fact the UI is trying to reclaim stake (which has been forfeited) - I commented on where I think it happens in code.
The same thing happens with cancelling via motions, on motion finalization.
Penalise badge has a border that is not in the designs:
- Figma
Other flows tested which mostly work well:
Cancelling via permissions, non-staked expenditure:
- At Funding:
- At Release:
Cancelling via reputation, non-staked expenditure:
Cancelling via permissions, staked:
Cancelling via reputation, staked expenditure:
if (penalise) { | ||
await cancelStakedExpenditureViaMotion(stakedMotionPayload); | ||
} else { | ||
await cancelExpenditureViaMotion(motionPayload); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Which saga to use should not depend on penalise
but rather on the expenditure type - if staked, cancelStakedExpenditureViaMotion
should always be used. You can pass the penalise
as shouldPunish
param to the saga.
} else if (penalise) { | ||
await cancelStakedExpenditure(stakedPayload); | ||
await reclaimExpenditureStake(reclaimPayload); | ||
} else { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similarly here, cancelStakedExpenditure
should always be used for staked expenditure regardless of penalise
value.
Also, if creator was penalised, they lost their stake, so there is nothing to claim.
@@ -0,0 +1,80 @@ | |||
import clsx from 'clsx'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a way to reuse code from similar components? Composition via props could be used for elements specific to this type of action, e.g. the penalise badges.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jakubcolony Can we do this in other issue and refactor all request items?
@jakubcolony Everything should be fixed, please check it :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice one @CzarekDryl, it is looking and working really well.
I did still run into a couple of things, not sure if they should be tackled in this PR.
-
If created using staking, and when finalizing a cancelation or using permissions to cancel I received this transaction error in the console.
-
If cancelling with Permissions and penalising, or not, it does not show which option was selected in the card, where it has been added when you use Reputation.
-
I received this error in the console when trying to stake, despite having more then enough tokens to stake.
@arrenv I've added badge while using permissions and it's in finalize pill And I'm not able to replicate console errors: Screen.Recording.2024-12-17.at.13.44.48.movScreen.Recording.2024-12-13.at.14.47.47.mov |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you @CzarekDryl, looking great, tested all scenarios I could think of and all works as expected.
I have just seen this @CzarekDryl, is this related to this PR? |
22e07b0
to
6263a83
Compare
@arrenv I've checked and all descriptions work fine for me |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Re-approving after a rebase
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for another round of changes @CzarekDryl, mostly looking good but I'm still seeing some issues with staked expenditure.
When cancelling using permissions, the cards are different depending on whether the creator was punished or not.
If punished, no label is displayed informing of this:
If not punished, an extra Finalize step is added to the stepper:
It appears that the UI is still trying to reclaim the stake even though the payment creator was penalised, leading to some errors in the console:
I am still able to click around the UI while the cancel modal is in pending state. That's how I got the "Paid" label as well as a cancellation request in progress:
Otherwise, things are working well:
fix after rebase fix: translations, duplicated steps fix: cancel step fixes after rebase fix: auto claim, stepper Feat: Add willPunishExpenditureStaker field to colony motion feat: add penalty badge fix: pending buttons, penalise saga fix: types fix: permission badge
6263a83
to
0b9ce27
Compare
@jakubcolony All fixed |
Description
This PR introduces options for penalizing or not penalizing the cancellation of staked payments. It also implements a reputation method for canceling after the locked state and the handling of multiple cancellation requests.
Testing
Main issue - #2256