Skip to content

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

Merged
rjsparks merged 8 commits intoietf-tools:feat/user2personfrom
pselkirk:feat/user2person
Jul 10, 2023
Merged

refactor: Rework community views to operate on Person instead of User#5899
rjsparks merged 8 commits intoietf-tools:feat/user2personfrom
pselkirk:feat/user2person

Conversation

@pselkirk
Copy link
Copy Markdown
Contributor

Fixes #5859

Copy link
Copy Markdown
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.

Comment thread ietf/community/tests.py Outdated
Comment thread ietf/community/tests.py Outdated
Comment thread ietf/community/utils.py Outdated
Comment thread ietf/person/utils.py
Comment thread ietf/community/utils.py Outdated
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
Copy Markdown
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
Copy Markdown
Contributor 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
Copy Markdown
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
Copy Markdown
Member

rjsparks commented Jul 7, 2023

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

@rjsparks
Copy link
Copy Markdown
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
@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