If we were rate-limited, we don't store a new hash, so we shouldn't
return a new one. If we received a hash from the client, however, that
should still be valid, so we can return it.
Change-Id: Ifc37ae044172b8838fee15d539b076a0d0f02f22
$stats = MediaWikiServices::getInstance()->getStatsdDataFactory();
$stats->increment( "editstash.cache_stores.$status" );
- $this->getResult()->addValue(
- null,
- $this->getModuleName(),
- [
- 'status' => $status,
- 'texthash' => $textHash
- ]
- );
+ $ret = [ 'status' => $status ];
+ // If we were rate-limited, we still return the pre-existing valid hash if one was passed
+ if ( $status !== 'ratelimited' || $params['stashedtexthash'] !== null ) {
+ $ret['texthash'] = $textHash;
+ }
+
+ $this->getResult()->addValue( null, $this->getModuleName(), $ret );
}
/**