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

Suggestion feedback and accepting altered suggestions #4659

Merged
merged 26 commits into from
Apr 29, 2016

Conversation

ta2-1
Copy link
Contributor

@ta2-1 ta2-1 commented Apr 20, 2016

This PRs addresses #2596 and #4629 issues.

@dwaynebailey, @iafan: you have discussed how we should credit author of suggestion which was accepted with alteration. This PR splits accepting suggestion with alteration into two actions:

  • accepting suggestion without alteration;
  • submitting altered translation;
    It was the quickest possible way how I could do it. I realise that such solution doesn't address all concerns but I suggest to consider them after we land this.

SubmissionTypes.SUGG_REJECT: _(u'Rejected suggestion from %s',
author_link)}
return description_dict.get(self.submission_type, None)
SubmissionTypes.SUGG_ACCEPT: _(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we break up this method, its really hard to understand like this

@ta2-1 ta2-1 force-pushed the suggestion_feedback_ui branch 5 times, most recently from 5631ddc to 78b6482 Compare April 21, 2016 22:36
@@ -236,7 +238,7 @@ def grouped_entries(self):
grouped_entries.reverse()
return grouped_entries

@property
@cached_property
def submissions(self):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think keep this as a @Property that returns a qs, and add a cached_property submission_values or similar that turns it into a regular list

@ta2-1 ta2-1 force-pushed the suggestion_feedback_ui branch 2 times, most recently from c2d984e to 1ea7cb5 Compare April 22, 2016 13:20

@cached_property
def comments(self):
return dict([
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we rename this comment_dict or similar

@phlax
Copy link
Member

phlax commented Apr 22, 2016

lgtm with the caveat that this increases complexity/untested code in an area of the code that could do with tests and refactoring.

I have opened tickets for tests (#4668) and refactoring (#4669)

@phlax
Copy link
Member

phlax commented Apr 22, 2016

... i didnt clicky test @ta2-1, but can if you wish.

also, just to say thanks for the great work @ta2-1 !



@pytest.mark.django_db
def test_reject_suggestion_with_comment(rf, admin):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we make this test for request_users and make sure that the other users get the approp response, probs sim elsewhere

@unho
Copy link
Member

unho commented Apr 22, 2016

Reviewed and tested. gtm.

author_link),
SubmissionTypes.SUGG_REJECT: _(u'Rejected suggestion from %s',
author_link)}
SubmissionTypes.SUGG_ACCEPT: _(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we break these out to separate methods/attributes/properties

they are kinda hard to follow atm

@@ -219,6 +251,29 @@ def submissions(self):
creation_time=self.object.commented_on)
.order_by("id"))

@cached_property
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

im not sure there is much point using a cached_property if we dont do list() on the result

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hi @phlax, it should be cached because we call it twice otherwise. but probs I misunderstood.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thinking about it you are right, i suppose i just wonder if we should turn it into a list

@julen
Copy link
Contributor

julen commented Apr 29, 2016

Very well done, @ta2-1! This is GTM from my side.

@phlax
Copy link
Member

phlax commented Apr 29, 2016

great work, thanks @ta2-1

@phlax
Copy link
Member

phlax commented Apr 29, 2016

and @julen !

@ta2-1
Copy link
Contributor Author

ta2-1 commented Apr 29, 2016

Thanks for your help @julen!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants