• 
      

    Add a new UserDetailsProvider interface, with badge support.

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

    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.
    ccd78885fef81f06464d98111466e7be3e534de5

    Description From Last Updated

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

    reviewbot reviewbot

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

    reviewbot reviewbot

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

    reviewbot reviewbot

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

    reviewbot 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 david

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

    david david

    This shouldn't have "optional" in here, since there's no default value.

    david david

    This seems like a copy-paste that wasn't updated. It should be more specific to the user info box.

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

    flake8

    chipx86
    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. 
        
    chipx86
    david
    1. 
        
    2. reviewboard/accounts/user_details.py (Diff revisions 2 - 3)
       
       
      Show all issues

      This shouldn't have "optional" in here, since there's no default value.

    3. 
        
    maubin
    1. 
        
    2. docs/manual/extending/index.rst (Diff revision 3)
       
       
       
       
      Show all issues

      This seems like a copy-paste that wasn't updated. It should be more specific to the user info box.

    3. 
        
    chipx86
    maubin
    1. Ship It!
    2. 
        
    chipx86
    Review request changed
    Status:
    Completed
    Change Summary:
    Pushed to release-7.1.x (4ceeeff)