mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Echo
synced 2024-11-24 07:54:13 +00:00
Merge "DiscussionParser: Use strict (in)equality"
This commit is contained in:
commit
3ea911c8a9
|
@ -41,20 +41,20 @@ abstract class EchoDiscussionParser {
|
||||||
|
|
||||||
$userID = $revision->getUser()->getId();
|
$userID = $revision->getUser()->getId();
|
||||||
$userName = $revision->getUser()->getName();
|
$userName = $revision->getUser()->getName();
|
||||||
$user = $userID != 0 ? User::newFromId( $userID ) : User::newFromName( $userName, false );
|
$user = $userID !== 0 ? User::newFromId( $userID ) : User::newFromName( $userName, false );
|
||||||
|
|
||||||
foreach ( $interpretation as $action ) {
|
foreach ( $interpretation as $action ) {
|
||||||
if ( $action['type'] == 'add-comment' ) {
|
if ( $action['type'] === 'add-comment' ) {
|
||||||
$fullSection = $action['full-section'];
|
$fullSection = $action['full-section'];
|
||||||
$header = self::extractHeader( $fullSection );
|
$header = self::extractHeader( $fullSection );
|
||||||
$userLinks = self::getUserLinks( $action['content'], $title );
|
$userLinks = self::getUserLinks( $action['content'], $title );
|
||||||
self::generateMentionEvents( $header, $userLinks, $action['content'], $revision, $user );
|
self::generateMentionEvents( $header, $userLinks, $action['content'], $revision, $user );
|
||||||
} elseif ( $action['type'] == 'new-section-with-comment' ) {
|
} elseif ( $action['type'] === 'new-section-with-comment' ) {
|
||||||
$content = $action['content'];
|
$content = $action['content'];
|
||||||
$header = self::extractHeader( $content );
|
$header = self::extractHeader( $content );
|
||||||
$userLinks = self::getUserLinks( $content, $title );
|
$userLinks = self::getUserLinks( $content, $title );
|
||||||
self::generateMentionEvents( $header, $userLinks, $content, $revision, $user );
|
self::generateMentionEvents( $header, $userLinks, $content, $revision, $user );
|
||||||
} elseif ( $action['type'] == 'add-section-multiple' && $wgEchoMentionsOnMultipleSectionEdits ) {
|
} elseif ( $action['type'] === 'add-section-multiple' && $wgEchoMentionsOnMultipleSectionEdits ) {
|
||||||
$content = self::stripHeader( $action['content'] );
|
$content = self::stripHeader( $action['content'] );
|
||||||
$content = self::stripSignature( $content );
|
$content = self::stripSignature( $content );
|
||||||
$userLinks = self::getUserLinks( $content, $title );
|
$userLinks = self::getUserLinks( $content, $title );
|
||||||
|
@ -72,7 +72,7 @@ abstract class EchoDiscussionParser {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( $title->getNamespace() == NS_USER_TALK ) {
|
if ( $title->getNamespace() === NS_USER_TALK ) {
|
||||||
$notifyUser = User::newFromName( $title->getText() );
|
$notifyUser = User::newFromName( $title->getText() );
|
||||||
// If the recipient is a valid non-anonymous user and hasn't turned
|
// If the recipient is a valid non-anonymous user and hasn't turned
|
||||||
// off their notifications, generate a talk page post Echo notification.
|
// off their notifications, generate a talk page post Echo notification.
|
||||||
|
@ -458,7 +458,7 @@ abstract class EchoDiscussionParser {
|
||||||
$userIdentity = $revision->getUser();
|
$userIdentity = $revision->getUser();
|
||||||
$userID = $userIdentity ? $userIdentity->getId() : 0;
|
$userID = $userIdentity ? $userIdentity->getId() : 0;
|
||||||
$userName = $userIdentity ? $userIdentity->getName() : '';
|
$userName = $userIdentity ? $userIdentity->getName() : '';
|
||||||
$user = $userID != 0 ? User::newFromId( $userID ) : User::newFromName( $userName, false );
|
$user = $userID !== 0 ? User::newFromId( $userID ) : User::newFromName( $userName, false );
|
||||||
|
|
||||||
$prevText = '';
|
$prevText = '';
|
||||||
if ( $revision->getParentId() ) {
|
if ( $revision->getParentId() ) {
|
||||||
|
@ -533,7 +533,7 @@ abstract class EchoDiscussionParser {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( $change['action'] == 'add' ) {
|
if ( $change['action'] === 'add' ) {
|
||||||
$content = trim( $change['content'] );
|
$content = trim( $change['content'] );
|
||||||
// The \A means the regex must match at the beginning of the string.
|
// The \A means the regex must match at the beginning of the string.
|
||||||
// This is slightly different than ^ which matches beginning of each
|
// This is slightly different than ^ which matches beginning of each
|
||||||
|
@ -600,12 +600,12 @@ abstract class EchoDiscussionParser {
|
||||||
'content' => $content,
|
'content' => $content,
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
} elseif ( $change['action'] == 'subtract' ) {
|
} elseif ( $change['action'] === 'subtract' ) {
|
||||||
$actions[] = [
|
$actions[] = [
|
||||||
'type' => 'unknown-subtraction',
|
'type' => 'unknown-subtraction',
|
||||||
'content' => $change['content'],
|
'content' => $change['content'],
|
||||||
];
|
];
|
||||||
} elseif ( $change['action'] == 'change' ) {
|
} elseif ( $change['action'] === 'change' ) {
|
||||||
$actions[] = [
|
$actions[] = [
|
||||||
'type' => 'unknown-change',
|
'type' => 'unknown-change',
|
||||||
'old_content' => $change['old_content'],
|
'old_content' => $change['old_content'],
|
||||||
|
|
Loading…
Reference in a new issue