Page MenuHomePhabricator

Refactor block messages into smaller messages
Closed, ResolvedPublic5 Estimated Story Points

Description

Background

The following block messages are very long and difficult to maintain:

  • blockedtext
  • autoblockedtext
  • systemblockedtext
  • blockedtext-partial
  • blockedtext-composite

They are also repetitive and similarly structured. They should be broken up into smaller messages, which can be included in the longer message. (This is sometimes referred to as building lego messages, and is usually frowned upon, but would be gratefully received in this particular case!)

Acceptance criteria
  • The block message output stays the same
  • The messages are broken into smaller messages. (Exactly how will be determined by whoever picks this up.)
  • The overrides on WikimediaMessages should be updated

Event Timeline

Tchanders updated the task description. (Show Details)
Tchanders changed the point value for this task from 3 to 5.

Change 866450 had a related patch set uploaded (by AGueyte; author: AGueyte):

[mediawiki/core@master] WIP: refractor block message

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

In order to break down the messages I've created a sheet highlighting the common messages. it's accessible here. It might be useful for QA/Testing

Screen Shot 2022-12-13 at 11.25.50 AM.png (545×733 px, 100 KB)

Hi, it seems the block messages in WikimediaMessages are related to the GlobalBlock extension.
I leave it for now.

Hi,
There have been quite a few back-and-forths on what is supposed to be broken down which is leading to new sentences, confusion, and mistakes.
The task says the way the messages have to be broken into smaller ones is by the appreciation of the ticket's owner but it seems my choices are disputable.
Could I have direct directions on how we want the messages broken into smaller ones in order to complete this task?

Thanks!

Hi @AGueyte - there's not one right answer here, so we just need to use judgement and discuss as we go.

The code reviews on the patch at the moment are pointing out a few things that definitely need fixing, e.g. where a sentence isn't grammatically correct ("Your current IP address is ::1 the block ID is 1234.") or where there is a software bug (parameters displaying incorrectly for the composite block message).

We should definitely fix grammar problems and parameter bugs, but there's no single correct answer as to how exactly the messages should read!

Change 866450 merged by jenkins-bot:

[mediawiki/core@master] Break down block error messages for clarity and better maintenance

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

Change 883300 had a related patch set uploaded (by Amire80; author: Amire80):

[mediawiki/core@master] Add a space after </strong>

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

@Tchanders @AGueyte I am finding on beta that when using some templated block reasons the HTML does not display correctly.

beta_block_reason.png (591×1 px, 227 KB)

Add the IP 1.2.3.4 to your XFF header and try to edit any article on https://en.wikipedia.beta.wmflabs.org. The block is https://en.wikipedia.beta.wmflabs.org/wiki/Special:BlockList?wpTarget=1.2.3.4.

The same templated reason does display OK on testwiki.

testwiki_block_reason.png (654×1 px, 216 KB)

