Permalink
Browse files

Fix backward compatibility for nodes without user id.

  • Loading branch information...
1 parent 9a48543 commit 84306cad981dc19b428b93ba79f4e69b83a2b047 @cdujeu cdujeu committed Jun 25, 2016
Showing with 8 additions and 2 deletions.
  1. +8 −2 core/src/plugins/core.notifications/NotificationCenter.php
@@ -254,6 +254,13 @@ public function loadUserFeed(\Psr\Http\Message\ServerRequestInterface $requestIn
error_log("Skipping notification as nodes are not excepted class, probably a deserialization issue");
continue;
}
+ // Backward compat : make sure there is a user ID in the node url.
+ if( $oldNode !== null && !$oldNode->hasUser() ){
+ $oldNode->setUserId($object->author);
+ }
+ if( $newNode !== null && !$newNode->hasUser() ){
+ $newNode->setUserId($object->author);
+ }
$notif = $this->generateNotificationFromChangeHook($oldNode, $newNode, $copy, "unify");
if ($notif !== false && $notif->getNode() !== false) {
$notif->setAuthor($object->author);
@@ -267,8 +274,7 @@ public function loadUserFeed(\Psr\Http\Message\ServerRequestInterface $requestIn
$this->logInfo("Warning", "Empty node stored in notification ".$notif->getAuthor()."/ ".$notif->getAction());
continue;
}
- // Backward compat : make sure there is a user ID in the node url.
- $node->setUserId($node->hasUser() ? $node->getUserId() : $notif->getAuthor());
+ //$node->setUserId($node->hasUser() ? $node->getUserId() : $notif->getAuthor());
try {
@$node->loadNodeInfo();
} catch (\Exception $e) {

0 comments on commit 84306ca

Please sign in to comment.