1
0
mirror of https://github.com/wbbaddons/Tims-Chat.git synced 2024-12-21 21:30:08 +00:00

Add missing transaction to PlainCommand

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

View File

@ -10,7 +10,7 @@ Additional Use Grant: You may use the Licensed Work when your application
uses the Licensed Work for a purpose that does neither uses the Licensed Work for a purpose that does neither
directly or indirectly generate revenue. directly or indirectly generate revenue.
Change Date: 2024-10-31 Change Date: 2024-11-01
Change License: Version 2 or later of the GNU General Public License as Change License: Version 2 or later of the GNU General Public License as
published by the Free Software Foundation. published by the Free Software Foundation.

View File

@ -1,11 +1,11 @@
<?php <?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 * Use of this software is governed by the Business Source License
* included in the LICENSE file. * 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 * On the date above, in accordance with the Business Source
* License, use of this software will be governed by version 2 * License, use of this software will be governed by version 2
@ -19,6 +19,7 @@
use \chat\data\room\Room; use \chat\data\room\Room;
use \wcf\data\user\UserProfile; use \wcf\data\user\UserProfile;
use \wcf\system\exception\PermissionDeniedException; use \wcf\system\exception\PermissionDeniedException;
use \wcf\system\WCF;
/** /**
* The plain command creates a normal chat message * The plain command creates a normal chat message
@ -58,6 +59,8 @@ public function execute($parameters, Room $room, UserProfile $user = null) {
$objectTypeID = $this->getMessageObjectTypeID('be.bastelstu.chat.messageType.plain'); $objectTypeID = $this->getMessageObjectTypeID('be.bastelstu.chat.messageType.plain');
$this->setText($this->assertParameter($parameters, 'text')); $this->setText($this->assertParameter($parameters, 'text'));
WCF::getDB()->beginTransaction();
$message = (new MessageAction([ ], 'create', [ 'data' => [ 'roomID' => $room->roomID $message = (new MessageAction([ ], 'create', [ 'data' => [ 'roomID' => $room->roomID
, 'userID' => $user->userID , 'userID' => $user->userID
, 'username' => $user->username , 'username' => $user->username
@ -77,5 +80,6 @@ public function execute($parameters, Room $room, UserProfile $user = null) {
'hasEmbeddedObjects' => 1 'hasEmbeddedObjects' => 1
]); ]);
} }
WCF::getDB()->commitTransaction();
} }
} }