Make some DiscussionParser methods public instead of private for reusability

Comments has been duplicating these methods for quite some time for no real reason other than that they're private here.
Duplicating these methods appears to be necessary if and when working with extensions where users can be @mentioned but which are
not implemented as ContentHandler subclasses or otherwise related to regular wikitext pages.

Change-Id: I9c097bab9c5eed8f2399c86897b1f8968126c765
This commit is contained in:
Jack Phoenix 2022-02-17 13:03:00 +02:00
parent 2f6892fab0
commit 9ed8612642

View file

@ -375,8 +375,9 @@ abstract class EchoDiscussionParser {
* - [unknownUsers]: An array of DBKey strings representing unknown users.
* - [anonymousUsers]: An array of DBKey strings representing anonymous IP users.
*/
private static function getUserMentions( Title $title, $revisionUserId, array $userLinks ) {
public static function getUserMentions( Title $title, $revisionUserId, array $userLinks ) {
global $wgEchoMaxMentionsCount;
$userMentions = [
'validMentions' => [],
'unknownUsers' => [],
@ -451,7 +452,7 @@ abstract class EchoDiscussionParser {
* @return int[]
* Array of links in the user namespace with DBKey => ID.
*/
private static function getUserLinks( $content, Title $title ) {
public static function getUserLinks( $content, Title $title ) {
$output = self::parseNonEditWikitext( $content, new Article( $title ) );
$links = $output->getLinks();
@ -476,7 +477,7 @@ abstract class EchoDiscussionParser {
*
* @return ParserOutput
*/
private static function parseNonEditWikitext( $wikitext, Article $article ) {
public static function parseNonEditWikitext( $wikitext, Article $article ) {
static $cache = [];
$cacheKey = md5( $wikitext ) . ':' . $article->getTitle()->getPrefixedText();