Add a new UserDetailsProvider interface, with badge support.

Review Request #14283 — Created Jan. 2, 2025 and updated

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.

Summary ID
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

Description From Last Updated

'io.StringIO' imported but unused Column: 1 Error code: F401

reviewbotreviewbot

'reviewboard.accounts.user_details.UserBadge' imported but unused Column: 1 Error code: F401

reviewbotreviewbot

'reviewboard.extensions.hooks.users.UserBadgeInfo' imported but unused Column: 5 Error code: F401

reviewbotreviewbot

line too long (82 > 79 characters) Column: 80 Error code: E501

reviewbotreviewbot

This looks like it's out of date/copy-pasted from elsewhere. Should say it returns a SafeString of the HTML for all …

daviddavid

Can we move the definition of css_class down so it's right above its use?

daviddavid
Checks run (1 failed, 1 succeeded)
flake8 failed.
JSHint passed.

flake8

chipx86
Review request changed
Change Summary:
  • Removed unused imports.
  • Fixed a line length issue.
Commits:
Summary ID
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.
70f647b787a24926709d67a021e20d6ff372c85e
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

Checks run (2 succeeded)

flake8 passed.
JSHint passed.
david
  1. 
      
  2. reviewboard/accounts/templatetags/accounts.py (Diff revision 2)
     
     
     
     
     
     
     
     
     
     
     
     
     
     
    Show all issues

    This looks like it's out of date/copy-pasted from elsewhere. Should say it returns a SafeString of the HTML for all badges.

  3. reviewboard/accounts/user_details.py (Diff revision 2)
     
     
     
     
     
     
     
     
     
    Show all issues

    Can we move the definition of css_class down so it's right above its use?

  4.