if entirewatchlist is set, so updates may not be visible immediately
* Block info will be added to "blocked" errors from more modules.
* (T216245) Autoblocks will now be spread by action=edit and action=move.
+* action=query&meta=userinfo has a new uiprop, 'latestcontrib', that returns
+ the date of user's latest contribution.
=== Action API internal changes in 1.33 ===
* A number of deprecated methods for API documentation, intended for overriding
);
}
+ if ( isset( $this->prop['latestcontrib'] ) ) {
+ $ts = $this->getLatestContributionTime();
+ if ( $ts !== null ) {
+ $vals['latestcontrib'] = $ts;
+ }
+ }
+
return $vals;
}
return $retval;
}
+ /**
+ * @return string|null ISO 8601 timestamp of current user's last contribution or null if none
+ */
+ protected function getLatestContributionTime() {
+ global $wgActorTableSchemaMigrationStage;
+
+ $user = $this->getUser();
+ $dbr = $this->getDB();
+
+ if ( $wgActorTableSchemaMigrationStage & SCHEMA_COMPAT_READ_NEW ) {
+ if ( $user->getActorId() === null ) {
+ return null;
+ }
+ $res = $dbr->selectField( 'revision_actor_temp',
+ 'MAX(revactor_timestamp)',
+ [ 'revactor_actor' => $user->getActorId() ],
+ __METHOD__
+ );
+ } else {
+ if ( $user->isLoggedIn() ) {
+ $conds = [ 'rev_user' => $user->getId() ];
+ } else {
+ $conds = [ 'rev_user_text' => $user->getName() ];
+ }
+ $res = $dbr->selectField( 'revision',
+ 'MAX(rev_timestamp)',
+ $conds,
+ __METHOD__
+ );
+ }
+
+ return $res ? wfTimestamp( TS_ISO_8601, $res ) : null;
+ }
+
public function getAllowedParams() {
return [
'prop' => [
'unreadcount',
'centralids',
'preferencestoken',
+ 'latestcontrib',
],
ApiBase::PARAM_HELP_MSG_PER_VALUE => [
'unreadcount' => [
"apihelp-query+userinfo-paramvalue-prop-registrationdate": "Adds the user's registration date.",
"apihelp-query+userinfo-paramvalue-prop-unreadcount": "Adds the count of unread pages on the user's watchlist (maximum $1; returns <samp>$2</samp> if more).",
"apihelp-query+userinfo-paramvalue-prop-centralids": "Adds the central IDs and attachment status for the user.",
+ "apihelp-query+userinfo-paramvalue-prop-latestcontrib": "Adds the date of user's latest contribution.",
"apihelp-query+userinfo-param-attachedwiki": "With <kbd>$1prop=centralids</kbd>, indicate whether the user is attached with the wiki identified by this ID.",
"apihelp-query+userinfo-example-simple": "Get information about the current user.",
"apihelp-query+userinfo-example-data": "Get additional information about the current user.",
"apihelp-query+userinfo-paramvalue-prop-registrationdate": "{{doc-apihelp-paramvalue|query+userinfo|prop|registrationdate}}",
"apihelp-query+userinfo-paramvalue-prop-unreadcount": "{{doc-apihelp-paramvalue|query+userinfo|prop|unreadcount|params=* $1 - Maximum value for the \"unreadcount\" property.\n* $2 - Return value when there are more unread pages.|paramstart=3}}",
"apihelp-query+userinfo-paramvalue-prop-centralids": "{{doc-apihelp-paramvalue|query+userinfo|prop|centralids}}",
+ "apihelp-query+userinfo-paramvalue-prop-latestcontrib": "{{doc-apihelp-paramvalue|query+userinfo|prop|latestcontrib}}",
"apihelp-query+userinfo-param-attachedwiki": "{{doc-apihelp-param|query+userinfo|attachedwiki}}",
"apihelp-query+userinfo-example-simple": "{{doc-apihelp-example|query+userinfo}}",
"apihelp-query+userinfo-example-data": "{{doc-apihelp-example|query+userinfo}}",