-
-
Notifications
You must be signed in to change notification settings - Fork 771
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
add 'stop work & slash' button #1343
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1343 +/- ##
==========================================
- Coverage 30.27% 30.25% -0.03%
==========================================
Files 125 125
Lines 9003 9041 +38
Branches 1156 1160 +4
==========================================
+ Hits 2726 2735 +9
- Misses 6169 6197 +28
- Partials 108 109 +1
Continue to review full report at Codecov.
|
The code is losing ~0.07% because the if/else statement in dashboard/views.py is extended. I can write it in one line, but i don't know if it would be a good idea. |
reviewing now |
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.
just tested. code looks good.. seems to be working @mbeacom what do you think
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.
Generally, lgtm. Any reason for using an int in the url path versus a param?
Not a big game changer, but using a int in url we can reduce the size of the if/else statement inside views.uninterested(). |
app/assets/v2/js/shared.js
Outdated
var slashed = '0'; | ||
var success_message = 'Contributor removed from bounty.'; | ||
|
||
if (slash) { |
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.
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.
I agree with this. Additionally, we could probably swap this out to simply use a POST param versus the URL defined variable, defaulting to False
if the request.POST
param isn't present.
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.
Updating the code to use a POST param, as the @mbeacom said.
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.
Do you think it's better send the POST param only when the slash
is true? Makes more sense to me always send it.
@owocki Are we married to "slash" here? Thoughts on Note: I understand the hunter wrote this to the spec, so I wouldn't expect him to modify this. Just something we might want to consider before we push it live. |
app/dashboard/views.py
Outdated
@@ -347,7 +350,10 @@ def uninterested(request, bounty_id, profile_id): | |||
bounty.interested.remove(interest) | |||
maybe_market_to_slack(bounty, 'stop_work') | |||
maybe_market_to_user_slack(bounty, 'stop_work') | |||
event_name = "bounty_removed_by_staff" if is_staff else "bounty_removed_by_funder" | |||
if is_staff: | |||
event_name = "bounty_removed_slashed_by_staff" if request.POST['slashed'] == 'true' else "bounty_removed_by_staff" |
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.
E501 line too long (126 > 120 characters)
app/dashboard/views.py
Outdated
@@ -342,12 +345,16 @@ def uninterested(request, bounty_id, profile_id): | |||
{'error': 'Only bounty funders are allowed to remove users!'}, | |||
status=401) | |||
|
|||
slashed = request.POST['slashed'] == 'true' |
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.
You could do: slashed = request.POST.get('slashed')
here and you would only need to pass slashed
if it's a reputation adverse event.
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 the tip!
app/app/urls.py
Outdated
@@ -84,7 +84,7 @@ | |||
path('actions/bounty/<int:bounty_id>/interest/new/', dashboard.views.new_interest, name='express-interest'), | |||
path('actions/bounty/<int:bounty_id>/interest/remove/', dashboard.views.remove_interest, name='remove-interest'), | |||
path( | |||
'actions/bounty/<int:bounty_id>/interest/<int:profile_id>/uninterested/', | |||
'actions/bounty/<int:bounty_id>/interest/<int:profile_id>/uninterested/<int:slash>/', |
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.
Can we drop the additional var in this URL?
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.
Yep, code updated!
app/assets/v2/js/shared.js
Outdated
@@ -220,13 +230,21 @@ var mutate_interest = function(bounty_pk, direction, data) { | |||
}; | |||
|
|||
|
|||
var uninterested = function(bounty_pk, profileId) { | |||
var uninterested = function(bounty_pk, profileId, slash) { | |||
var data = {} |
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.
Missing semicolon. (semi)
I just used slash bc its what Vlad Zamfir uses as a verb when he talks about Proof of Stake. I'm not married to it; and I don't feel strongly in either direction (as this is an admin only functionality) |
Description
implement the 'stop work & slash' feature
Refers/Fixes
closes #1340