1
0
mirror of https://github.com/wbbaddons/Tims-Chat.git synced 2024-12-29 22:40:09 +00:00

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

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 @@
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 @@ public function execute($parameters, Room $room, UserProfile $user = null) {
$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 @@ public function execute($parameters, Room $room, UserProfile $user = null) {
'hasEmbeddedObjects' => 1
]);
}
WCF::getDB()->commitTransaction();
}
}