However, I tried importing templates from enwiki on to beta and blocking with those templates. They displayed correctly (e.g. set IP 1.2.3.28 in your XFF header, remember to clear your cookies first so you don't get a composite block).

So, I don't know if there is something with the way some of the templates are written on beta that causes problems. (One of the templates in question is https://en.wikipedia.beta.wmflabs.org/wiki/Template:CheckUser_block)

@AGueyte I was reviewing the internal consistency of the block messages:

  • Is there a reason {{int:blockedtext-reason-comment|$2}} is not used in autoblockedtext, systemblockedtext and blockedtext-composite?
  • Number of newlines after the first line, causing inconsistent line breaks when viewed on the wiki (e.g. autoblockedtext and systemblockedtext use one newline, blockedtext and blockedtext-composite use two, blockedtext-partial uses none as pointed out in T324601#8556007)
  • one vs. two newlines after {{int:blockedtext-made-by|$1}} (blockedtext-partial has two, blockedtext has one)
  • No use of <strong> in autoblockedtext and systemblockedtext
  • In autoblockedtext the section starting {{int:blockedtext-contact-blocker-admin|$1}}... uses two newlines between sentences, causing the sentences to appear on separate lines on the wiki. blockedtext uses only one, causing it to appear as the same paragraph.
  • When using a templated reason, autoblockedtext has extra "..
    extra_quote_and_dots.png (642×1 px, 234 KB)
  • Should we have a fullstop after the reason? We don't for systemblockedtext.
  • blockedtext-composite, autoblockedtext and systemblockedtext shows the reason ($2) on a separate line. blockedtext and blockedtext-partial do not.
  • blockedtext-composite has two newlines after {{int:blockedtext-expiration-longest-block|$6}}, which puts the final item in the list ($5) in its own <ul>.

Other stuff I am not sure if it is important:

  • Some block messages say "Your IP is blocked" whereas other say "Your IP has been blocked".
  • blockedtext has extra stuff at the bottom (You can contact ‪<blocking admin> or another administrator to discuss the block...) which blocktext-partial does not.

Is there a reason {{int:blockedtext-reason-comment|$2}} is not used in autoblockedtext, systemblockedtext and blockedtext-composite?

Yes! The 3 last variables use a different structure to display reasons.

  1. The reason given is <em>$2</em>
  2. The reason given is:\n\n:<em>$2</em>

I have used this google sheet to visualize the structure of each variable.

Number of newlines after the first line, causing inconsistent line breaks when viewed on the wiki (e.g. autoblockedtext and systemblockedtext use one newline, blockedtext and blockedtext-composite use two, blockedtext-partial uses none as pointed out in T324601#8556007)

But is it consistent with the existing variables on Master?
This patch is to refactor the construction of the language variable, it wasn't about unifying the block messages for consistency.
Unless I misunderstood the purpose of this patch!

Change 883508 had a related patch set uploaded (by AGueyte; author: AGueyte):

[mediawiki/core@master] Update systemblockedtext variable with a full stop

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

Should we have a fullstop after the reason? We don't for systemblockedtext.

This one is definitely a miss, I've uploaded a new patch. Thanks!

Is there a reason {{int:blockedtext-reason-comment|$2}} is not used in autoblockedtext, systemblockedtext and blockedtext-composite?

Yes! The 3 last variables use a different structure to display reasons.

  1. The reason given is <em>$2</em>
  2. The reason given is:\n\n:<em>$2</em>

I have used this google sheet to visualize the structure of each variable.

Ah, now I understand the Google Sheet! I have no opinion, I just thought we could get a bit more message re-use here.

Number of newlines after the first line, causing inconsistent line breaks when viewed on the wiki (e.g. autoblockedtext and systemblockedtext use one newline, blockedtext and blockedtext-composite use two, blockedtext-partial uses none as pointed out in T324601#8556007)

But is it consistent with the existing variables on Master?
This patch is to refactor the construction of the language variable, it wasn't about unifying the block messages for consistency.
Unless I misunderstood the purpose of this patch!

That is true. Perhaps any pre-existing inconsistencies should be raised as separate bugs.

Change 883508 merged by jenkins-bot:

[mediawiki/core@master] Update systemblockedtext variable with a full stop

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

Change 883300 merged by jenkins-bot:

[mediawiki/core@master] Add linebreaks after </strong>

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

@AGueyte I came across a couple of issues in AutoBlocked and Systemblocked as seen below.

AutoBlocked: It looks like the reason given appeared twice compared to http://localhost:8080/wiki/MediaWiki:Autoblockedtext
Systemblocked: The difference was that it had "Please contact your Internet service provider or technical support of your organization and inform them of this serious security problem." than the one shown in http://localhost:8080/wiki/MediaWiki:Systemblockedtext which does not have it.

BlocksSupposed VersionActual Version
Autoblockedtext
T324601_Blocks_AutoBlock_1.png (537×1 px, 137 KB)
T324601_Blocks_AutoBlock_2.png (541×1 px, 174 KB)
blockedtext
T324601_Blocks_RegularBlock_1.png (555×2 px, 145 KB)
T324601_Blocks_RegularBlock_2.png (660×3 px, 250 KB)
systemblockedtext
T324601_Blocks_SystemBlock_3.png (531×1 px, 113 KB)
T324601_Blocks_SystemBlock_2.png (522×1 px, 176 KB)
blockedtext-partial
T324601_Blocks_PartialBlock_1.png (533×1 px, 128 KB)
T324601_Blocks_PartialBlock_2.png (537×1 px, 134 KB)
blockedtext-composite
T324601_Blocks_CompositeBlock_1.png (532×1 px, 112 KB)
T324601_Blocks_CompositeBlock_2.png (530×1 px, 125 KB)

Hi @GMikesell-WMF Thanks for this visual and detailed report! It's very useful.

Regarding the two block reasons with different statements, it's actually part of the block error reason.
They are in two parts in mediawiki/languages/i18n/en.json

AutoBlocked is using the reason "autoblocker":
"autoblocker": "Autoblocked because your IP address has been recently used by \"[[User:$1|$1]]\".\nThe reason given for $1's block is \"$2\""

Systemblocked is using the reason "proxyblockreason":
"proxyblockreason": "Your IP address has been blocked because it is an open proxy.\nPlease contact your Internet service provider or technical support of your organization and inform them of this serious security problem."

Hope this helps!

@AGueyte Got it, figured but I just wanted to make sure. Ok, everything looks good then. I will move it to Done. Thanks for your help!

GMikesell-WMF reopened this task as In Progress.
GMikesell-WMF changed the task status from In Progress to Open.

Thanks for the progress on this. It's getting better.

One immediate and relatively easy issue to fix is that in core, there are four messages that include another message using {{int:}} and then say ", and the block ID is #$5."

The problems with this are that:

  • It's "lego", because it's not a complete sentence.
  • It's readable text in the middle of a lot of {{int:}}s. It caused incorrect translations to three languages. I've already fixed those, but it may happen again.
  • The text ", and the block ID is #$5." is repeated.

My recommendation is:

  • Split this part into two sentences: "Your current IP address is $3. The block ID is #$5." This is an easy solution for the "lego" problem.
  • Make a new short message: "The block ID is #$5."

Closing this, since the remaining work is captured in T330872: Improve Block Error Message to avoid lego. Thank you everyone.