Add a new UserDetailsProvider interface, with badge support.
Review Request #14283 — Created Jan. 2, 2025 and updated
This introduces a new concept for extensions and users, User Details
Providers, implemented as subclasses ofUserDetailsProvider
. This is
a class that can build upon to let exetnsions provide additional
information about users without needing to worry about extendingUser
,
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.
Summary | ID |
---|---|
ccd78885fef81f06464d98111466e7be3e534de5 |
Description | From | Last Updated |
---|---|---|
'io.StringIO' imported but unused Column: 1 Error code: F401 |
reviewbot | |
'reviewboard.accounts.user_details.UserBadge' imported but unused Column: 1 Error code: F401 |
reviewbot | |
'reviewboard.extensions.hooks.users.UserBadgeInfo' imported but unused Column: 5 Error code: F401 |
reviewbot | |
line too long (82 > 79 characters) Column: 80 Error code: E501 |
reviewbot | |
This looks like it's out of date/copy-pasted from elsewhere. Should say it returns a SafeString of the HTML for all … |
david | |
Can we move the definition of css_class down so it's right above its use? |
david | |
This shouldn't have "optional" in here, since there's no default value. |
david | |
This seems like a copy-paste that wasn't updated. It should be more specific to the user info box. |
maubin |
- Change Summary:
-
- Removed unused imports.
- Fixed a line length issue.
- Commits:
-
Summary ID 70f647b787a24926709d67a021e20d6ff372c85e 18ea34617edd8f9ba378bbbb14124f84c2aaf54a - Diff:
-
Revision 2 (+1224 -26)
Checks run (2 succeeded)
- Change Summary:
-
get_user_badges()
now takes a Local Site and request.- Fixed using the wrong user objects for badges in some places.
- Fixed outdated docstrings.
- Reordered some code to keep definitions and logic together.
- Commits:
-
Summary ID 18ea34617edd8f9ba378bbbb14124f84c2aaf54a 4c249d51d8c849b9a1d9c2db16b5973ae4b72ef6 - Diff:
-
Revision 3 (+1298 -26)
Checks run (2 succeeded)
- Change Summary:
-
- Removed an incorrect
, optional
from a parameter. - Fixed documentation for the
UserInfoboxHook
summary.
- Removed an incorrect
- Commits:
-
Summary ID 4c249d51d8c849b9a1d9c2db16b5973ae4b72ef6 ccd78885fef81f06464d98111466e7be3e534de5 - Diff:
-
Revision 4 (+1296 -26)