Page MenuHomePhabricator

[SPIKE] Investigate porting user:talk pages from iOS
Closed, ResolvedPublic

Description

  • How does iOS app display pages
  • What technical documentation exists?

@Tsevener is probably the right person to talk to.

Event Timeline

How does iOS app display pages

  1. User can check the user's talk page from the app primary language.
  2. Able to create a new discussion and reply to a discussion
  3. The first item in the talk page will show in the header view
  4. The JSON data from the endpoint is in HTML and probably is using Webview to display the content.
  5. If tap on the "Talk" link in the discussion, it is also able to link to other user's talk page natively.

What technical documentation exists?

cc @Tsevener Please correct me if I am wrong, thank you.

cooltey added a subscriber: scblr.

@Charlotte @schoenbaechler The SPIKE is completed, please see the note above.

@cooltey yep, that looks right. If the talk page doesn't exist, you'll get a 404 from the rest endpoint. Making the same action=edit&section=new call will make a new topic, creating the page if needed. Here are some other notes from these endpoints:

  • The topic ids in the rest response line up with the section ids you need to pass in order to append a reply to the end of a topic.
  • A topic of id=0 and no html key indicates an intro section. We display the first reply underneath the header, but you can tap it to view more replies to the intro section in the reply view.
{
	"revision": 951122157,
	"topics": [{
			"id": 0,
			"replies": [{
				"sha": "3ca976a9f3624b14e60faf769c1a2fd875b3e944230c148b8e5d98524931b9f7",
				"depth": 0,
				"html": "Retired<br><br>This user is no longer active on Wikipedia.<br><br>This page has been <a href=\"./Wikipedia:Deletion_policy#Courtesy_blanking\" title=\"Wikipedia:Deletion policy\">blanked as a courtesy</a>."
			}],
			"depth": 1,
			"html": "",
			"shas": {
				"html": "5feceb66ffc86f38d952786c6d696c79c2dbc239dd4e91b46729d73a27fb57e9",
				"indicator": "edbd36702d66f9440f5c38c5fe0bbb6e2bd4e58bbea23dc9bc2d79c6ba8506f0"
			}
		},
		{
			"id": 1,
			"replies": [{
				"sha": "5bed56a4ef675fc84c3cab20c937441ffb769dcf10519069011df5e86400ff4e",
				"depth": 0,
				"html": "Hi,<br><br>You appear to be eligible to vote in the current <a href=\"./Wikipedia:ACE2015\" title=\"Wikipedia:ACE2015\">Arbitration Committee election</a>. The <a href=\"./Wikipedia:ARBCOM\" title=\"Wikipedia:ARBCOM\">Arbitration Committee</a> is the panel of editors responsible for conducting the Wikipedia <a href=\"./Wikipedia:RFAR\" title=\"Wikipedia:RFAR\">arbitration process</a>. It has the authority to enact binding solutions for disputes between editors, primarily related to serious behavioural issues that the community has been unable to resolve. This includes the ability to impose <a href=\"./Wikipedia:BAN\" title=\"Wikipedia:BAN\">site bans</a>, <a href=\"./Wikipedia:TBAN\" title=\"Wikipedia:TBAN\">topic bans</a>, editing restrictions, and other measures needed to maintain our editing environment. The <a href=\"./Wikipedia:ARBPOL\" title=\"Wikipedia:ARBPOL\">arbitration policy</a> describes the Committee's roles and responsibilities in greater detail. If you wish to participate, you are welcome to <a href=\"./Wikipedia:ACE2015/C\" title=\"Wikipedia:ACE2015/C\">review the candidates' statements</a> and submit your choices on <a href=\"./Special:SecurePoll/vote/398\" title=\"Special:SecurePoll/vote/398\">the voting page</a>. For the Election committee, <a href=\"./User:MediaWiki_message_delivery\" title=\"User:MediaWiki message delivery\">MediaWiki message delivery</a> (<a href=\"./User_talk:MediaWiki_message_delivery\" title=\"User talk:MediaWiki message delivery\">talk</a>) 13:46, 23 November 2015 (UTC)"
			}],
			"depth": 2,
			"html": "<a href=\"./Wikipedia:ACE2015\" title=\"Wikipedia:ACE2015\">ArbCom elections are now open!</a>",
			"shas": {
				"html": "33f53a04efe1eef5459289cd7e5658d62087df990fe375d54b68bd127a6db924",
				"indicator": "9993ab2d7cfb469f86ac05b69f60b143ad5ca9998c7f1889d28b8b6d10c1fcbe"
			}
		}
	]
}

Screen Shot 2020-08-20 at 8.45.08 AM.png (1×559 px, 176 KB)

Screen Shot 2020-08-20 at 8.45.11 AM.png (1×559 px, 158 KB)

  • Topics have 2 shas - html is based on the topic's id + html field, and indicator is based on the topic's html and replies sha fields. We use the indicator field to flag the topic with a green unread indicator dot indicating something with it has changed (either the topic html or one of it's replies), by comparing it against the topic indicators we have persisted in memory or the db. The html sha is purely for identifying only the topic. If I were only using indicator for identifying, our side end saw a new reply as an entirely new topic object and it was making things difficult. Having a different sha only for powering the indicator made things more simple. The sha field of a reply is powered off of it's index in the array and the html field to uniquely identify the reply.
  • One last thing - server-side we are stripping out a bunch of tags and attributes from the html fields. See this file - anything not in the tagReplacements mapping is stripped. So since it's mostly predictable tags we're getting back we are able to convert the html strings to native views.