Page MenuHomePhabricator

On Special:Contributions, add IDs to items under mw-contributions-user-tools / mw-changeslist-links
Open, Needs TriagePublic

Description

If you go to https://en.wikipedia.org/wiki/Special:Contributions/Example and look at the block log/uploads/etc links at the top (in the #contentSub element) you'll see that they don't have IDs, which makes it hard to apply JS and CSS to, making it so that people have to use workarounds (such as checking the url of the link) in order to apply JS and CSS, which seems hacky and makes it hard for non-EN languages, which use different urls then EN.

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald TranscriptMar 25 2020, 3:19 AM
Aklapper changed the task status from Open to Stalled.Mar 25 2020, 9:09 AM

Hi @TerraCodes, please read https://www.mediawiki.org/wiki/How_to_report_a_bug and always provide a clear list of exact steps to reproduce.
I have no idea which exact "contribs pages" this task is about. Special:Log/block ? Special:Uploads ? The latter redirects me to Special:ListFiles instead?
Please don't make people guess - thanks. :)

Yeah I probably could have been clearer, I'll edit the task a bit. Also its not really a bug unless they're intentionally supposed to have IDs but don't, but I'll add steps to reproduce anyhow.

TerraCodes updated the task description. (Show Details)Mar 26 2020, 4:14 AM
Aklapper changed the task status from Stalled to Open.Mar 26 2020, 11:35 AM

So this seems to be about:

<div class="mw-contributions-user-tools">
  For <a href="/wiki/User:Example" title="User:Example">Example</a>
  <span class="mw-changeslist-links">
    <span><a href="/wiki/User_talk:Example" title="User talk:Example">talk</a></span>
    <span><a href="/w/index.php?title=Special:Log/block&amp;page=User%3AExample" title="Special:Log/block">block log</a></span>
    <span><a href="/wiki/Special:ListFiles/Example" title="Special:ListFiles/Example">uploads</a></span>
    <span><a href="/wiki/Special:Log/Example" title="Special:Log/Example">logs</a></span>
    <span><a href="/w/index.php?title=Special:AbuseLog&amp;wpSearchUser=Example" title="Edit Filter log for this user">filter log</a></span>
  </span>
</div>
Aklapper renamed this task from ContentSub links on contribs pages should have IDs to On Special:Contributions, add IDs to items under mw-contributions-user-tools / mw-changeslist-links.Mar 26 2020, 11:36 AM
Guywan added a subscriber: Guywan.EditedMar 26 2020, 9:23 PM

What's wrong with a little jQuery and JavaScript?

children = $(".mw-changeslist-links")[0].children;

Now you have an array of the five spans, with which you can apply styling. No?

$(children[0]).css("background-color", "red");

I don't see why these elements need ids.

@Guywan: The OP brings up the fact that, since the only thing available to distinguish each individual item are the href and title, it can be difficult to style any one in particular, since those are localized. The set of links isn't the same, mind you; they vary according to the viewing user's usergroups. children[1], etc. isn't the same for everyone, everywhere (maybe 0 and -1 are?).

Yeah, and I'd like a way that doesn't feel hacky (like trying to match the url of a page), or hoping that the elements are in the same order everytime, which might not be true if you inject custom links.

Starting to make more sense. I'll just fade into obscurity now .... *disappears*

SD0001 added a subscriber: SD0001.Apr 1 2020, 4:17 PM

This turns out to be pretty easy to do (atleast for MW core, I haven't tried messing with AbuseFilter or etc yet), so I'm gonna take a crack at this.

Change 603941 had a related patch set uploaded (by TerraCodes; owner: TerraCodes):
[mediawiki/core@master] Adds IDs to links in mw-contributions-user-tools

https://gerrit.wikimedia.org/r/603941

@Aklapper would this be something that needs to go in the CHANGELOG file or nah? (and if so would I need to add it, or does someone else add them?)

@TerraCodes: Please provide a link to "CHANGELOG" to make sure we talk about the same thing.

@TerraCodes: Please provide a link to "CHANGELOG" to make sure we talk about the same thing.

whoops, I meant https://phabricator.wikimedia.org/source/mediawiki/browse/master/RELEASE-NOTES-1.35

SD0001 removed a subscriber: SD0001.Jun 11 2020, 6:00 AM

I'm not sure I understand your message?

@TerraCodes: I meant that it's better to ask questions about your patch in Gerrit in the discussion about the patch in Gerrit.

@TerraCodes: I meant that it's better to ask questions about your patch in Gerrit in the discussion about the patch in Gerrit.

Ah, I'll do that, thanks for the reply

HI @Volker_E could you respond to my reply to your messages on my patch when you get a chance please?