Matthias Mullie has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/214050

Change subject: Fix timestamp of notifications generated by lqt-import
......................................................................

Fix timestamp of notifications generated by lqt-import

Requires Ib9596cc058871a6b27cca7a809efc6b1ca75dfb0

Change-Id: Iabdfc9c52a30717aaa8197b514d55ae758af5f64
---
M includes/Import/Postprocessor/LqtNotifications.php
M includes/Notifications/Controller.php
2 files changed, 13 insertions(+), 7 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Flow 
refs/changes/50/214050/1

diff --git a/includes/Import/Postprocessor/LqtNotifications.php 
b/includes/Import/Postprocessor/LqtNotifications.php
index a04fa25..00e9aa2 100644
--- a/includes/Import/Postprocessor/LqtNotifications.php
+++ b/includes/Import/Postprocessor/LqtNotifications.php
@@ -131,6 +131,7 @@
                                'lqtThreadId' => $topic->getLqtThreadId(),
                                'notifyAgent' => true,
                        ),
+                       'timestamp' => $topic->getTimestamp(),
                ) );
        }
 
diff --git a/includes/Notifications/Controller.php 
b/includes/Notifications/Controller.php
index eb7815b..60a4db5 100644
--- a/includes/Notifications/Controller.php
+++ b/includes/Notifications/Controller.php
@@ -142,15 +142,20 @@
                        break;
                }
 
-               $events = array(
-                       EchoEvent::create( array(
-                               'type' => $eventName,
-                               'agent' => $user,
-                               'title' => $title,
-                               'extra' => $extraData,
-                       ) ),
+               $info = array(
+                       'type' => $eventName,
+                       'agent' => $user,
+                       'title' => $title,
+                       'extra' => $extraData,
                );
 
+               // Allow a specific timestamp to be set - useful when importing 
existing data
+               if ( isset( $data['timestamp'] ) ){
+                       $info['timestamp'] = $data['timestamp'];
+               }
+
+               $events = array( EchoEvent::create( $info ) );
+
                if ( $newPost ) {
                        $events = array_merge( $events, $this->notifyNewPost( 
$newPost ) );
                }

-- 
To view, visit https://gerrit.wikimedia.org/r/214050
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Iabdfc9c52a30717aaa8197b514d55ae758af5f64
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Flow
Gerrit-Branch: master
Gerrit-Owner: Matthias Mullie <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to