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

Fixes #196: Private projects only visible to organization members #214

Merged
merged 1 commit into from
Jun 6, 2016

Conversation

linzjax
Copy link
Contributor

@linzjax linzjax commented Jun 3, 2016

  • Dashboard only displays projects the user has view access to.
  • Organization dashboard only displays private projects if user is a member of that organization.
  • Organization list view only shows number of public projects, unless the user is a member of a specific organization, in which case it shows the real amount.
  • Added fixtures for private projects.

@ian-ross ian-ross force-pushed the bugs/private-projects-display branch from 31d0d57 to df3054b Compare June 5, 2016 13:23
@register.filter(name='private')
def private(value):
projects = value.filter(access='public')
return projects.count()
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't like this. It's better to avoid custom template tags unless you really need them. This looks like something that ought to be a method on the Organization model -- maybe private_project_count and all_project_count methods to cover the two cases you use in the template?

@ian-ross ian-ross force-pushed the bugs/private-projects-display branch 2 times, most recently from 522e495 to 58c7f73 Compare June 5, 2016 14:10
@linzjax linzjax force-pushed the bugs/private-projects-display branch 2 times, most recently from 1d5f4e9 to 69de03f Compare June 6, 2016 15:28
@linzjax
Copy link
Contributor Author

linzjax commented Jun 6, 2016

Fixed. Let me know if there's anything else. (That was much easier than whatever it was I was trying to do...)

- Also only visible on organization dashboard if user is a member of that organization.
- Added tests

Organization list view now only shows number of public projects, unless the user is a member of a specific organization

deleted templatetags. added methods to model
@ian-ross ian-ross force-pushed the bugs/private-projects-display branch from 69de03f to d406463 Compare June 6, 2016 16:25
@ian-ross
Copy link
Contributor

ian-ross commented Jun 6, 2016

Looks good. Just waiting for tests to run again (I rebased after merging another PR), then I'll merge it.

You might want to take a look at Two Scoops of Django if you've not already seen it. It's pretty good about guiding you away from complicated things to simpler solutions (that's where I got the "don't use custom templatetags" advice from -- I had one myself before, and ended up getting rid of it and simplifying things a bit too).

@ian-ross ian-ross merged commit e20fadd into master Jun 6, 2016
@ian-ross ian-ross deleted the bugs/private-projects-display branch June 6, 2016 16:43
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.

3 participants