Add a new UserDetailsProvider interface, with badge support.

Review Request #14283 — Created Jan. 2, 2025 and submitted — Latest diff uploaded

Information

Review Board
release-7.1.x

Reviewers

This introduces a new concept for extensions and users, User Details
Providers, implemented as subclasses of UserDetailsProvider. This is
a class that can build upon to let exetnsions provide additional
information about users without needing to worry about extending User,
Profile, or implementing whole new hooks.

UserDetailsProvider subclasses can be registered in a central registry
and then implement methods to provide certain kinds of details that
Review Board can then query for additional functionality.

Right now, these can provide badges for users. Badges are shown
alongside a user's name in certain parts of the UI (infoboxes and
discussions, currently). They contain text and may contain custom CSS or
even custom HTML.

This is purely built for extension authors to take advantage of, giving
companies greater control over Review Board.

Unit tests passed.

Tested with an extension that added some hard-coded badges. Verified these
showed up in reviews, discussions, and infoboxes.

Diff Revision 2

This is not the most recent revision of the diff. The latest diff is revision 4. See what's changed.

orig
1
2
3
4

Commits

First Last Summary ID Author
Add a new UserDetailsProvider interface, with badge support.
This introduces a new concept for extensions and users, User Details Providers, implemented as subclasses of `UserDetailsProvider`. This is a class that can build upon to let exetnsions provide additional information about users without needing to worry about extending `User`, `Profile`, or implementing whole new hooks. `UserDetailsProvider` subclasses can be registered in a central registry and then implement methods to provide certain kinds of details that Review Board can then query for additional functionality. Right now, these can provide badges for users. Badges are shown alongside a user's name in certain parts of the UI (infoboxes and discussions, currently). They contain text and may contain custom CSS or even custom HTML. This is purely built for extension authors to take advantage of, giving companies greater control over Review Board.
18ea34617edd8f9ba378bbbb14124f84c2aaf54a Christian Hammond
docs/manual/extending/index.rst
docs/manual/extending/coderef/index.rst
docs/manual/extending/extensions/hooks/index.rst
docs/manual/extending/extensions/hooks/user-details-provider-hook.rst
docs/stories/components/users/user-badges.stories.ts
reviewboard/accounts/user_details.py
reviewboard/accounts/templatetags/accounts.py
reviewboard/accounts/tests/test_template_tags.py
reviewboard/accounts/tests/test_user_badge.py
reviewboard/extensions/hooks/__init__.py
reviewboard/extensions/hooks/users.py
reviewboard/extensions/tests/test_user_details_provider_hook.py
reviewboard/static/rb/css/bundles/common.less
reviewboard/static/rb/css/ui/infoboxes.less
reviewboard/static/rb/css/ui/user-badge.less
reviewboard/templates/accounts/user_infobox.html
reviewboard/templates/reviews/review_reply.html
reviewboard/templates/reviews/entries/review.html
Loading...