Add missing transaction to WhisperCommand

This commit is contained in:
Tim Düsterhus 2020-11-01 13:25:42 +01:00
parent 6d1b37cacd
commit 1b1e1ed565
Signed by: TimWolla
GPG Key ID: 8FF75566094168AF
1 changed files with 5 additions and 3 deletions

View File

@ -1,11 +1,11 @@
<?php
/*
* Copyright (c) 2010-2018 Tim Düsterhus.
* Copyright (c) 2010-2020 Tim Düsterhus.
*
* Use of this software is governed by the Business Source License
* included in the LICENSE file.
*
* Change Date: 2024-10-20
* Change Date: 2024-11-01
*
* On the date above, in accordance with the Business Source
* License, use of this software will be governed by version 2
@ -17,7 +17,6 @@ namespace chat\system\command;
use \chat\data\message\MessageAction;
use \chat\data\message\MessageEditor;
use \chat\data\room\Room;
use \wcf\data\user\User;
use \wcf\data\user\UserProfile;
use \wcf\system\exception\UserInputException;
use \wcf\system\WCF;
@ -58,6 +57,8 @@ class WhisperCommand extends AbstractInputProcessedCommand implements ICommand {
$objectTypeID = $this->getMessageObjectTypeID('be.bastelstu.chat.messageType.whisper');
$recipient = $this->assertUser($this->assertParameter($parameters, 'username'));
$this->setText($this->assertParameter($parameters, 'text'));
WCF::getDB()->beginTransaction();
$message = (new MessageAction([ ], 'create', [ 'data' => [ 'roomID' => $room->roomID
, 'userID' => $user->userID
, 'username' => $user->username
@ -79,5 +80,6 @@ class WhisperCommand extends AbstractInputProcessedCommand implements ICommand {
'hasEmbeddedObjects' => 1
]);
}
WCF::getDB()->commitTransaction();
}
}