Page MenuHomePhabricator

Default text in presentation of Mentors on Newcomer Homepage, Arabic Wikipedia
Closed, ResolvedPublic

Description

The text displayed on the Newcomer Homepage in Arabic wikipedia is the default one, even a presentation is made on the list.



See the https://ar.wikipedia.org/wiki/ويكيبيديا:مشروع_فريق_النمو/قائمة_المتطوعين/قائمة list where Users Dyolf77 and صالح have different text instead of the default one.

Event Timeline

Restricted Application added subscribers: alanajjar, Aklapper. · View Herald TranscriptJul 25 2019, 11:57 AM
Dyolf77_WMF updated the task description. (Show Details)Jul 25 2019, 12:03 PM
Dyolf77_WMF renamed this task from Default text in description of Mentors on Newcomer Homepage, Arabic Wikipedia to Default text in presentation of Mentors on Newcomer Homepage, Arabic Wikipedia.Jul 25 2019, 12:15 PM
Dyolf77_WMF updated the task description. (Show Details)

Hmm, I'm wondering if this something with a cached value persisting longer than it should, because if I copy/paste the contents of the mentors page into my local wiki, I see the correct override in the mentorship module.

Hmm, I'm wondering if this something with a cached value persisting longer than it should, because if I copy/paste the contents of the mentors page into my local wiki, I see the correct override in the mentorship module.

It is working very well on beta:

@Dyolf77_WMF I cleared the page cache with action=purge, not sure if that would have any effect, but could you take a look please?

@kostajh nothing changed (from a purged cache navigator)

Agree with @kostajh and @Dyolf77 - re-checked in betalabs with the text from Mentors page, the descriptions get displayed:

@Dyolf77 - do you know if any mentors description text is displayed on Homepage Mentorship module?

The Mentor list page is a subpage - could the issue be related to that?
https://ar.wikipedia.org/wiki/ويكيبيديا:مشروع_فريق_النمو/قائمة_المتطوعين/قائمة

@Etonkovidova Yes, this is the mentor description (mine), not the default text.

I moved the list to https://ar.wikipedia.org/wiki/ويكيبيديا:مشروع_فريق_النمو/مرشدون can we try with the new page?

Moving this to Ready for Development because it's a bug that is a priority to fix.

@Dyolf77_WMF let's keep the previous page, because moving the page requires a configuration sync patch. The mentor names are being parsed since users are getting assigned to mentors, so it seems that the problem is elsewhere.

@kostajh Okay, back to the original, I reverted my edits on Wikidata. https://www.wikidata.org/wiki/Q14339834

Seems like the problem is in getCustomMentorIntroText, as can be seen from this profile trace, the code stops executing here:

$introText = $matches[1] ?? '';
if ( $introText === '' ) {
	return '';
}

So, the problem is in here:

// Use \h (horizontal whitespace) instead of \s (whitespace) to avoid matching newlines (T227535)
preg_match(
	sprintf( '/:%s]]\h*\|\h*(.*)/', preg_quote( $this->getMentorUser()->getName(), '/' ) ),
	$this->getMentorsPageContent( $context ),
	$matches
);
kostajh claimed this task.Jul 28 2019, 2:21 PM

Oh, because in LTR languages we're looking for ]]| but in RTL languages we need to find |[[

@Dyolf77_WMF could you add back the custom mentor description text you had please, to help me debug?

The old page which had custom mentor description text is parsed by our code as

* [[مستخدم:Dyolf77]]|كنت مُربَكا مثلك تماما. لكن ساعدني على تخطي هذا، طرحي للأسئلة على مستخدمين لهم خبرة. من فضلك لا تتردد(ي) في طرح أسئلة!
* [[مستخدم:جار الله]]
* [[مستخدم:محمد أحمد عبد الفتاح]]
* [[مستخدم:صالح]] | اسأل وستتعلم بسرعة :)
* [[مستخدم:أحمد ناجي]]
* [[مستخدمة:شيماء]]
* [[مستخدم:علاء]]
* [[مستخدم:شادي]]|أنا هنا لمساعدتك في استخدام ويكيبيديا، من فضلك لا تتردد(ي) في السؤال.
* [[مستخدم:Dr-Taher]] |مفتاح المعرفة السؤال، فلا تتردد/ي في طلب المساعدة، هكذا بدأنا جميعا. يسعدني مساعدتك.
* [[مستخدم:Avicenno]]
* [[مستخدم:محمد عصام]]
* [[مستخدم:Mohammad Hijjawi]]
* [[مستخدم:عبد الله]]

