mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Echo
synced 2024-12-12 07:55:53 +00:00
Merge "Clean up dead or unnecessarily complex code"
This commit is contained in:
commit
87af9edafa
|
@ -115,7 +115,7 @@ abstract class DiscussionParser {
|
||||||
$notifyUser = User::newFromName( $title->getText() );
|
$notifyUser = User::newFromName( $title->getText() );
|
||||||
// If the recipient is a valid non-anonymous user generate a talk page post notification.
|
// If the recipient is a valid non-anonymous user generate a talk page post notification.
|
||||||
if ( $notifyUser && $notifyUser->getId() ) {
|
if ( $notifyUser && $notifyUser->getId() ) {
|
||||||
$permManager = MediaWikiServices::getInstance()->getPermissionManager();
|
$permManager = $services->getPermissionManager();
|
||||||
// If this is a minor edit, only notify if the agent doesn't have talk page minor
|
// If this is a minor edit, only notify if the agent doesn't have talk page minor
|
||||||
// edit notification blocked
|
// edit notification blocked
|
||||||
if ( !$revision->isMinor() || !$permManager->userHasRight( $user, 'nominornewtalk' ) ) {
|
if ( !$revision->isMinor() || !$permManager->userHasRight( $user, 'nominornewtalk' ) ) {
|
||||||
|
@ -584,7 +584,7 @@ abstract class DiscussionParser {
|
||||||
*
|
*
|
||||||
* @todo Expand recognisable actions.
|
* @todo Expand recognisable actions.
|
||||||
*
|
*
|
||||||
* @param array[] $changes Output of Event::getMachineReadableDiff
|
* @param array[] $changes Output of DiscussionParser::getMachineReadableDiff
|
||||||
* @param string $username
|
* @param string $username
|
||||||
* @param Title|null $title
|
* @param Title|null $title
|
||||||
* @return array[] Array of associative arrays.
|
* @return array[] Array of associative arrays.
|
||||||
|
@ -746,7 +746,7 @@ abstract class DiscussionParser {
|
||||||
* @return array[] Converted actions
|
* @return array[] Converted actions
|
||||||
*/
|
*/
|
||||||
private static function convertToUnknownSignedChanges( array $signedSections, array $actions ) {
|
private static function convertToUnknownSignedChanges( array $signedSections, array $actions ) {
|
||||||
return array_map( function ( $action ) use( $signedSections ) {
|
return array_map( function ( $action ) use ( $signedSections ) {
|
||||||
if (
|
if (
|
||||||
$action['type'] === 'unknown-change' &&
|
$action['type'] === 'unknown-change' &&
|
||||||
self::isInSignedSection( $action['right-pos'], $signedSections )
|
self::isInSignedSection( $action['right-pos'], $signedSections )
|
||||||
|
@ -1030,11 +1030,7 @@ abstract class DiscussionParser {
|
||||||
|
|
||||||
$output = [];
|
$output = [];
|
||||||
|
|
||||||
$lineNumber = 0;
|
|
||||||
|
|
||||||
foreach ( $lines as $line ) {
|
foreach ( $lines as $line ) {
|
||||||
++$lineNumber;
|
|
||||||
|
|
||||||
// Look for the last user link on the line.
|
// Look for the last user link on the line.
|
||||||
$userData = self::getUserFromLine( $line, $title );
|
$userData = self::getUserFromLine( $line, $title );
|
||||||
if ( $userData === false ) {
|
if ( $userData === false ) {
|
||||||
|
@ -1094,9 +1090,6 @@ abstract class DiscussionParser {
|
||||||
} elseif ( $title && $title->isSpecial( 'Contributions' ) ) {
|
} elseif ( $title && $title->isSpecial( 'Contributions' ) ) {
|
||||||
$parts = explode( '/', $title->getText(), 2 );
|
$parts = explode( '/', $title->getText(), 2 );
|
||||||
$usernames[] = end( $parts );
|
$usernames[] = end( $parts );
|
||||||
} else {
|
|
||||||
// move on to next matched title-like excerpt
|
|
||||||
continue;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -87,11 +87,8 @@ class Notification extends AbstractEntity implements Bundleable {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Notification timestamp should be the same as event timestamp
|
// Notification timestamp should be the same as event timestamp
|
||||||
$obj->timestamp = $obj->event->getTimestamp();
|
// Otherwise use safe fallback
|
||||||
// Safe fallback
|
$obj->timestamp = $obj->event->getTimestamp() ?: wfTimestampNow();
|
||||||
if ( !$obj->timestamp ) {
|
|
||||||
$obj->timestamp = wfTimestampNow();
|
|
||||||
}
|
|
||||||
|
|
||||||
// @Todo - Database insert logic should not be inside the model
|
// @Todo - Database insert logic should not be inside the model
|
||||||
$obj->insert();
|
$obj->insert();
|
||||||
|
|
Loading…
Reference in a new issue