Merge "Adjust doc for EchoNotification::readTimestamp"

This commit is contained in:
jenkins-bot 2022-01-21 08:11:26 +00:00 committed by Gerrit Code Review
commit ceda28121f
3 changed files with 4 additions and 8 deletions

View file

@ -28,7 +28,7 @@ class EchoNotification extends EchoAbstractEntity implements Bundleable {
protected $timestamp;
/**
* @var string
* @var string|null
*/
protected $readTimestamp;
@ -152,11 +152,7 @@ class EchoNotification extends EchoAbstractEntity implements Bundleable {
$notification->user = User::newFromId( $row->notification_user );
// Notification timestamp should never be empty
$notification->timestamp = wfTimestamp( TS_MW, $row->notification_timestamp );
// Only convert to MW format if it is not empty, otherwise
// wfTimestamp would use current timestamp for empty cases
if ( $row->notification_read_timestamp ) {
$notification->readTimestamp = wfTimestamp( TS_MW, $row->notification_read_timestamp );
}
$notification->readTimestamp = wfTimestampOrNull( TS_MW, $row->notification_read_timestamp );
$notification->bundleHash = $row->notification_bundle_hash;
return $notification;

View file

@ -32,7 +32,7 @@ class EchoNotificationMapperTest extends MediaWikiIntegrationTestCase {
'event_agent_ip' => '',
'notification_user' => 1,
'notification_timestamp' => '20140615101010',
'notification_read_timestamp' => '',
'notification_read_timestamp' => null,
'notification_bundle_hash' => 'testhash',
]
];

View file

@ -54,7 +54,7 @@ class EchoNotificationTest extends MediaWikiIntegrationTestCase {
'notification_user' => 1,
'notification_event' => 1,
'notification_timestamp' => time(),
'notification_read_timestamp' => '',
'notification_read_timestamp' => null,
'notification_bundle_hash' => 'testhash',
];
}