Make sure user mention events are serialized before to push in queue
This commit is contained in:
@@ -23,7 +23,7 @@ class UserMentionJob extends BaseJob
|
|||||||
*/
|
*/
|
||||||
public function withParams($text, $eventName, GenericEvent $event)
|
public function withParams($text, $eventName, GenericEvent $event)
|
||||||
{
|
{
|
||||||
$this->jobParams = array($text, $eventName, $event);
|
$this->jobParams = array($text, $eventName, $event->getAll());
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -32,10 +32,11 @@ class UserMentionJob extends BaseJob
|
|||||||
*
|
*
|
||||||
* @param string $text
|
* @param string $text
|
||||||
* @param string $eventName
|
* @param string $eventName
|
||||||
* @param GenericEvent $event
|
* @param array $eventData
|
||||||
*/
|
*/
|
||||||
public function execute($text, $eventName, GenericEvent $event)
|
public function execute($text, $eventName, array $eventData)
|
||||||
{
|
{
|
||||||
|
$event = new GenericEvent($eventData);
|
||||||
$users = $this->getMentionedUsers($text);
|
$users = $this->getMentionedUsers($text);
|
||||||
|
|
||||||
foreach ($users as $user) {
|
foreach ($users as $user) {
|
||||||
|
|||||||
@@ -90,7 +90,7 @@ class UserMentionJobTest extends Base
|
|||||||
|
|
||||||
$this->container['dispatcher']->addListener(TaskModel::EVENT_USER_MENTION, array($this, 'onUserMention'));
|
$this->container['dispatcher']->addListener(TaskModel::EVENT_USER_MENTION, array($this, 'onUserMention'));
|
||||||
|
|
||||||
$userMentionJob->execute('test @user1 @user2', TaskModel::EVENT_USER_MENTION, $event);
|
$userMentionJob->execute('test @user1 @user2', TaskModel::EVENT_USER_MENTION, $event->getAll());
|
||||||
|
|
||||||
$called = $this->container['dispatcher']->getCalledListeners();
|
$called = $this->container['dispatcher']->getCalledListeners();
|
||||||
$this->assertArrayHasKey(TaskModel::EVENT_USER_MENTION.'.UserMentionJobTest::onUserMention', $called);
|
$this->assertArrayHasKey(TaskModel::EVENT_USER_MENTION.'.UserMentionJobTest::onUserMention', $called);
|
||||||
|
|||||||
Reference in New Issue
Block a user