Page MenuHomePhabricator

Display ~~~~ as username in wikitext/to/mobile-html correctly
Open, MediumPublicBUG REPORT

Description

If we try to make an edit in a talk page and try to add tildes ~~~~ manually, it will not show the username information in the endpoint correctly.
https://en.wikipedia.org/api/rest_v1/transform/wikitext/to/mobile-html/User_talk:Cooltey

What happens?:
It will show the plain text of ~~~~ in the response.

Screenshot_20211203-125912_Wikipedia Dev.jpg (2×1 px, 273 KB)

What should have happened instead?:
It should show the corresponding username information: Cooltey (talk) 21:49, 3 December 2021 (UTC)

Event Timeline

@cooltey: Assuming this task is about the Page Content Service code project, hence adding that project tag so other people who don't know or don't care about team tags can also find this task when searching via projects. Please set appropriate project tags when possible. Thanks!

After some investigation it looks like:

  • mobile-html renders the wikitext properly
    • Please show my username Cooltey (talk) 20:59, 3 December 2021 (UTC)
  • parsoid also renders it properly
  • The URL from the report doesn't work

This ticket looks like its invalid now. @cooltey feel free to re-open if its still an issue

Hi @Jgiannelos

This ticket is about the wikitext/to/mobile-html, which is being used in the edit preview screen in the app.

I still can reproduce the issue.

Steps to reproduce

  1. Open the Wikipedia Android app.
  2. Go to any user talk page.
  3. Click on any topic in the list.
  4. Click on "Edit source" from the overflow menu located on the top-right side.
  5. Edit source and add ~~~~ and click on "Next"
Jgiannelos triaged this task as Medium priority.Jul 14 2022, 8:03 AM

Sounds good, thanks for the clarification @cooltey

I'm having problems doing this via the OpenAPI page at https://en.wikipedia.org/api/rest_v1/ and also by way of a manual curl with -d '{"wikitext": "~~~~"}' (HyperSwitch is griping about data.body lacking a wikitext property even though I've tried various incantations). Anyone able to share a functioning curl example to reproduce? I'm sure I'm missing something simple, sorry!

Separately, I'm checking with Jazmin on product need for this now that we're using a GUI for talk pages in the apps, and have been generally orienting this way on the web, too.

Nevermind, I just needed more ☕. Here's what I did:

curl -X 'POST' \
  'https://en.wikipedia.org/api/rest_v1/transform/wikitext/to/mobile-html/Main_Page' \
  -H 'accept: text/html; charset=utf-8; profile="https://www.mediawiki.org/wiki/Specs/Mobile-HTML/1.0.0"' \
  -H 'Content-Type: application/json' \
  -d '{"wikitext": "~~~~"}'

produced this:

<!DOCTYPE html><html prefix="dc: http://purl.org/dc/terms/ mw: http://mediawiki.org/rdf/" class="no-editing"><head prefix="mwr: https://en.wikipedia.org/wiki/Special:Redirect/"><meta charset="utf-8"><meta property="mw:pageId" content="15580374"><meta property="mw:pageNamespace" content="0"><meta property="mw:revisionSHA1" content="2393fc5efaa4fedf7ab0e29dbba51ce4a8dd6f34"><meta property="isMainPage" content="true"><meta property="mw:htmlVersion" content="2.7.0"><meta property="mw:html:version" content="2.7.0"><link rel="dc:isVersionOf" href="//en.wikipedia.org/wiki/Main_Page"><base href="//en.wikipedia.org/wiki/"><title>Main Page</title><meta http-equiv="content-language" content="en"><meta http-equiv="vary" content="Accept"><link rel="stylesheet" href="//meta.wikimedia.org/api/rest_v1/data/css/mobile/base"><link rel="stylesheet" href="//en.wikipedia.org/api/rest_v1/data/css/mobile/site"><link rel="stylesheet" href="//meta.wikimedia.org/api/rest_v1/data/css/mobile/pcs"><meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1, shrink-to-fit=no"><script src="//meta.wikimedia.org/api/rest_v1/data/javascript/mobile/pcs"></script><link rel="icon" href="data:,"><meta property="pcs:locale" content="en"><meta property="mw:pageProtection:edit" content="sysop"><meta property="mw:pageProtection:move" content="sysop"><meta property="mw:pageProtection:edit" content="sysop"><meta property="mw:pageProtection:edit" content="sysop"><meta property="mw:pageProtection:edit" content="sysop"><meta property="mw:pageProtection:edit" content="sysop"><meta property="mw:pageProtection:edit" content="sysop"><meta property="mw:leadImage" content="https://upload.wikimedia.org/wikipedia/commons/4/4b/Robin_Hobb_by_Gage_Skidmore.jpg" data-file-width="2591" data-file-height="3345"></head><body lang="en" class="mw-content-ltr sitedir-ltr ltr mw-body-content parsoid-body mediawiki mw-parser-output content skin-minerva" dir="ltr"><div id="pcs" class="mw-parser-output"><script>pcs.c1.Page.onBodyStart();</script><section data-mw-section-id="0"><p>~~~~</p></section><script defer="true">pcs.c1.Page.onBodyEnd();</script></div></body></html>

I was checking just to see if there were any obvious tells in the response, but no, it seems to be coming back in a standard fare <p> tag (which is sort of what one would have expected based on the screenshot).