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

refactor: Rework community views to operate on Person instead of User #5899

Merged
merged 8 commits into from
Jul 10, 2023

Conversation

pselkirk
Copy link
Collaborator

Fixes #5859

Copy link
Member

@jennifer-richards jennifer-richards left a comment

Choose a reason for hiding this comment

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

I have a few suggestions. The only one I consider essential is giving a clear error description if lookup_community_list encounters multiple matches.

ietf/community/tests.py Outdated Show resolved Hide resolved
ietf/community/tests.py Outdated Show resolved Hide resolved
ietf/community/utils.py Outdated Show resolved Hide resolved
ietf/person/utils.py Show resolved Hide resolved
if hasattr(request.user, 'person') and request.user.person in persons:
person = request.user.person
else:
raise MultiplePersonError("\r\n".join([p.user.username for p in persons]))
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 this will just return a list of usernames, which winds up displayed as the response if a user hits this. It'd be nice to provide a bit more context in the error message.

(If you're testing this in the dev browser, that often provides a much richer response when it hits an exception than happens in production)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yeah, I'm not really happy with it, but it was copied from Henrik's code in person.views.photo. I played with the idea of returning a selection list, or of showing all matching community lists on one page (as in person.views.profile), but ultimately punted in favor of preferring the logged-in user - if I'm John Doe, I probably want my community list rather than any other John Doe's. Ultimately, this is (hopefully) an extreme edge case.

Copy link
Member

Choose a reason for hiding this comment

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

That makes sense - I'm just imagining something like "Found multiple matches: " at the start of the error message to give the response some meaning for a poor user who happens upon this.

@rjsparks
Copy link
Member

rjsparks commented Jul 7, 2023

I'm planning to hold this for merge/release until after IETF 117

@rjsparks
Copy link
Member

I was being silly - the plan is to hold merging feat/user2person into main - no reason to block merging this PR into feat/user2person.

@rjsparks rjsparks merged commit 8940d33 into ietf-tools:feat/user2person Jul 10, 2023
1 check passed
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 14, 2023
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.

3 participants