Alright. I think this was down to some minor formatting issues with the mentors who added custom description text. I fixed the entry for Dr Taher and see it on my mentor module:

Looking at this revision, the output of which is in the comment directly above, note that there is a space between the ]] and the | for Dr-Taher, and [مستخدم:صالح]].

The one for Dyolf77 is a bit trickier, I'm not totally sure why the original text didn't work but I updated the page and it's working now:

It's important to note that you cannot use formatting like [[User:Foo|Foo]]|Some custom text, it needs to be [[User:Foo]]|Some custom text.

@kostajh Great, thanks for your help! Do you still need to add back the old mentor description text?

Thanks again.

Oh, because in LTR languages we're looking for ]]| but in RTL languages we need to find |[[

FYI that's not right. The characters are still ]]|, they just look like |[[ because the [ character has "weak" directionality and renders differently depending on whether the surrounding characters are LTR or RTL. The actual codepoints are still [[|.

In any case, it looks like this mystery is solved now. The format needs to be exactly [[User:Foo]]|Custom mentor text, you cannot put spaces around the | character, or use a piped link, or deviate from this format in any other way.

FYI that's not right. The characters are still ]]|, they just look like |[[ because the [ character has "weak" directionality and renders differently depending on whether the surrounding characters are LTR or RTL. The actual codepoints are still [[|.

Right, thanks for clarifying. I realized this after using eval.php (T228991#5371458) but didn't update my previous comment.

@kostajh Great, thanks for your help! Do you still need to add back the old mentor description text?

@Dyolf77_WMF could you please do it? I believe I copied the text correctly for you and Dr-Taher but there might have been one more user to update as well. Also, as @Catrope writes in the previous comment, please ensure that all the listings on ويكيبيديا:مشروع_فريق_النمو/قائمة_المتطوعين have no username formatting, for example some entries look like <span style="color:#339900; font-size:18px; font-family:traditional arabic;">'''راسِلني'''</span>]]</sup>

@Dyolf77_WMF by the way, if you want to see how a mentor's text will render in the homepage module, you can enable the Special:Homepage for your account in Preferences, then visit Special:Homepage.

Right-click anywhere on the page and select "Inspect element", then in the window that opens up click on the "Console" tab. Enter this text:

var existingMentorId = mw.user.options.values['growthexperiments-mentor-id'];
existingMentorId;

Then press "Enter", this prints the user ID of the mentor currently assigned to you.

Get the user ID of the mentor whose text you want to verify works properly by finding their user page and then viewing page info, for example for Dr-Taher it is https://ar.wikipedia.org/w/index.php?title=%D9%85%D8%B3%D8%AA%D8%AE%D8%AF%D9%85:Dr-Taher&action=info

Now to assign Dr-Taher as your mentor, you would take the User ID listed in the action=info page above (in this case it's ), and save it to your preferences in the Console tab:

new mw.Api().saveOption( 'growthexperiments-mentor-id', 237660 );

Reload Special:Homepage and you should see the mentor description text for Dr-Taher. If you want to change your mentor back to what it was at the beginning, run:

new mw.Api().saveOption( 'growthexperiments-mentor-id', existingMentorId );

(CC @MMiller_WMF @Etonkovidova )

@kostajh done. Thanks for the tip, that's really cool and helpful for me (sorry, I am just a civil engineer :) ). I tried with some Mentors IDs and the Homepage looks fine!

Etonkovidova closed this task as Resolved.Jul 30 2019, 5:08 PM

I checked with my testing users in production - two of them were assigned mentors and with custom descriptions and descriptions were displayed, as in Dyolf77_WM comment.