Page MenuHomePhabricator

Add a unique class to each MediaWiki permission error
Closed, ResolvedPublic

Description

Very often there are some problems with warnings about the impossibility of editing, which need to be addressed pointwise. Colorize the entire block, or hide it for certain editors. It is also often necessary to quickly understand where this message is coming from in order to be able to correct it.

It seems to me that it would be useful for each message to set its own class, which would display in the DOM what kind of message it is.

For example:

image.png (196×508 px, 14 KB)

And do this for each MediaWiki message that is inserted as a warning by engine.

QA steps

Developer notes

Edit warnings show when the user doesn't have permission to do something.

Edit warnings are set inside includes/OutputPage.php (OutputPage::formatPermissionsErrorMessage)
There are two scenarios: 1 error shown or multiple errors shown.

When one error is shown the expected output would be:

<div class="permissions-errors">
   <div class="$newClass"></div>
</div>
`

When multiple errors:

<div class="permissions-errors">
<ul>
   <li class="$newClass"></li>
   <li class="$newClass2"></li>
</ul>
</div>

The class should be "mw-permissionerror-<msg-key>"

Event Timeline

@Jdlrobson can i work on this issue, if yes please guide on where can i get started?

@Naman yes you can work on this one. I've updated the description so that you can replicate this and pointed to you to the relevant code.

can i also work on this issue , if yes please tell me what to do in it and how i start please reply as soon as possible

Aklapper added a subscriber: nilima_mahakur28.

@nilima_mahakur28: I am resetting the assignee of this task because there has not been progress lately (please correct me if I am wrong!). Resetting the assignee avoids the impression that somebody is already working on this task. It also allows others to potentially work towards fixing this task. Please claim this task again when you plan to work on it (via Add Action...Assign / Claim in the dropdown menu) - it would be welcome. Thanks for your understanding!

Dolphyb subscribed.

Hi @Jdlrobson , i want to work on this task but i will like to know what the "msg-key" means ? are you referencing to the index of array ?

Hi and thank you for your interest! Please check thoroughly https://www.mediawiki.org/wiki/New_Developers (and all of its communication section!). The page covers how to get started, assigning tasks, task status, how to find a codebase, how to create patches, where to ask general development questions and where to get help with setup problems, and how to ask good questions. Thanks a lot! :)

@Dolphyb thanks! I believe <msg-key> here means the message name that contains the error. For example <msg-key> would be protectedpagetext for https://ru.wikipedia.org/wiki/MediaWiki:Protectedpagetext. In OutputPage::formatPermissionsErrorMessage <msg-key> is $error

However I've not looked at this ticket in some time so we should check with @Iniquity first to confirm it would still be useful to have this.

@Jdlrobson thank you, it now make sense to me. I will wait for @Iniquity response before moving forward with it.

Hello, I also haven’t seen this task for a long time, but I still think it’s useful :)

Hi @Jdlrobson, I can work on this if it is still relevant :)

Sure! Feel free to assign yourself and push a patch! Let me know if you have any questions!

theprotonade changed the task status from Open to In Progress.May 30 2024, 7:56 PM
theprotonade claimed this task.

Change #1037661 had a related patch set uploaded (by Theprotonade; author: Theprotonade):

[mediawiki/core@master] Add classname for edit notices

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

Am I understanding correctly that you're requesting this change for the permission error messages (shown when you can not edit the page), and not for the edit notice messages (shown when you can edit the page)?

matmarex renamed this task from Add a unique class to each MediaWiki "editnotice" alert to Add a unique class to each MediaWiki permission error.Jun 6 2024, 2:22 AM
matmarex updated the task description. (Show Details)

Thanks Bartosz for taking care of the code review side of things!

Change #1037661 merged by jenkins-bot:

[mediawiki/core@master] Add classname for permission error messages

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