Skip to content

Conversation

@macqueen
Copy link
Contributor

@macqueen macqueen commented Dec 20, 2017

#6147 needs to be merged first

@macqueen macqueen added the WIP label Dec 20, 2017
@macqueen macqueen requested review from a team and mattrobenolt December 20, 2017 01:15
@macqueen macqueen added the wcgw label Dec 20, 2017
Copy link
Contributor Author

Choose a reason for hiding this comment

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

not sure if these should just be removed and project/org is detailed enough?

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah, I think it'd be fair to drop this.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ok, will stop writing to it in this pr (a3e5145) and put up #6856 to remove it completely

Copy link
Contributor Author

Choose a reason for hiding this comment

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

i'm not sure what the implications are of just removing these

Copy link
Contributor

Choose a reason for hiding this comment

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

@ghost
Copy link

ghost commented Dec 20, 2017

2 Warnings
⚠️ Changes require @getsentry/security sign-off
⚠️ You should update CHANGES due to the size of this PR

Security concerns found

  • src/sentry/tasks/email.py

Generated by 🚫 danger

@macqueen macqueen force-pushed the use-project-team branch 2 times, most recently from f07fa2c to 78d3c8e Compare December 21, 2017 21:23
Copy link
Member

Choose a reason for hiding this comment

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

TIL what prefetch_related does

).select_related('team')
)

# TODO(jess): decide if we should only include teams the user
Copy link
Contributor Author

Choose a reason for hiding this comment

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

gonna say it's ok to include teams a user doesn't have access to since we allow users to see team names and request access to teams they don't have access to

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah, I think that's reasonable. Teams aren't private, at least knowing they exist. Only the contents within.

@macqueen macqueen removed the WIP label Jan 3, 2018
group = self.group

headers = {
'X-Sentry-Team': project.team.slug,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Talked to Ted about these. I tried to figure out how we'd include multiple values for the same header key without much luck. Since Ted discovered that gmail doesn't even allow filtering on custom headers, we figured it was probably not worth the hassle of customizing this for each recipient and decided to just remove these.

Copy link
Contributor

@mattrobenolt mattrobenolt left a comment

Choose a reason for hiding this comment

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

Overall, this looks fine from a high level. There's a lot of stuff going on and mass rewriting of every usage, so it's hard to get a grasp if this will 100% work, but this is best we can do without just trying it.

🦄

if not result:
return result

return any([
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: the [] bit isn't needed. You can just do return any(has_team_permission(request, team, self.scope_map) for team in project.teams.all())

There's also value in that wihtout the [] it's lazily evaluated as a generator and will return when the first one is truthy.

raise ResourceDoesNotExist

if request.access.has_team_scope(project.team, 'project:write'):
has_team_scope = any([
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: same here with any()

).select_related('team')
)

# TODO(jess): decide if we should only include teams the user
Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah, I think that's reasonable. Teams aren't private, at least knowing they exist. Only the contents within.

def get_attrs(self, item_list, user):
project_qs = list(
Project.objects.filter(
project_team_qs = list(
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: This is named as _qs implying it's a QuerSet, and it's just a list. I know this preexisted, but might as well change it since you already did.

key=lambda x: x.name.lower()
)

teams_by_project = {p.id: set() for p in project_list}
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: this could be replaced by defaultdict(set)

remove outdated todo

fix tests

add a few more todos, remove team slug from email headers

update ProjectView to inherit from org view instead of team

have project serializer use new relation

fix mysql tests

update test fixtures to use teams kwarg

stop writing team to deleted project audit

remove todo i handled in a different PR

remove team x header

make fixtures create_project backwards compatible for other repos

matt pr feedback
@macqueen macqueen merged commit 6a49f5e into master Jan 11, 2018
@macqueen macqueen deleted the use-project-team branch January 11, 2018 20:21
@github-actions github-actions bot locked and limited conversation to collaborators Dec 22, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants