Summary
Change the "block log excerpt" component shown on Special:Contributions, and shown when editing a blocked user's userpage/user talk page, to ignore expired or removed blocks.
Background
When viewing contributions of a blocked user, above the revisions list, there is a box with the most recent block log entry that relates to this user. Prior to the introduction of multiblocks, this was a convenient place to see, what are the current block's options and what's the reason for it.
A box like this also appears when editing the userpage/user talk page of a blocked user (or when viewing a nonexistent userpage/user talk page for a blocked user).
However, as it's possible to block a user multiple times, it may happen, that for a given blocked user, the most recent entry in the block log will be of the unblock type or will relate to a block that's already expired.
Due to this behavior, wiki users may see a rather uninformative box, presented on the screenshot below. This component can be changed to fetch information from the blocks table, as I believe these are easier to query in this setting and there's already a component for presenting these on Special:Block.
This screenshot refers to a user that was (in order):
- Blocked site-wide
- Blocked partially (almost at the same time as 1.)
- Blocked site-wide (a redundant block, apparently admin wasn't aware of 1. due to 2. showing in the contribs)
- Unblocked site-wide (once, the block from 3. was removed)
User story
As an Admin, I want to see the information about the active blocks of the user, whose contributions I am browsing / whose user [talk] page I am editing, in order to decide if the block configuration is sufficient.
Acceptance criteria
- The box on Special:Contributions is updated to only display a log entry that matches a currently-active block. (https://gerrit.wikimedia.org/r/1185986)
- The box shown when editing a blocked user's userpage/talk page is updated in the same way.
- System messages used when displaying these excerpts are updated/reworded to no longer necessarily refer to the excerpt as the "latest block log entry". (if it's decided that this should happen)
- Remove messages prefixed with sp-contributions-blocked-notice, in favour of those prefixed with blocked-notice-logextract, which have been newly added.



